13 #include "subscription.h"
19 static const char* msgTypeStringValues[] =
21 "subscribe",
"subscribed",
"unsubscribe",
"unsubscribed"
26 return util::lookup( type, msgTypeStringValues );
30 : Stanza( tag ), m_subtype( Invalid ), m_stati( 0 )
32 if( !tag || tag->name() !=
"presence" )
35 m_subtype =
static_cast<S10nType
>( util::lookup( tag->findAttribute( TYPE ), msgTypeStringValues ) );
37 const ConstTagList& c = tag->findTagList(
"/presence/status" );
38 ConstTagList::const_iterator it = c.begin();
39 for( ; it != c.end(); ++it )
40 setLang( &m_stati, m_status, (*it) );
43 Subscription::Subscription(
S10nType type,
const JID& to,
const std::string& status,
44 const std::string& xmllang )
45 :
Stanza( to ), m_subtype( type ), m_stati( 0 )
47 setLang( &m_stati, m_status,
status, xmllang );
60 Tag* t =
new Tag(
"presence" );
68 getLangs( m_stati, m_status,
"status", t );
70 StanzaExtensionList::const_iterator it = m_extensionList.begin();
71 for( ; it != m_extensionList.end(); ++it )
const std::string & full() const
This is the base class for XMPP stanza abstractions.
const std::string status(const std::string &lang="default") const
virtual Tag * tag() const
Subscription(S10nType type, const JID &to, const std::string &status=EmptyString, const std::string &xmllang=EmptyString)
This is an abstraction of an XML element.
bool addAttribute(Attribute *attr)
void addChild(Tag *child)
The namespace for the gloox library.
std::list< const Tag * > ConstTagList