chat-room.h 2.55 KB
Newer Older
Ghislain MARY's avatar
Ghislain MARY committed
1 2
/*
 * chat-room.h
Ghislain MARY's avatar
Ghislain MARY committed
3
 * Copyright (C) 2010-2017 Belledonne Communications SARL
Ghislain MARY's avatar
Ghislain MARY committed
4
 *
Ghislain MARY's avatar
Ghislain MARY committed
5 6 7 8
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
Ghislain MARY's avatar
Ghislain MARY committed
9 10 11 12 13 14 15
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
Ghislain MARY's avatar
Ghislain MARY committed
16 17
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Ghislain MARY's avatar
Ghislain MARY committed
18 19 20 21 22
 */

#ifndef _CHAT_ROOM_H_
#define _CHAT_ROOM_H_

Ronan's avatar
Ronan committed
23
#include "chat/chat-message/chat-message.h"
Ronan's avatar
Ronan committed
24
#include "conference/conference-interface.h"
Ghislain MARY's avatar
Ghislain MARY committed
25 26 27 28 29 30 31

// =============================================================================

LINPHONE_BEGIN_NAMESPACE

class ChatRoomPrivate;

32
class LINPHONE_PUBLIC ChatRoom : public Object, public ConferenceInterface {
33
	friend class Core;
34
	friend class ChatMessage;
35
	friend class ChatMessagePrivate;
36

Ghislain MARY's avatar
Ghislain MARY committed
37
public:
38
	L_OVERRIDE_SHARED_FROM_THIS(ChatRoom);
Ghislain MARY's avatar
Ghislain MARY committed
39

40 41 42
	L_DECLARE_ENUM(Capabilities, L_ENUM_VALUES_CHAT_ROOM_CAPABILITIES);
	L_DECLARE_ENUM(State, L_ENUM_VALUES_CHAT_ROOM_STATE);

43 44
	typedef int CapabilitiesMask;

45
	ChatRoom (LinphoneCore *core);
Ghislain MARY's avatar
Ghislain MARY committed
46 47
	virtual ~ChatRoom () = default;

48
	virtual CapabilitiesMask getCapabilities () const = 0;
49

Ghislain MARY's avatar
Ghislain MARY committed
50
	void compose ();
51 52 53
	std::shared_ptr<ChatMessage> createFileTransferMessage (const LinphoneContent *initialContent);
	std::shared_ptr<ChatMessage> createMessage (const std::string &msg);
	std::shared_ptr<ChatMessage> createMessage ();
Ghislain MARY's avatar
Ghislain MARY committed
54
	void deleteHistory ();
55
	void deleteMessage (const std::shared_ptr<ChatMessage> &msg);
Ronan's avatar
Ronan committed
56
	std::shared_ptr<ChatMessage> findMessage (const std::string &messageId);
57
	std::shared_ptr<ChatMessage> findMessageWithDirection (const std::string &messageId, ChatMessage::Direction direction);
Ronan's avatar
Ronan committed
58
	std::list<std::shared_ptr<ChatMessage>> getHistory (int nbMessages);
Ghislain MARY's avatar
Ghislain MARY committed
59
	int getHistorySize ();
Ronan's avatar
Ronan committed
60
	std::list<std::shared_ptr<ChatMessage>> getHistoryRange (int startm, int endm);
Ghislain MARY's avatar
Ghislain MARY committed
61 62 63 64 65 66
	int getUnreadMessagesCount ();
	bool isRemoteComposing () const;
	void markAsRead ();

	LinphoneCore *getCore () const;

Ronan's avatar
Ronan committed
67
	const Address &getPeerAddress () const;
Ghislain MARY's avatar
Ghislain MARY committed
68
	State getState () const;
69 70 71

protected:
	explicit ChatRoom (ChatRoomPrivate &p);
Ghislain MARY's avatar
Ghislain MARY committed
72 73 74 75 76 77 78 79 80

private:
	L_DECLARE_PRIVATE(ChatRoom);
	L_DISABLE_COPY(ChatRoom);
};

LINPHONE_END_NAMESPACE

#endif // ifndef _CHAT_ROOM_H_