Home · Modules · All Classes · All Namespaces
Public Member Functions | List of all members
Tp::Message Class Reference

The Message class represents a Telepathy message in a TextChannel. More...

#include <TelepathyQt/Message>

Inherited by Tp::ReceivedMessage.

Public Member Functions

 Message (ChannelTextMessageType, const QString &)
 
 Message (const Message &other)
 
 ~Message ()
 
Messageoperator= (const Message &other)
 
bool operator== (const Message &other) const
 
bool operator!= (const Message &other) const
 
QDateTime sent () const
 
ChannelTextMessageType messageType () const
 
bool isTruncated () const
 
bool hasNonTextContent () const
 
QString messageToken () const
 
bool isSpecificToDBusInterface () const
 
QString dbusInterface () const
 
QString text () const
 
MessagePart header () const
 
int size () const
 
MessagePart part (uint index) const
 
MessagePartList parts () const
 

Detailed Description

The Message class represents a Telepathy message in a TextChannel.

This class is implicitly shared, like QString.

Constructor & Destructor Documentation

◆ Message() [1/2]

Tp::Message::Message ( ChannelTextMessageType  type,
const QString &  text 
)

Construct a new Message object.

Parameters
typeThe message type.
textThe message body.

◆ Message() [2/2]

Tp::Message::Message ( const Message other)

Copy constructor.

◆ ~Message()

Tp::Message::~Message ( )

Class destructor.

Member Function Documentation

◆ operator=()

Message & Tp::Message::operator= ( const Message other)

Assignment operator.

◆ operator==()

bool Tp::Message::operator== ( const Message other) const

Equality operator.

◆ operator!=()

bool Tp::Message::operator!= ( const Message other) const
inline

◆ sent()

QDateTime Tp::Message::sent ( ) const

Return the time the message was sent, or QDateTime() if that time is unknown.

Returns
The timestamp as QDateTime.

◆ messageType()

ChannelTextMessageType Tp::Message::messageType ( ) const

Return the type of this message, or ChannelTextMessageTypeNormal if the type is not recognised.

Returns
The type as ChannelTextMessageType.

◆ isTruncated()

bool Tp::Message::isTruncated ( ) const

Return whether this message was truncated during delivery.

Returns
true if truncated, false otherwise.

◆ hasNonTextContent()

bool Tp::Message::hasNonTextContent ( ) const

Return whether this message contains parts not representable as plain text.

Returns
true if it cannot completely be represented as plain text, false otherwise.

◆ messageToken()

QString Tp::Message::messageToken ( ) const

Return the unique token identifying this message (e.g. the id attribute for XMPP messages), or an empty string if there is no suitable token.

Returns
The non-empty message identifier, or an empty string if none.

◆ isSpecificToDBusInterface()

bool Tp::Message::isSpecificToDBusInterface ( ) const

Return whether this message is specific to a D-Bus interface. This is false in almost all cases.

If this function returns true, the message is specific to the interface indicated by dbusInterface(). Clients that don't understand that interface should not display the message. However, if the client would acknowledge an ordinary message, it must also acknowledge this interface-specific message.

Returns
true if dbusInterface() would return a non-empty string, false otherwise.
See also
dbusInterface()

◆ dbusInterface()

QString Tp::Message::dbusInterface ( ) const

Return the D-Bus interface to which this message is specific, or an empty string for normal messages.

Returns
The D-Bus interface name, or an empty string.
See also
isSpecificToDBusInterface()

◆ text()

QString Tp::Message::text ( ) const

Return the message body containing all "text/plain" parts.

Returns
The body text.

◆ header()

MessagePart Tp::Message::header ( ) const

Return the message's header part, as defined by the Telepathy specification.

This is provided for advanced clients that need to access additional information not available through the normal Message API.

Returns
The header as a MessagePart object. The same thing as part(0).

◆ size()

int Tp::Message::size ( ) const

Return the number of parts in this message.

Returns
1 greater than the largest valid argument to part().
See also
part(), parts()

◆ part()

MessagePart Tp::Message::part ( uint  index) const

Return the message's part for index, as defined by the Telepathy specification.

This is provided for advanced clients that need to access additional information not available through the normal Message API.

Parameters
indexThe part to access, which must be strictly less than size(); part number 0 is the header, parts numbered 1 or greater are the body of the message.
Returns
A MessagePart object.

◆ parts()

MessagePartList Tp::Message::parts ( ) const

Return the list of message parts forming this message.

Returns
The list of MessagePart objects.