19 static const char* msgTypeStringValues[] =
21 "chat",
"error",
"groupchat",
"headline",
"normal"
26 return util::lookup2( type, msgTypeStringValues );
30 : Stanza( tag ), m_subtype( Invalid ), m_bodies( 0 ), m_subjects( 0 )
32 if( !tag || tag->name() !=
"message" )
35 const std::string& typestring = tag->findAttribute( TYPE );
36 if( typestring.empty() )
39 m_subtype =
static_cast<MessageType
>( util::lookup2( typestring, msgTypeStringValues ) );
41 const TagList& c = tag->children();
42 TagList::const_iterator it = c.begin();
43 for( ; it != c.end(); ++it )
45 if( (*it)->name() ==
"body" )
46 setLang( &m_bodies, m_body, (*it) );
47 else if( (*it)->name() ==
"subject" )
48 setLang( &m_subjects, m_subject, (*it) );
49 else if( (*it)->name() ==
"thread" )
50 m_thread = (*it)->cdata();
55 const std::string& body,
const std::string& subject,
56 const std::string& thread,
const std::string& xmllang )
57 :
Stanza( to ), m_subtype( type ), m_bodies( 0 ), m_subjects( 0 ), m_thread( thread )
59 setLang( &m_bodies, m_body,
body, xmllang );
60 setLang( &m_subjects, m_subject,
subject, xmllang );
74 Tag* t =
new Tag(
"message" );
83 getLangs( m_bodies, m_body,
"body", t );
84 getLangs( m_subjects, m_subject,
"subject", t );
86 if( !m_thread.empty() )
87 new Tag( t,
"thread", m_thread );
89 StanzaExtensionList::const_iterator it = m_extensionList.begin();
90 for( ; it != m_extensionList.end(); ++it )
const std::string & full() const
const std::string subject(const std::string &lang="default") const
const std::string body(const std::string &lang="default") const
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 Tag * tag() const
This is the base class for XMPP stanza abstractions.
This is an abstraction of an XML element.
bool addAttribute(Attribute *attr)
void addChild(Tag *child)
The namespace for the gloox library.
std::list< Tag * > TagList