LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
imessage.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QString>
12 #include <QDateTime>
13 #include <QtPlugin>
14 #include "messagebase.h"
15 
16 class QObject;
17 
18 namespace LC
19 {
20 namespace Azoth
21 {
22  class ICLEntry;
23 
42  class IMessage : public MessageBase
43  {
44  public:
45  virtual ~IMessage () {};
46 
49  enum class Direction : uint8_t
50  {
53  In,
54 
57  Out
58  };
59 
62  enum class Type : uint8_t
63  {
67 
75  MUCMessage,
76 
83 
92 
96  };
97 
105  enum class SubType : uint8_t
106  {
110  Other,
111 
115 
119 
137 
142 
146 
150 
155 
159 
163  };
164 
165  enum class EscapePolicy : uint8_t
166  {
167  Escape,
168  NoEscape
169  };
170 
173  virtual QObject* GetQObject () = 0;
174 
183  virtual void Send () = 0;
184 
193  virtual void Store () = 0;
194 
199  virtual Direction GetDirection () const = 0;
200 
205  virtual Type GetMessageType () const = 0;
206 
214  virtual SubType GetMessageSubType () const = 0;
215 
230  virtual QObject* OtherPart () const = 0;
231 
246  virtual QObject* ParentCLEntry () const
247  {
248  return OtherPart ();
249  }
250 
257  virtual QString GetOtherVariant () const = 0;
258 
266  virtual QString GetBody () const = 0;
267 
274  virtual void SetBody (const QString& body) = 0;
275 
285  virtual EscapePolicy GetEscapePolicy () const
286  {
287  return EscapePolicy::Escape;
288  }
289 
294  virtual QDateTime GetDateTime () const = 0;
295 
300  virtual void SetDateTime (const QDateTime& timestamp) = 0;
301  };
302 }
303 }
304 
305 Q_DECLARE_INTERFACE (LC::Azoth::IMessage,
306  "org.LeechCraft.Azoth.IMessage/1.0")
LC::Azoth::IMessage::Direction::Out
@ Out
The message is from us to the remote party.
LC::Azoth::IMessage::SubType
SubType
This enum is used for more precise classification of chat types messages.
Definition: imessage.h:105
LC::Azoth::IMessage::GetQObject
virtual QObject * GetQObject()=0
Returns this message as a QObject.
LC::Azoth::IMessage::Type::EventMessage
@ EventMessage
Various events in a chat.
LC::Azoth::IMessage::Type::StatusMessage
@ StatusMessage
Status changes in a chat.
LC::Azoth::IMessage::EscapePolicy::NoEscape
@ NoEscape
LC::Azoth::IMessage::EscapePolicy
EscapePolicy
Definition: imessage.h:165
LC::Azoth::IMessage::SubType::BanNotification
@ BanNotification
LC::Azoth::IMessage::Direction::In
@ In
The message is from the remote party to us.
LC::Azoth::IMessage::SubType::Other
@ Other
LC::Azoth::IMessage::OtherPart
virtual QObject * OtherPart() const =0
Returns the CL entry from which this message is.
LC::Azoth::IMessage
This interface is used to represent a message.
Definition: imessage.h:42
LC::Azoth::IMessage::GetBody
virtual QString GetBody() const =0
Returns the body of the message.
LC::Azoth::IMessage::EscapePolicy::Escape
@ Escape
LC::Azoth::IMessage::GetMessageSubType
virtual SubType GetMessageSubType() const =0
Returns the subtype of this message.
LC::Azoth::IMessage::Type::ChatMessage
@ ChatMessage
Standard one-to-one message.
LC::Azoth::IMessage::Store
virtual void Store()=0
Stores the message.
messagebase.h
LC::Azoth::IMessage::SubType::ParticipantRoleAffiliationChange
@ ParticipantRoleAffiliationChange
Represents permission changes of a participant in a chat or MUC room.
LC::Azoth::IMessage::ParentCLEntry
virtual QObject * ParentCLEntry() const
Returns the parent CL entry of this message.
Definition: imessage.h:246
LC::Azoth::IMessage::SubType::ParticipantEndedConversation
@ ParticipantEndedConversation
The participant has ended the conversation.
LC::Azoth::IMessage::Type::ServiceMessage
@ ServiceMessage
Other.
LC::Azoth::IMessage::Direction
Direction
Represents the direction of the message.
Definition: imessage.h:49
LC::Azoth::IMessage::SubType::KickNotification
@ KickNotification
LC::Azoth::IMessage::GetDateTime
virtual QDateTime GetDateTime() const =0
Returns the timestamp of the message.
LC::Azoth::IMessage::GetOtherVariant
virtual QString GetOtherVariant() const =0
The variant of the other part.
LC::Azoth::IMessage::SubType::ParticipantStatusChange
@ ParticipantStatusChange
Represents status change of a participant in a chat or MUC room.
LC::Azoth::IMessage::SetDateTime
virtual void SetDateTime(const QDateTime &timestamp)=0
Updates the timestamp of the message.
LC::Azoth::IMessage::SubType::ParticipantLeave
@ ParticipantLeave
Notifies about participant leaving a MUC room.
LC::Azoth::IMessage::Send
virtual void Send()=0
Sends the message.
LC::Azoth::IMessage::GetEscapePolicy
virtual EscapePolicy GetEscapePolicy() const
Returns the escape policy of the body.
Definition: imessage.h:285
LC::Azoth::IMessage::SetBody
virtual void SetBody(const QString &body)=0
Updates the body of the message.
LC::Azoth::IMessage::SubType::ParticipantJoin
@ ParticipantJoin
Notifies about participant joining to a MUC room.
LC::Azoth::IMessage::SubType::ParticipantNickChange
@ ParticipantNickChange
Notifies about participant in a MUC changing the nick.
LC::Azoth::IMessage::SubType::RoomSubjectChange
@ RoomSubjectChange
Notifies about changing subject in a MUC room.
LC::Azoth::IMessage::GetMessageType
virtual Type GetMessageType() const =0
Returns the type of this message.
LC
Definition: activityinfo.h:13
LC::Azoth::IMessage::~IMessage
virtual ~IMessage()
Definition: imessage.h:45
LC::Azoth::IMessage::Type::MUCMessage
@ MUCMessage
Message in a multiuser conference.
LC::Azoth::MessageBase
Definition: messagebase.h:27
LC::Azoth::IMessage::Type
Type
Represents possible message types.
Definition: imessage.h:62
LC::Azoth::IMessage::GetDirection
virtual Direction GetDirection() const =0
Returns the direction of this message.