Message Class Reference

An abstraction of a message stanza. More...

#include <message.h>

Inherits gloox::Stanza.

List of all members.

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

Detailed Description

An abstraction of a message stanza.

Author:
Vincent Thomasset
Jakob Schroeter <js@camaya.net>
Since:
1.0

Definition at line 33 of file message.h.


Member Enumeration Documentation

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 43 of file message.h.


Constructor & Destructor Documentation

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:
type The message type.
to The intended receiver.
body The message's body text.
subject The message's optional subject.
thread The message's optional thread ID.
xmllang An optional xml:lang for the message body.

Definition at line 54 of file message.cpp.

~Message (  )  [virtual]

Destructor.

Definition at line 63 of file message.cpp.


Member Function Documentation

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:
lang The 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 86 of file message.h.

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

Sets the message's ID. Optional.

Parameters:
id The ID.

Definition at line 121 of file message.h.

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

Sets the thread ID.

Parameters:
thread The thread ID.

Definition at line 115 of file message.h.

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:
lang The 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 100 of file message.h.

MessageType subtype (  )  const [inline]

Returns the message's type.

Returns:
The message's type.

Definition at line 75 of file message.h.

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.

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 109 of file message.h.

const DelayedDelivery* when (  )  const [inline]

Convenience function that returns a pointer to a DelayedDelivery StanzaExtension, if the message contains one.

Returns:
A pointer to a DelayedDelivery object, or 0.

Definition at line 128 of file message.h.


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

Generated by  doxygen 1.6.2