14 #include "nonsaslauth.h"
25 NonSaslAuth::Query::Query(
const std::string& user )
26 : StanzaExtension(
ExtNonSaslAuth ), m_user( user ), m_digest( true )
30 NonSaslAuth::Query::Query(
const Tag* tag )
33 if( !tag || tag->name() !=
"query" || tag->xmlns() !=
XMLNS_AUTH )
36 m_digest = tag->hasChild(
"digest" );
39 NonSaslAuth::Query* NonSaslAuth::Query::newInstance(
const std::string& user,
40 const std::string& sid,
41 const std::string& pwd,
42 const std::string& resource )
const
44 Query* q =
new Query( user );
45 if( m_digest && !sid.empty() )
55 q->m_resource = resource;
56 q->m_digest = m_digest;
60 const std::string& NonSaslAuth::Query::filterString()
const
62 static const std::string filter =
"/iq/query[@xmlns='" +
XMLNS_AUTH +
"']";
66 Tag* NonSaslAuth::Query::tag()
const
71 Tag* t =
new Tag(
"query" );
73 new Tag( t,
"username", m_user );
75 if( !m_pwd.empty() && !m_resource.empty() )
77 new Tag( t, m_digest ?
"digest" :
"password", m_pwd );
78 new Tag( t,
"resource", m_resource );
109 const std::string&
id = m_parent->
getID();
113 m_parent->
send( iq,
this, TrackRequestAuthFields );
147 case TrackRequestAuthFields:
153 const std::string&
id = m_parent->
getID();
159 m_parent->
send( re,
this, TrackSendAuth );
164 m_parent->connected();