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();
StanzaError error() const
void removeIDHandler(IqHandler *ih)
const std::string XMLNS_AUTH
void doAuth(const std::string &sid)
An abstraction of an IQ stanza.
This class implements a basic Jabber/XMPP Client.
void removeIqHandler(IqHandler *ih, int exttype)
void registerIqHandler(IqHandler *ih, int exttype)
void addExtension(const StanzaExtension *se)
virtual const std::string & username() const
void registerStanzaExtension(StanzaExtension *ext)
A stanza error abstraction implemented as a StanzaExtension.
bool removeStanzaExtension(int ext)
void setAuthFailure(AuthenticationError e)
The namespace for the gloox library.
virtual void handleIqID(const IQ &iq, int context)
const std::string & resource() const
const std::string getID()
const Error * error() const
NonSaslAuth(Client *parent)
const std::string & server() const
void setAuthed(bool authed)
virtual const std::string & password() const
const StanzaExtension * findExtension(int type) const