abstract-chat-room.h 4.11 KB
Newer Older
1 2
/*
 * abstract-chat-room.h
3
 * Copyright (C) 2010-2018 Belledonne Communications SARL
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * 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.
 *
 * 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
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

20 21
#ifndef _L_ABSTRACT_CHAT_ROOM_H_
#define _L_ABSTRACT_CHAT_ROOM_H_
22

23 24
#include "linphone/utils/enum-mask.h"

25 26 27 28 29 30 31 32 33
#include "chat/chat-message/chat-message.h"
#include "conference/conference-interface.h"
#include "core/core-accessor.h"

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

LINPHONE_BEGIN_NAMESPACE

class AbstractChatRoomPrivate;
34
class ConferenceId;
35
class EventLog;
36
class ChatRoomParams;
37 38 39 40

class LINPHONE_PUBLIC AbstractChatRoom : public Object, public CoreAccessor, public ConferenceInterface {
	friend class ChatMessage;
	friend class ChatMessagePrivate;
41
	friend class ClientGroupToBasicChatRoomPrivate;
42
	friend class Core;
43 44
	friend class CorePrivate;
	friend class MainDb;
45
	friend class ProxyChatRoomPrivate;
46 47

public:
48 49
	L_OVERRIDE_SHARED_FROM_THIS(AbstractChatRoom);

50
	L_DECLARE_ENUM(Capabilities, L_ENUM_VALUES_CHAT_ROOM_CAPABILITIES);
51
	L_DECLARE_ENUM(SecurityLevel, L_ENUM_VALUES_ENCRYPTION_ENGINE_SECURITY_LEVEL);
52 53
	L_DECLARE_ENUM(State, L_ENUM_VALUES_CHAT_ROOM_STATE);

54
	typedef EnumMask<Capabilities> CapabilitiesMask;
55

Sylvain Berfini's avatar
Sylvain Berfini committed
56 57
	virtual void allowCpim (bool value) = 0;
	virtual void allowMultipart (bool value) = 0;
58 59 60
	virtual bool canHandleCpim () const = 0;
	virtual bool canHandleMultipart () const = 0;

61
	virtual const ConferenceId &getConferenceId () const = 0;
62 63 64 65 66 67 68 69 70

	virtual const IdentityAddress &getPeerAddress () const = 0;
	virtual const IdentityAddress &getLocalAddress () const = 0;

	virtual time_t getCreationTime () const = 0;
	virtual time_t getLastUpdateTime () const = 0;

	virtual CapabilitiesMask getCapabilities () const = 0;
	virtual State getState () const = 0;
71
	virtual SecurityLevel getSecurityLevel () const = 0;
72 73
	virtual bool hasBeenLeft () const = 0;

74 75
	virtual std::list<std::shared_ptr<EventLog>> getMessageHistory (int nLast) const = 0;
	virtual std::list<std::shared_ptr<EventLog>> getMessageHistoryRange (int begin, int end) const = 0;
76 77 78 79
	virtual std::list<std::shared_ptr<EventLog>> getHistory (int nLast) const = 0;
	virtual std::list<std::shared_ptr<EventLog>> getHistoryRange (int begin, int end) const = 0;
	virtual int getHistorySize () const = 0;

80
	virtual void deleteFromDb () = 0;
81 82 83
	virtual void deleteHistory () = 0;

	virtual std::shared_ptr<ChatMessage> getLastChatMessageInHistory () const = 0;
84
	virtual bool isEmpty () const = 0;
85 86 87 88 89 90 91 92 93 94
	virtual int getChatMessageCount () const = 0;
	virtual int getUnreadChatMessageCount () const = 0;

	virtual void compose () = 0;
	virtual bool isRemoteComposing () const = 0;
	virtual std::list<IdentityAddress> getComposingAddresses () const = 0;

	virtual std::shared_ptr<ChatMessage> createChatMessage () = 0;
	virtual std::shared_ptr<ChatMessage> createChatMessage (const std::string &text) = 0;

95
	virtual std::shared_ptr<ChatMessage> createFileTransferMessage (FileContent *content) = 0;
96 97 98 99 100 101 102 103 104

	virtual std::shared_ptr<ChatMessage> findChatMessage (const std::string &messageId) const = 0;
	virtual std::shared_ptr<ChatMessage> findChatMessage (
		const std::string &messageId,
		ChatMessage::Direction direction
	) const = 0;

	virtual void markAsRead () = 0;

105 106
	virtual const std::shared_ptr<ChatRoomParams> &getCurrentParams() const = 0;

107 108 109 110 111 112 113 114 115 116
protected:
	explicit AbstractChatRoom (AbstractChatRoomPrivate &p, const std::shared_ptr<Core> &core);

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

LINPHONE_END_NAMESPACE

117
#endif // ifndef _L_ABSTRACT_CHAT_ROOM_H_