13 #include "featureresourcebind.h"
15 #include "streambase.h"
17 #include <gloox/adhoc.h>
18 #include <gloox/dataform.h>
19 #include <gloox/gloox.h>
28 : m_sm( sm ), m_state( BindCanceled )
34 static const std::string filter =
"/iq/bind[@xmlns='" + gloox::XMLNS_STREAM_BIND +
"']";
44 t =
new gloox::Tag(
"bind" );
45 t->setXmlns( gloox::XMLNS_STREAM_BIND );
46 m_state = BindOffered;
52 void FeatureResourceBind::handleTag( gloox::Tag* _tag )
57 if( m_state == BindOffered && _tag->name() ==
"iq" )
59 const std::string resource = _tag->findCData(
"/iq/bind[@xmlns='" + gloox::XMLNS_STREAM_BIND +
"']/resource" );
61 gloox::JID jid( m_parent->
jid().bare() );
62 jid.setResource( resource );
69 gloox::Tag* re =
new gloox::Tag(
"iq" );
70 re->addAttribute( gloox::TYPE,
"result" );
71 re->addAttribute(
"id", _tag->findAttribute(
"id" ) );
72 gloox::Tag* b =
new gloox::Tag( re,
"bind" );
73 b->setXmlns( gloox::XMLNS_STREAM_BIND );
74 new gloox::Tag( b,
"jid", jid.full() );
79 printf(
"creating a session failed\n" );
82 printf(
"state doesn't match\n" );
84 gloox::IQ re( gloox::IQ::Error, _tag->findAttribute(
"from" ),
85 _tag->findAttribute(
"id" ));