gloox  1.0.21
Public Types | Public Member Functions | List of all members
Message Class Reference

#include <message.h>

Inheritance diagram for Message:
Inheritance graph
[legend]

Public Types

enum  MessageType {
  Chat = 1, Error = 2, Groupchat = 4, Headline = 8,
  Normal = 16, Invalid = 32
}
 

Public Member Functions

 Message (MessageType type, const JID &to, const std::string &body=EmptyString, const std::string &subject=EmptyString, const std::string &thread=EmptyString, const std::string &xmllang=EmptyString)
 
virtual ~Message ()
 
MessageType subtype () const
 
const std::string body (const std::string &lang="default") const
 
const std::string subject (const std::string &lang="default") const
 
const std::string & thread () const
 
void setThread (const std::string &thread)
 
void setID (const std::string &id)
 
const DelayedDeliverywhen () const
 
virtual Tagtag () const
 
- Public Member Functions inherited from Stanza
virtual ~Stanza ()
 
void setFrom (const JID &from)
 
const JIDfrom () const
 
const JIDto () const
 
const std::string & id () const
 
const Errorerror () const
 
const std::string & xmlLang () const
 
void addExtension (const StanzaExtension *se)
 
const StanzaExtensionfindExtension (int type) const
 
template<class T >
const T * findExtension (int type) const
 
const StanzaExtensionListextensions () const
 
void removeExtensions ()
 
void setEmbeddedStanza ()
 
bool hasEmbeddedStanza () const
 
StanzaembeddedStanza () const
 
TagembeddedTag () const
 

Additional Inherited Members

- Protected Member Functions inherited from Stanza
 Stanza (Tag *tag)
 
 Stanza (const JID &to)
 

Detailed Description

An abstraction of a message stanza.

Author
Vincent Thomasset
Jakob Schröter js@ca.nosp@m.maya.nosp@m..net
Since
1.0

Definition at line 33 of file message.h.

Member Enumeration Documentation

◆ MessageType

Describes the different valid message types.

Enumerator
Chat 

A chat message.

Error 

An error message.

Groupchat 

A groupchat message.

Headline 

A headline message.

Normal 

A normal message.

Invalid 

The message stanza is invalid.

Definition at line 44 of file message.h.

Constructor & Destructor Documentation

◆ Message()

Message ( MessageType  type,
const JID to,
const std::string &  body = EmptyString,
const std::string &  subject = EmptyString,
const std::string &  thread = EmptyString,
const std::string &  xmllang = EmptyString 
)

Creates a Message.

Parameters
typeThe message type.
toThe intended receiver.
bodyThe message's body text.
subjectThe message's optional subject.
threadThe message's optional thread ID.
xmllangAn optional xml:lang for the message body.

Definition at line 54 of file message.cpp.

◆ ~Message()

~Message ( )
virtual

Destructor.

Definition at line 63 of file message.cpp.

Member Function Documentation

◆ body()

const std::string body ( const std::string &  lang = "default") const
inline

Returns the message body for the given language if available. If the requested language is not available, the default body (without a xml:lang attribute) will be returned.

Parameters
langThe language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default body will be returned, if any.
Returns
The message body.

Definition at line 87 of file message.h.

◆ setID()

void setID ( const std::string &  id)
inline

Sets the message's ID. Optional.

Parameters
idThe ID.

Definition at line 122 of file message.h.

◆ setThread()

void setThread ( const std::string &  thread)
inline

Sets the thread ID.

Parameters
threadThe thread ID.

Definition at line 116 of file message.h.

◆ subject()

const std::string subject ( const std::string &  lang = "default") const
inline

Returns the message subject for the given language if available. If the requested language is not available, the default subject (without a xml:lang attribute) will be returned.

Parameters
langThe language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default subject will be returned, if any.
Returns
The message subject.

Definition at line 101 of file message.h.

◆ subtype()

MessageType subtype ( ) const
inline

Returns the message's type.

Returns
The message's type.

Definition at line 76 of file message.h.

◆ tag()

Tag * tag ( ) const
virtual

Creates a Tag representation of the Stanza. The Tag is completely independent of the Stanza and will not be updated when the Stanza is modified.

Returns
A pointer to a Tag representation. It is the job of the caller to delete the Tag.

Implements Stanza.

Definition at line 69 of file message.cpp.

◆ thread()

const std::string& thread ( ) const
inline

Returns the thread ID of a message stanza.

Returns
The thread ID of a message stanza. Empty for non-message stanzas.

Definition at line 110 of file message.h.

◆ when()

const DelayedDelivery* when ( ) const
inline

Convenience function that returns a pointer to a DelayedDelivery StanzaExtension, if the message contains one. Make sure you have registered a DelayedDelivery instance with your ClientBase (this is not done automatically), otherwise this method will always return 0.

Returns
A pointer to a DelayedDelivery object, or 0.

Definition at line 131 of file message.h.


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