LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IMessage Class Referenceabstract

This interface is used to represent a message. More...

#include "imessage.h"

+ Inheritance diagram for LC::Azoth::IMessage:
+ Collaboration diagram for LC::Azoth::IMessage:

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 &timestamp)=0
 Updates the timestamp of the message. More...
 
- Public Member Functions inherited from LC::Azoth::MessageBase
void ToggleOTRMessage (bool otr)
 
bool IsOTRMessage () const
 
void ToggleForwarded (bool forwarded)
 
bool IsForwarded () const
 

Additional Inherited Members

- Protected Attributes inherited from LC::Azoth::MessageBase
bool IsOTR_ = false
 
bool IsForwarded_ = false
 

Detailed Description

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.

See also
IAdvancedMessage, IRichTextMessage.

Definition at line 42 of file imessage.h.

Member Enumeration Documentation

◆ Direction

enum LC::Azoth::IMessage::Direction : uint8_t
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.

◆ EscapePolicy

enum LC::Azoth::IMessage::EscapePolicy : uint8_t
strong
Enumerator
Escape 
NoEscape 

Definition at line 165 of file imessage.h.

◆ SubType

enum LC::Azoth::IMessage::SubType : uint8_t
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:

  • Azoth/Nick, with a QString representing nick of the participant that has changed its status.
  • Azoth/TargetState, with a QString representing the target state. The string is better obtained from the State enum by the means of IProxyObject::StateToString method.
  • Azoth/StatusText, with a QString representing the new status text of the participant. May be empty.
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.

◆ Type

enum LC::Azoth::IMessage::Type : uint8_t
strong

Represents possible message types.

Enumerator
ChatMessage 

Standard one-to-one message.

MUCMessage 

Message in a multiuser conference.

       This kind of message is only for messages that originate
       from participants and are human-generated. Thus, status
       changes, topic changes and such should have a different
       type.
StatusMessage 

Status changes in a chat.

       This type of message contains information about
       participant's status/presence changes.
EventMessage 

Various events in a chat.

       Messages of this type are for notifying about, for
       example, topic changes, kicks, bans, etc. Generally,
       there is no other part in such messages, so the message
       of this type can return NULL from OtherPart().
ServiceMessage 

Other.

Definition at line 62 of file imessage.h.

Constructor & Destructor Documentation

◆ ~IMessage()

virtual LC::Azoth::IMessage::~IMessage ( )
inlinevirtual

Definition at line 45 of file imessage.h.

Member Function Documentation

◆ GetBody()

virtual QString LC::Azoth::IMessage::GetBody ( ) const
pure virtual

Returns the body of the message.

The body is expected to be a plain text string. All '<' and '&' will be escaped.

Returns
The body of the message.

◆ GetDateTime()

virtual QDateTime LC::Azoth::IMessage::GetDateTime ( ) const
pure virtual

Returns the timestamp of the message.

Returns
The timestamp of the message.

◆ GetDirection()

virtual Direction LC::Azoth::IMessage::GetDirection ( ) const
pure virtual

Returns the direction of this message.

Returns
The direction of this message.

◆ GetEscapePolicy()

virtual EscapePolicy LC::Azoth::IMessage::GetEscapePolicy ( ) const
inlinevirtual

Returns the escape policy of the body.

The default implementation simply returns EscapePolicy::Escape.

Returns
The body escape policy.
See also
EscapePolicy
GetEscapedBody()

Definition at line 285 of file imessage.h.

References Escape.

◆ GetMessageSubType()

virtual SubType LC::Azoth::IMessage::GetMessageSubType ( ) const
pure virtual

Returns the subtype of this message.

The subtype is used for more precise classification of messages.

Returns
The subtype of this message

◆ GetMessageType()

virtual Type LC::Azoth::IMessage::GetMessageType ( ) const
pure virtual

Returns the type of this message.

Returns
The type of this message.

◆ GetOtherVariant()

virtual QString LC::Azoth::IMessage::GetOtherVariant ( ) const
pure virtual

The variant of the other part.

If not applicable, a null string should be returned.

Returns
The variant of the other part.

◆ GetQObject()

virtual QObject* LC::Azoth::IMessage::GetQObject ( )
pure virtual

Returns this message as a QObject.

◆ OtherPart()

virtual QObject* LC::Azoth::IMessage::OtherPart ( ) const
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.

Returns
The CL entry from which this message originates, implementing ICLEntry.

Referenced by ParentCLEntry().

+ Here is the caller graph for this function:

◆ ParentCLEntry()

virtual QObject* LC::Azoth::IMessage::ParentCLEntry ( ) const
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.

Returns
The parent CL entry of this message, implementing ICLEntry.

Definition at line 246 of file imessage.h.

References OtherPart().

+ Here is the call graph for this function:

◆ Send()

virtual void LC::Azoth::IMessage::Send ( )
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.

◆ SetBody()

virtual void LC::Azoth::IMessage::SetBody ( const QString &  body)
pure virtual

Updates the body of the message.

The passed string is the plain text contents of the message.

Parameters
[in]bodyThe new body of the message.

◆ SetDateTime()

virtual void LC::Azoth::IMessage::SetDateTime ( const QDateTime &  timestamp)
pure virtual

Updates the timestamp of the message.

Parameters
[in]timestampThe new timestamp of the message.

◆ Store()

virtual void LC::Azoth::IMessage::Store ( )
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.

See also
ICLEntry::GetAllMessages()

The documentation for this class was generated from the following file: