ImagingTools Core SDK
CChatServiceComp.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4// ACF includes
5#include <icomp/CComponentBase.h>
6
7// ImtCore includes
8#include <imtchat/IChatService.h>
9#include <imtchat/IChatMessage.h>
10#include <imtchat/IConversation.h>
11#include <imtbase/IObjectCollection.h>
12
13
14namespace imtchat
15{
16
17
18class CChatServiceComp:
19 public icomp::CComponentBase,
20 virtual public IChatService
21{
22public:
23 typedef icomp::CComponentBase BaseClass;
24
25 I_BEGIN_COMPONENT(CChatServiceComp)
26 I_REGISTER_INTERFACE(IChatService);
27 I_ASSIGN(m_messageCollectionCompPtr, "MessageCollection", "Collection of chat messages", true, "MessageCollection");
28 I_ASSIGN(m_conversationCollectionCompPtr, "ConversationCollection", "Collection of conversations", true, "ConversationCollection");
29 I_ASSIGN(m_messageFactCompPtr, "MessageFactory", "Factory for creating chat message objects", true, "MessageFactory");
30 I_ASSIGN(m_conversationFactCompPtr, "ConversationFactory", "Factory for creating conversation objects", true, "ConversationFactory");
31 I_END_COMPONENT
32
33 // reimplemented (imtchat::IChatService)
34 virtual QByteArray SendMessage(
35 const QByteArray& conversationId,
36 const QString& content,
37 const QByteArrayList& entityReferences = QByteArrayList(),
38 const QByteArrayList& attachmentIds = QByteArrayList()) override;
39 virtual QByteArrayList GetMessages(
40 const QByteArray& conversationId,
41 int offset = 0,
42 int limit = 50) const override;
43 virtual QByteArray CreateConversation(
44 const QString& name,
45 int conversationType,
46 const QByteArrayList& participantIds) override;
47 virtual QByteArrayList GetConversations(int offset = 0, int limit = -1) const override;
48 virtual bool MarkMessageRead(
49 const QByteArray& conversationId,
50 const QByteArray& messageId) override;
51
52private:
53 I_REF(imtbase::IObjectCollection, m_messageCollectionCompPtr);
54 I_REF(imtbase::IObjectCollection, m_conversationCollectionCompPtr);
55 I_FACT(IChatMessage, m_messageFactCompPtr);
56 I_FACT(IConversation, m_conversationFactCompPtr);
57};
58
59
60} // namespace imtchat
Internal Service Desk Chat Domain Model Module.