Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

jabberoo::Message Class Reference

A Jabber Message. More...

#include <message.hh>

Inheritance diagram for jabberoo::Message:

jabberoo::Packet List of all members.

Public Types

enum  Type {
  mtNormal, mtError, mtChat, mtGroupchat,
  mtHeadline
}
 Message type. More...


Public Member Functions

 Message (const judo::Element &t)
 Construct a message based upon the given judo::Element.

 Message (const std::string &jid, const std::string &body, Type mtype=mtNormal)
 Construct a message to a JabberID with a body.

void setBody (const std::string &body)
 Sets the body of the message.

void setSubject (const std::string &subject)
 Sets the subject of the message.

void setThread (const std::string &thread)
 Sets the message thread.

void setType (Message::Type mtype)
 Sets the message type.

void requestDelivered ()
 Request the delivered message event.

void requestDisplayed ()
 Request the displayed message event.

void requestComposing ()
 Request the composing message event.

const std::string getBody () const
 Get the message body.

const std::string getSubject () const
 Get the message subject.

const std::string getThread () const
 Get the message thread.

Type getType () const
 Get the Message::Type.

const std::string getDateTime (const std::string &format="") const
 Get the date and time the message was sent with a given format.

Message replyTo (const std::string &body) const
 Create a message in response to this message.

Message Message::delivered () const
 Create a message event stating that this Message has been delivered.

Message Message::displayed () const
 Create a message event stating that this Message has been displayed.

Message Message::composing () const
 Create a message event stating that this Message is being replied to.


Static Public Member Functions

void setDateTimeFormat (const std::string &format)
 Sets the date and time format.AM_CONDITIONAL(DEBUG, test x$debug = xyes) test=no AM_CONDITIONAL(TEST, test x$test = xyes).

const std::string & getDateTimeFormat ()
 Get the date and time format.


Static Public Attributes

const unsigned int numTypes = 5
 Number of message types.


Detailed Description

A Jabber Message.

This class implements most of the methods needed to deal with a Jabber Message.

See also:
jabberoo::Packet

Definition at line 46 of file message.hh.


Member Enumeration Documentation

enum jabberoo::Message::Type
 

Message type.

This is a hint to clients as to how the message should be displayed.

Enumeration values:
mtNormal  A normal message (email, icq).
mtError  An error message.
mtChat  A chat message (AIM, IRC /msg's).
mtGroupchat  A groupchat message (IRC).
mtHeadline  A headline message (stock ticker, news ticker).

Definition at line 61 of file message.hh.


Constructor & Destructor Documentation

jabberoo::Message::Message const judo::Element   t
 

Construct a message based upon the given judo::Element.

See also:
judo::Element
Parameters:
t A judo::Element which should have a message base element

Definition at line 39 of file jabberoo-message.cpp.

References jabberoo::Packet::addX(), jabberoo::Packet::findX(), getDateTime(), and jabberoo::Packet::getFrom().

Referenced by replyTo().

jabberoo::Message::Message const std::string &    jid,
const std::string &    body,
Type    mtype = mtNormal
 

Construct a message to a JabberID with a body.

Note that setting a body here is oh-so-slightly faster than calling setBody(), since setBody() checks for a pre-existing body element.

See also:
Message::Type
Parameters:
jid The string of a JabberID to which this message is addressed.
body The string body of a message. Can be NULL.
mtype The Message::Type of the message. Defaults to mtNormal.

Definition at line 90 of file jabberoo-message.cpp.

References judo::Element::addElement(), jabberoo::Packet::setTo(), and setType().


Member Function Documentation

const std::string jabberoo::Message::getBody   const
 

Get the message body.

Returns:
A string containing the message body.

Definition at line 199 of file jabberoo-message.cpp.

References judo::Element::getChildCData().

const std::string jabberoo::Message::getDateTime const std::string &    format = "" const
 

Get the date and time the message was sent with a given format.

Parameters:
format The format of the date and time.

Definition at line 220 of file jabberoo-message.cpp.

Referenced by Message().

const std::string & jabberoo::Message::getDateTimeFormat   [static]
 

Get the date and time format.

Definition at line 344 of file jabberoo-message.cpp.

const std::string jabberoo::Message::getSubject   const
 

Get the message subject.

Returns:
A string containing the message subject.

Definition at line 204 of file jabberoo-message.cpp.

References judo::Element::getChildCData().

const std::string jabberoo::Message::getThread   const
 

Get the message thread.

Returns:
A string containing the message thread.

Definition at line 209 of file jabberoo-message.cpp.

References judo::Element::getChildCData().

Message::Type jabberoo::Message::getType   const
 

Get the Message::Type.

See also:
Message::Type

Definition at line 214 of file jabberoo-message.cpp.

Message jabberoo::Message::Message::composing   const
 

Create a message event stating that this Message is being replied to.

It is up to the client to determine whether this message should actually be generated and sent.

Returns:
The composing message event which should be sent.

Message jabberoo::Message::Message::delivered   const
 

Create a message event stating that this Message has been delivered.

It is up to the client to determine whether this message should actually be generated and sent.

Returns:
The delivered message event which should be sent.

Message jabberoo::Message::Message::displayed   const
 

Create a message event stating that this Message has been displayed.

It is up to the client to determine whether this message should actually be generated and sent.

Returns:
The displayed message event which should be sent.

Message jabberoo::Message::replyTo const std::string &    body const
 

Create a message in response to this message.

Parameters:
body The body of the reply message.
Returns:
The new message.

Definition at line 251 of file jabberoo-message.cpp.

References Message().

void jabberoo::Message::requestComposing  
 

Request the composing message event.

If the receiving client supports message events, a message with a message:x:event containing a composing element will be returned when the receiving user begins composing a reply.

Definition at line 185 of file jabberoo-message.cpp.

References jabberoo::Packet::addX(), and jabberoo::Packet::findX().

void jabberoo::Message::requestDelivered  
 

Request the delivered message event.

If the receiving client supports message events, a message with a message:x:event containing a delivered element will be returned once this message has been delivered.

Definition at line 157 of file jabberoo-message.cpp.

References jabberoo::Packet::addX(), and jabberoo::Packet::findX().

void jabberoo::Message::requestDisplayed  
 

Request the displayed message event.

If the receiving client supports message events, a message with a message:x:event containing a displayed element will be returned once this message has been displayed.

Definition at line 171 of file jabberoo-message.cpp.

References jabberoo::Packet::addX(), and jabberoo::Packet::findX().

void jabberoo::Message::setBody const std::string &    body
 

Sets the body of the message.

Parameters:
body The string body of a message.

Definition at line 100 of file jabberoo-message.cpp.

References judo::Element::addElement(), and judo::Element::findElement().

void jabberoo::Message::setDateTimeFormat const std::string &    format [static]
 

Sets the date and time format.AM_CONDITIONAL(DEBUG, test x$debug = xyes) test=no AM_CONDITIONAL(TEST, test x$test = xyes).

Parameters:
format A string date and time format.

Definition at line 339 of file jabberoo-message.cpp.

void jabberoo::Message::setSubject const std::string &    subject
 

Sets the subject of the message.

Parameters:
subject The string subject of the message.

Definition at line 117 of file jabberoo-message.cpp.

References judo::Element::addElement(), and judo::Element::findElement().

void jabberoo::Message::setThread const std::string &    thread
 

Sets the message thread.

The message thread is used by clients to relate messages to one another.

Parameters:
thread A string representing the thread, there is no rule as to how it should be generated.

Definition at line 134 of file jabberoo-message.cpp.

References judo::Element::addElement(), and judo::Element::findElement().

void jabberoo::Message::setType Message::Type    mtype
 

Sets the message type.

Parameters:
mtype The Message::Type of the message. Defaults to mtNormal.

Definition at line 151 of file jabberoo-message.cpp.

References judo::Element::putAttrib().

Referenced by Message().


Member Data Documentation

const unsigned int jabberoo::Message::numTypes = 5 [static]
 

Number of message types.

Definition at line 37 of file jabberoo-message.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 13:31:52 2003 for jabberoo by doxygen1.3-rc3