![]() |
LeechCraft Azoth
0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
|
This interface is used to represent a message. More...
#include "imessage.h"
Public Types | |
enum | Direction : uint8_t { Direction::In, Direction::Out } |
Represents the direction of the message. More... | |
enum | Type : uint8_t { Type::ChatMessage, Type::MUCMessage, Type::StatusMessage, Type::EventMessage, Type::ServiceMessage } |
Represents possible message types. More... | |
enum | SubType : uint8_t { SubType::Other, SubType::KickNotification, SubType::BanNotification, SubType::ParticipantStatusChange, SubType::ParticipantRoleAffiliationChange, SubType::ParticipantJoin, SubType::ParticipantLeave, SubType::ParticipantNickChange, SubType::ParticipantEndedConversation, SubType::RoomSubjectChange } |
This enum is used for more precise classification of chat types messages. More... | |
enum | EscapePolicy : uint8_t { EscapePolicy::Escape, EscapePolicy::NoEscape } |
Public Member Functions | |
virtual | ~IMessage () |
virtual QObject * | GetQObject ()=0 |
Returns this message as a QObject. More... | |
virtual void | Send ()=0 |
Sends the message. More... | |
virtual void | Store ()=0 |
Stores the message. More... | |
virtual Direction | GetDirection () const =0 |
Returns the direction of this message. More... | |
virtual Type | GetMessageType () const =0 |
Returns the type of this message. More... | |
virtual SubType | GetMessageSubType () const =0 |
Returns the subtype of this message. More... | |
virtual QObject * | OtherPart () const =0 |
Returns the CL entry from which this message is. More... | |
virtual QObject * | ParentCLEntry () const |
Returns the parent CL entry of this message. More... | |
virtual QString | GetOtherVariant () const =0 |
The variant of the other part. More... | |
virtual QString | GetBody () const =0 |
Returns the body of the message. More... | |
virtual void | SetBody (const QString &body)=0 |
Updates the body of the message. More... | |
virtual EscapePolicy | GetEscapePolicy () const |
Returns the escape policy of the body. More... | |
virtual QDateTime | GetDateTime () const =0 |
Returns the timestamp of the message. More... | |
virtual void | SetDateTime (const QDateTime ×tamp)=0 |
Updates the timestamp of the message. More... | |
Additional Inherited Members |
This interface is used to represent a message.
Refer to the Type enum for the list of possible message types that are covered by this interface.
The message should not be sent upon creation, only call to Send() should trigger the sending.
This interface provides only more or less basic functionality. Advanced features like delivery receipts and such, are in IAdvancedMessage.
Messages implementing this interface are expected to contain only plain text bodies. If a message may also contain rich text, it should implement the IRichTextMessage interface.
Definition at line 42 of file imessage.h.
|
strong |
Represents the direction of the message.
Enumerator | |
---|---|
In | The message is from the remote party to us. |
Out | The message is from us to the remote party. |
Definition at line 49 of file imessage.h.
|
strong |
Enumerator | |
---|---|
Escape | |
NoEscape |
Definition at line 165 of file imessage.h.
|
strong |
This enum is used for more precise classification of chat types messages.
The messages of some particular types may have additional required properties used by the Azoth Core and other plugins to establish proper context for the events.
Enumerator | |
---|---|
Other | This message is of subtype that doesn't correspond to any other subtype of message. |
KickNotification | This message notifies about someone being just kicked. |
BanNotification | This message notifies about someone being just banned. |
ParticipantStatusChange | Represents status change of a participant in a chat or MUC room. The corresponding Type is MTStatusMessage. Messages of this type should have the following dynamic properties:
|
ParticipantRoleAffiliationChange | Represents permission changes of a participant in a chat or MUC room. |
ParticipantJoin | Notifies about participant joining to a MUC room. |
ParticipantLeave | Notifies about participant leaving a MUC room. |
ParticipantNickChange | Notifies about participant in a MUC changing the nick. |
ParticipantEndedConversation | The participant has ended the conversation. |
RoomSubjectChange | Notifies about changing subject in a MUC room. |
Definition at line 105 of file imessage.h.
|
strong |
Represents possible message types.
Definition at line 62 of file imessage.h.
|
inlinevirtual |
Definition at line 45 of file imessage.h.
|
pure virtual |
Returns the body of the message.
The body is expected to be a plain text string. All '<' and '&' will be escaped.
|
pure virtual |
Returns the timestamp of the message.
|
pure virtual |
Returns the direction of this message.
|
inlinevirtual |
Returns the escape policy of the body.
The default implementation simply returns EscapePolicy::Escape.
Definition at line 285 of file imessage.h.
References Escape.
|
pure virtual |
Returns the subtype of this message.
The subtype is used for more precise classification of messages.
|
pure virtual |
Returns the type of this message.
|
pure virtual |
The variant of the other part.
If not applicable, a null string should be returned.
|
pure virtual |
Returns this message as a QObject.
|
pure virtual |
Returns the CL entry from which this message is.
For normal, single user chats, this should always be equal to the ICLEntry that was (and will be) used to send the message back.
For multiuser chats this should be equal to the contact list representation of the participant that sent the message.
The returned object must implement ICLEntry.
Referenced by ParentCLEntry().
|
inlinevirtual |
Returns the parent CL entry of this message.
This is the same that OtherPart() for single user chats. For multiuser chats it should be the contact list entry representing the MUC room.
By default this function calls OtherPart() and returns its result.
The returned object must implement ICLEntry.
Definition at line 246 of file imessage.h.
References OtherPart().
|
pure virtual |
Sends the message.
A message should never be sent except as the result of this method.
Please note that if the other part is a MUC, it should send back this message with the "IN" direction set.
|
pure virtual |
Updates the body of the message.
The passed string is the plain text contents of the message.
[in] | body | The new body of the message. |
|
pure virtual |
Updates the timestamp of the message.
[in] | timestamp | The new timestamp of the message. |
|
pure virtual |
Stores the message.
After calling this function this message should be present in the messages list returned by ICLEntry::GetAllMessages(), but the message shouldn't be sent.