gloox  1.0.28
nonsaslauth.h
1 /*
2  Copyright (c) 2005-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef NONSASLAUTH_H__
15 #define NONSASLAUTH_H__
16 
17 #include "iqhandler.h"
18 
19 #include <string>
20 
21 namespace gloox
22 {
23 
24  class Client;
25  class Stanza;
26  class Tag;
27 
39  class GLOOX_API NonSaslAuth : public IqHandler
40  {
41  public:
46  NonSaslAuth( Client* parent );
47 
51  virtual ~NonSaslAuth();
52 
58  void doAuth( const std::string& sid );
59 
60  // reimplemented from IqHandler
61  virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
62 
63  // reimplemented from IqHandler
64  virtual void handleIqID( const IQ& iq, int context );
65 
66  private:
67 #ifdef NONSASLAUTH_TEST
68  public:
69 #endif
76  class Query : public StanzaExtension
77  {
78  public:
84  Query( const std::string& user );
85 
90  Query( const Tag* tag = 0 );
91 
100  Query* newInstance( const std::string& user, const std::string& sid,
101  const std::string& pwd, const std::string& resource ) const;
102 
106  virtual ~Query() {}
107 
108  // reimplemented from StanzaExtension
109  virtual const std::string& filterString() const;
110 
111  // reimplemented from StanzaExtension
112  virtual StanzaExtension* newInstance( const Tag* tag ) const
113  {
114  return new Query( tag );
115  }
116 
117  // reimplemented from StanzaExtension
118  virtual Tag* tag() const;
119 
120  // reimplemented from StanzaExtension
121  virtual StanzaExtension* clone() const
122  {
123  return new Query( *this );
124  }
125 
126  private:
127  std::string m_user;
128  std::string m_pwd;
129  std::string m_resource;
130  bool m_digest;
131 
132  };
133 
134  enum NonSaslAuthTrack
135  {
136  TrackRequestAuthFields,
137  TrackSendAuth
138  };
139 
140  Client* m_parent;
141  std::string m_sid;
142 
143  };
144 
145 }
146 
147 #endif // NONSASLAUTH_H__
This class implements a basic Jabber/XMPP Client.
Definition: client.h:117
An abstraction of an IQ stanza.
Definition: iq.h:34
A virtual interface which can be reimplemented to receive IQ stanzas.
Definition: iqhandler.h:32
This class is an implementation of XEP-0078 (Non-SASL Authentication).
Definition: nonsaslauth.h:40
virtual bool handleIq(const IQ &iq)
Definition: nonsaslauth.h:61
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
This is an abstraction of an XML element.
Definition: tag.h:47
The namespace for the gloox library.
Definition: adhoc.cpp:28