gloox  1.0.28
client.cpp
1 /*
2  Copyright (c) 2004-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 #include "config.h"
14 
15 #include "client.h"
16 #include "capabilities.h"
17 #include "rostermanager.h"
18 #include "disco.h"
19 #include "error.h"
20 #include "logsink.h"
21 #include "nonsaslauth.h"
22 #include "prep.h"
23 #include "stanzaextensionfactory.h"
24 #include "stanzaextension.h"
25 #include "tag.h"
26 #include "tlsbase.h"
27 #include "util.h"
28 
29 #if !defined( _WIN32 ) && !defined( _WIN32_WCE )
30 # include <unistd.h>
31 #endif
32 
33 namespace gloox
34 {
35 
36  // ---- Client::ResourceBind ----
37  Client::ResourceBind::ResourceBind( const std::string& resource, bool bind )
38  : StanzaExtension( ExtResourceBind ), m_jid( JID() ), m_bind( bind )
39  {
40  prep::resourceprep( resource, m_resource );
41  m_valid = true;
42  }
43 
44  Client::ResourceBind::ResourceBind( const Tag* tag )
45  : StanzaExtension( ExtResourceBind ), m_resource( EmptyString ), m_bind( true )
46  {
47  if( !tag )
48  return;
49 
50  if( tag->name() == "unbind" )
51  m_bind = false;
52  else if( tag->name() == "bind" )
53  m_bind = true;
54  else
55  return;
56 
57  if( tag->hasChild( "jid" ) )
58  m_jid.setJID( tag->findChild( "jid" )->cdata() );
59  else if( tag->hasChild( "resource" ) )
60  m_resource = tag->findChild( "resource" )->cdata();
61 
62  m_valid = true;
63  }
64 
65  Client::ResourceBind::~ResourceBind()
66  {
67  }
68 
69  const std::string& Client::ResourceBind::filterString() const
70  {
71  static const std::string filter = "/iq/bind[@xmlns='" + XMLNS_STREAM_BIND + "']"
72  "|/iq/unbind[@xmlns='" + XMLNS_STREAM_BIND + "']";
73  return filter;
74  }
75 
76  Tag* Client::ResourceBind::tag() const
77  {
78  if( !m_valid )
79  return 0;
80 
81  Tag* t = new Tag( m_bind ? "bind" : "unbind" );
82  t->setXmlns( XMLNS_STREAM_BIND );
83 
84  if( m_bind && m_resource.empty() && m_jid )
85  new Tag( t, "jid", m_jid.full() );
86  else
87  new Tag( t, "resource", m_resource );
88 
89  return t;
90  }
91  // ---- ~Client::ResourceBind ----
92 
93  // ---- Client::SessionCreation ----
94  Tag* Client::SessionCreation::tag() const
95  {
96  Tag* t = new Tag( "session" );
97  t->setXmlns( XMLNS_STREAM_SESSION );
98  return t;
99  }
100  // ---- Client::SessionCreation ----
101 
102  // ---- Client ----
103  Client::Client( const std::string& server )
104  : ClientBase( XMLNS_CLIENT, server ),
105  m_rosterManager( 0 ), m_auth( 0 ),
106  m_presence( Presence::Available, JID() ),
107  m_forceNonSasl( false ), m_manageRoster( true ),
108  m_smId( EmptyString ), m_smLocation( EmptyString ), m_smResume( false ), m_smWanted( false ), m_smMax( 0 ),
109  m_streamFeatures( 0 )
110  {
112  init();
113  }
114 
115  Client::Client( const JID& jid, const std::string& password, int port )
116  : ClientBase( XMLNS_CLIENT, password, EmptyString, port ),
117  m_rosterManager( 0 ), m_auth( 0 ),
118  m_presence( Presence::Available, JID() ),
119  m_forceNonSasl( false ), m_manageRoster( true ),
120  m_smId( EmptyString ), m_smLocation( EmptyString ), m_smResume( false ), m_smWanted( false ), m_smMax( 0 ),
121  m_streamFeatures( 0 )
122  {
123  m_jid = jid;
125  init();
126  }
127 
129  {
130  delete m_rosterManager;
131  delete m_auth;
132  }
133 
134  void Client::init()
135  {
136  m_rosterManager = new RosterManager( this );
137  m_disco->setIdentity( "client", "bot" );
138  registerStanzaExtension( new ResourceBind( 0 ) );
140  m_presenceExtensions.push_back( new Capabilities( m_disco ) );
141  }
142 
143  void Client::setUsername( const std::string &username )
144  {
146  }
147 
148  bool Client::handleNormalNode( Tag* tag )
149  {
150  if( tag->name() == "features" && tag->xmlns() == XMLNS_STREAM )
151  {
152  m_streamFeatures = getStreamFeatures( tag );
153 
155  && ( !m_encryption || !( m_streamFeatures & StreamFeatureStartTls ) ) )
156  {
157  logInstance().err( LogAreaClassClient, "Client is configured to require"
158  " TLS but either the server didn't offer TLS or"
159  " TLS support is not compiled into gloox." );
161  }
163  && ( m_streamFeatures & StreamFeatureStartTls ) )
164  {
166  startTls();
167  }
169  && ( m_streamFeatures & StreamFeatureCompressZlib ) )
170  {
172  logInstance().warn( LogAreaClassClient, "The server offers compression, but negotiating Compression at this stage is not recommended. See XEP-0170 for details. We'll continue anyway." );
173  negotiateCompression( StreamFeatureCompressZlib );
174  }
175  else if( m_sasl )
176  {
177  if( m_authed )
178  {
179  if( m_streamFeatures & StreamFeatureStreamManagement && m_smWanted && m_smContext >= CtxSMEnabled )
180  {
181  sendStreamManagement();
182  }
183  else if( m_streamFeatures & StreamFeatureBind && m_smContext < CtxSMEnabled )
184  {
186  bindResource( resource() );
187  }
188  }
189  else if( !username().empty() && !password().empty() )
190  {
191  if( !login() )
192  {
193  logInstance().err( LogAreaClassClient, "The server doesn't support"
194  " any auth mechanisms we know about" );
196  }
197  }
198  else if( !m_clientCerts.empty() && !m_clientKey.empty()
199  && m_streamFeatures & SaslMechExternal && m_availableSaslMechs & SaslMechExternal )
200  {
203  }
204 #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
205  else if( m_streamFeatures & SaslMechGssapi && m_availableSaslMechs & SaslMechGssapi )
206  {
209  }
210  else if( m_streamFeatures & SaslMechNTLM && m_availableSaslMechs & SaslMechNTLM )
211  {
214  }
215 #endif
216  else if( m_streamFeatures & SaslMechAnonymous
218  {
221  }
222  else
223  {
225  connected();
226  }
227  }
229  && ( m_streamFeatures & StreamFeatureCompressZlib ) )
230  {
232  negotiateCompression( StreamFeatureCompressZlib );
233  }
234 // else if( ( m_streamFeatures & StreamFeatureCompressDclz )
235 // && m_connection->initCompression( StreamFeatureCompressDclz ) )
236 // {
237 // negotiateCompression( StreamFeatureCompressDclz );
238 // }
239  else if( m_streamFeatures & StreamFeatureIqAuth )
240  {
242  nonSaslLogin();
243  }
244  else
245  {
246  logInstance().err( LogAreaClassClient, "fallback: the server doesn't "
247  "support any auth mechanisms we know about" );
249  }
250  }
251  else
252  {
253  const std::string& name = tag->name(),
254  xmlns = tag->findAttribute( XMLNS );
255  if( name == "proceed" && xmlns == XMLNS_STREAM_TLS )
256  {
257  logInstance().dbg( LogAreaClassClient, "starting TLS handshake..." );
258 
259  if( m_encryption )
260  {
261  m_encryptionActive = true;
263  }
264  }
265  else if( name == "failure" )
266  {
267  if( xmlns == XMLNS_STREAM_TLS )
268  {
269  logInstance().err( LogAreaClassClient, "TLS handshake failed (server-side)!" );
271  }
272  else if( xmlns == XMLNS_COMPRESSION )
273  {
274  logInstance().err( LogAreaClassClient, "Stream compression init failed!" );
276  }
277  else if( xmlns == XMLNS_STREAM_SASL )
278  {
279  logInstance().err( LogAreaClassClient, "SASL authentication failed!" );
280  processSASLError( tag );
282  }
283  }
284  else if( name == "compressed" && xmlns == XMLNS_COMPRESSION )
285  {
286  logInstance().dbg( LogAreaClassClient, "Stream compression initialized" );
287  m_compressionActive = true;
288  header();
289  }
290  else if( name == "challenge" && xmlns == XMLNS_STREAM_SASL )
291  {
292  logInstance().dbg( LogAreaClassClient, "Processing SASL challenge" );
293  processSASLChallenge( tag->cdata() );
294  }
295  else if( name == "success" && xmlns == XMLNS_STREAM_SASL )
296  {
297  if( !processSASLSuccess( tag->cdata() ) )
298  {
299  logInstance().err( LogAreaClassClient, "The Server response could not be verified!" );
301  return false;
302  }
303 
304  logInstance().dbg( LogAreaClassClient, "SASL authentication successful" );
305  setAuthed( true );
306  header();
307  }
308  else if( name == "enabled" && xmlns == XMLNS_STREAM_MANAGEMENT )
309  {
311  m_smMax = atoi( tag->findAttribute( "max" ).c_str() );
312  m_smId = tag->findAttribute( "id" );
313  const std::string res = tag->findAttribute( "resume" );
314  m_smResume = ( ( res == "true" || res == "1" ) && !m_smId.empty() ) ? true : false;
315  m_smLocation = tag->findAttribute( "location" );
316 
317  if( m_streamFeatures & StreamFeatureSession )
318  createSession();
319  else
320  connected();
321  }
322  else if( name == "resumed" && xmlns == XMLNS_STREAM_MANAGEMENT && m_smContext == CtxSMResume )
323  {
324  if( tag->findAttribute( "previd" ) == m_smId )
325  {
328  int h = atoi( tag->findAttribute( "h" ).c_str() );
329  connected();
330  checkQueue( h, true );
331  }
332  }
333  else if( name == "a" && xmlns == XMLNS_STREAM_MANAGEMENT && m_smContext >= CtxSMEnabled )
334  {
335  int h = atoi( tag->findAttribute( "h" ).c_str() );
336  checkQueue( h, false );
337  }
338  else if( name == "r" && xmlns == XMLNS_STREAM_MANAGEMENT )
339  {
341  }
342  else if( name == "failed" && xmlns == XMLNS_STREAM_MANAGEMENT )
343  {
344  switch( m_smContext )
345  {
346  case CtxSMEnable:
348  break;
349  case CtxSMResume:
351  break;
352  default:
353  break;
354  }
356  }
357  else
358  return false;
359  }
360 
361  return true;
362  }
363 
364  int Client::getStreamFeatures( Tag* tag )
365  {
366  if( tag->name() != "features" || tag->xmlns() != XMLNS_STREAM )
367  return 0;
368 
369  int features = 0;
370 
371  if( tag->hasChild( "starttls", XMLNS, XMLNS_STREAM_TLS ) )
372  features |= StreamFeatureStartTls;
373 
374  if( tag->hasChild( "mechanisms", XMLNS, XMLNS_STREAM_SASL ) )
375  features |= getSaslMechs( tag->findChild( "mechanisms" ) );
376 
377  if( tag->hasChild( "bind", XMLNS, XMLNS_STREAM_BIND ) )
378  features |= StreamFeatureBind;
379 
380  if( tag->hasChild( "unbind", XMLNS, XMLNS_STREAM_BIND ) )
381  features |= StreamFeatureUnbind;
382 
383  if( tag->hasChild( "session", XMLNS, XMLNS_STREAM_SESSION ) )
384  features |= StreamFeatureSession;
385 
386  if( tag->hasChild( "auth", XMLNS, XMLNS_STREAM_IQAUTH ) )
387  features |= StreamFeatureIqAuth;
388 
389  if( tag->hasChild( "register", XMLNS, XMLNS_STREAM_IQREGISTER ) )
390  features |= StreamFeatureIqRegister;
391 
392  if( tag->hasChild( "compression", XMLNS, XMLNS_STREAM_COMPRESS ) )
393  features |= getCompressionMethods( tag->findChild( "compression" ) );
394 
395  if( tag->hasChild( "sm", XMLNS, XMLNS_STREAM_MANAGEMENT ) )
396  features |= StreamFeatureStreamManagement;
397 
398  if( tag->hasChild( "csi", XMLNS, XMLNS_CLIENT_STATE_INDICATION ) )
400 
401  if( features == 0 )
402  features = StreamFeatureIqAuth;
403 
404  return features;
405  }
406 
407  int Client::getSaslMechs( Tag* tag )
408  {
409  int mechs = SaslMechNone;
410 
411  const std::string mech = "mechanism";
412 
413  if( tag->hasChildWithCData( mech, "SCRAM-SHA-1-PLUS" ) )
414  mechs |= SaslMechScramSha1Plus;
415 
416  if( tag->hasChildWithCData( mech, "SCRAM-SHA-1" ) )
417  mechs |= SaslMechScramSha1;
418 
419  if( tag->hasChildWithCData( mech, "DIGEST-MD5" ) )
420  mechs |= SaslMechDigestMd5;
421 
422  if( tag->hasChildWithCData( mech, "PLAIN" ) )
423  mechs |= SaslMechPlain;
424 
425  if( tag->hasChildWithCData( mech, "ANONYMOUS" ) )
426  mechs |= SaslMechAnonymous;
427 
428  if( tag->hasChildWithCData( mech, "EXTERNAL" ) )
429  mechs |= SaslMechExternal;
430 
431  if( tag->hasChildWithCData( mech, "GSSAPI" ) )
432  mechs |= SaslMechGssapi;
433 
434  if( tag->hasChildWithCData( mech, "NTLM" ) )
435  mechs |= SaslMechNTLM;
436 
437  return mechs;
438  }
439 
440  int Client::getCompressionMethods( Tag* tag )
441  {
442  int meths = 0;
443 
444  if( tag->hasChildWithCData( "method", "zlib" ) )
445  meths |= StreamFeatureCompressZlib;
446 
447  if( tag->hasChildWithCData( "method", "lzw" ) )
448  meths |= StreamFeatureCompressDclz;
449 
450  return meths;
451  }
452 
454  {
455  bool retval = true;
456 
459  && !m_forceNonSasl )
460  {
463  }
464  else if( m_streamFeatures & SaslMechScramSha1 && m_availableSaslMechs & SaslMechScramSha1
465  && !m_forceNonSasl )
466  {
469  }
470  else if( m_streamFeatures & SaslMechDigestMd5 && m_availableSaslMechs & SaslMechDigestMd5
471  && !m_forceNonSasl )
472  {
475  }
476  else if( m_streamFeatures & SaslMechPlain && m_availableSaslMechs & SaslMechPlain
477  && !m_forceNonSasl )
478  {
481  }
482  else if( m_streamFeatures & StreamFeatureIqAuth || m_forceNonSasl )
483  {
485  nonSaslLogin();
486  }
487  else
488  retval = false;
489 
490  return retval;
491  }
492 
493  void Client::handleIqIDForward( const IQ& iq, int context )
494  {
495  switch( context )
496  {
497  case CtxResourceUnbind:
498  // we don't store known resources anyway
499  break;
500  case CtxResourceBind:
501  processResourceBind( iq );
502  break;
503  case CtxSessionEstablishment:
504  processCreateSession( iq );
505  break;
506  default:
507  break;
508  }
509  }
510 
511  bool Client::bindOperation( const std::string& resource, bool bind )
512  {
513  if( !( m_streamFeatures & StreamFeatureUnbind ) && m_resourceBound )
514  return false;
515 
516  IQ iq( IQ::Set, JID(), getID() );
517  iq.addExtension( new ResourceBind( resource, bind ) );
518 
519  send( iq, this, bind ? CtxResourceBind : CtxResourceUnbind );
520  return true;
521  }
522 
523  bool Client::selectResource( const std::string& resource )
524  {
525  m_selectedResource = resource; // TODO: remove for 1.1
527 
528  if( !( m_streamFeatures & StreamFeatureUnbind ) )
529  return false;
530 
531  return true;
532  }
533 
534  void Client::processResourceBind( const IQ& iq )
535  {
536  switch( iq.subtype() )
537  {
538  case IQ::Result:
539  {
540  const ResourceBind* rb = iq.findExtension<ResourceBind>( ExtResourceBind );
541  if( !rb || !rb->jid() )
542  {
544  break;
545  }
546 
547  m_jid = rb->jid();
548  m_resourceBound = true;
549  m_selectedResource = m_jid.resource(); // TODO: remove for 1.1
551 
552  if( m_streamFeatures & StreamFeatureStreamManagement && m_smWanted )
553  sendStreamManagement();
554  else if( m_streamFeatures & StreamFeatureSession )
555  createSession();
556  else
557  connected();
558  break;
559  }
560  case IQ::Error:
561  {
563  break;
564  }
565  default:
566  break;
567  }
568  }
569 
570  void Client::setStreamManagement( bool enable, bool resume )
571  {
572  m_smWanted = enable;
573  m_smResume = resume;
574 
575  if( !m_smWanted )
576  {
577  m_smId = EmptyString;
578  m_smLocation = EmptyString;
579  m_smMax = 0;
580  m_smResume = false;
581  return;
582  }
583 
584  if( m_smWanted && m_resourceBound )
585  sendStreamManagement();
586  }
587 
588  void Client::sendStreamManagement()
589  {
590  if( !m_smWanted )
591  return;
592 
593  if( m_smContext == CtxSMInvalid )
594  {
596  Tag* e = new Tag( "enable" );
598  if( m_smResume )
599  e->addAttribute( "resume", "true" );
600  send( e );
602  m_smHandled = 0;
603  }
604  else if( m_smContext == CtxSMEnabled && m_smResume )
605  {
607  Tag* r = new Tag( "resume" );
608  r->setXmlns( XMLNS_STREAM_MANAGEMENT );
609  r->addAttribute( "h", m_smHandled );
610  r->addAttribute( "previd", m_smId );
611  send( r );
613  }
614  else
615  disconnect();
616 
617  }
618 
620  {
621  if( m_smContext >= CtxSMEnabled )
622  {
623  Tag* a = new Tag( "a", "xmlns", XMLNS_STREAM_MANAGEMENT );
624  a->addAttribute( "h", m_smHandled );
625  send( a );
626  }
627  }
628 
630  {
631  if( m_smContext >= CtxSMEnabled )
632  {
633  Tag* r = new Tag( "r", "xmlns", XMLNS_STREAM_MANAGEMENT );
634  send( r );
635  }
636  }
637 
638  void Client::createSession()
639  {
641  IQ iq( IQ::Set, JID(), getID() );
642  iq.addExtension( new SessionCreation() );
643  send( iq, this, CtxSessionEstablishment );
644  }
645 
646  void Client::processCreateSession( const IQ& iq )
647  {
648  switch( iq.subtype() )
649  {
650  case IQ::Result:
651  connected();
652  break;
653  case IQ::Error:
654  notifyOnSessionCreateError( iq.error() );
655  break;
656  default:
657  break;
658  }
659  }
660 
661  void Client::negotiateCompression( StreamFeature method )
662  {
663  Tag* t = new Tag( "compress", XMLNS, XMLNS_COMPRESSION );
664 
665  if( method == StreamFeatureCompressZlib )
666  new Tag( t, "method", "zlib" );
667 
668  if( method == StreamFeatureCompressDclz )
669  new Tag( t, "method", "lzw" );
670 
671  send( t );
672  }
673 
674  void Client::setPresence( Presence::PresenceType pres, int priority,
675  const std::string& status )
676  {
677  m_presence.setPresence( pres );
678  m_presence.setPriority( priority );
679  m_presence.resetStatus();
680  m_presence.addStatus( status );
681  sendPresence( m_presence );
682  }
683 
684  void Client::setPresence( const JID& to, Presence::PresenceType pres, int priority,
685  const std::string& status )
686  {
687  Presence p( pres, to, status, priority );
688  sendPresence( p );
689  }
690 
691  void Client::sendPresence( Presence& pres )
692  {
693  if( state() < StateConnected )
694  return;
695 
696  send( pres );
697  }
698 
700  {
701  m_manageRoster = false;
702  delete m_rosterManager;
703  m_rosterManager = 0;
704  }
705 
707  {
708  if( !m_auth )
709  m_auth = new NonSaslAuth( this );
710  m_auth->doAuth( m_sid );
711  }
712 
713  void Client::connected()
714  {
715  if( m_authed && m_smContext != CtxSMResumed )
716  {
717  if( m_manageRoster )
718  {
720  m_rosterManager->fill();
721  }
722  else
723  rosterFilled();
724  }
725  else
726  {
728  notifyOnConnect();
729  }
730  }
731 
732  void Client::rosterFilled()
733  {
734  sendPresence( m_presence );
736  notifyOnConnect();
737  }
738 
740  {
742  m_smHandled = 0;
743  m_smId = EmptyString;
744  m_smLocation = EmptyString;
745  m_smMax = 0;
746  m_smResume = false;
747  m_smWanted = false;
748 
750  }
751 
752  void Client::disconnect( ConnectionError reason )
753  {
754  m_resourceBound = false;
755  m_authed = false;
756  m_streamFeatures = 0;
757  ClientBase::disconnect( reason );
758  }
759 
760  void Client::cleanup()
761  {
762  m_authed = false;
763  m_resourceBound = false;
764  m_streamFeatures = 0;
765  }
766 
767 }
This is an implementation of XEP-0115 (Entity Capabilities).
Definition: capabilities.h:37
This is the common base class for a Jabber/XMPP Client and a Jabber Component.
Definition: clientbase.h:79
const std::string getID()
SMContext m_smContext
Definition: clientbase.h:920
const std::string & server() const
Definition: clientbase.h:196
void processSASLError(Tag *tag)
Definition: clientbase.cpp:899
std::string m_sid
Definition: clientbase.h:890
std::string m_clientCerts
Definition: clientbase.h:883
void setAuthed(bool authed)
Definition: clientbase.h:777
void checkQueue(int handled, bool resend)
void processSASLChallenge(const std::string &challenge)
Definition: clientbase.cpp:707
TLSBase * m_encryption
Definition: clientbase.h:872
ConnectionState state() const
virtual const std::string & username() const
Definition: clientbase.h:138
StanzaExtensionList m_presenceExtensions
Definition: clientbase.h:877
bool processSASLSuccess(const std::string &payload)
Definition: clientbase.cpp:927
bool m_compressionActive
Definition: clientbase.h:891
std::string m_clientKey
Definition: clientbase.h:884
const JID & jid()
Definition: clientbase.h:147
void notifyOnSessionCreateError(const Error *error)
CompressionBase * m_compression
Definition: clientbase.h:873
virtual void disconnect(ConnectionError reason)
Definition: clientbase.cpp:404
std::string m_server
Definition: clientbase.h:888
GLOOX_DEPRECATED std::string m_selectedResource
Definition: clientbase.h:879
LogSink & logInstance()
Definition: clientbase.h:599
void send(Tag *tag)
TLSPolicy m_tls
Definition: clientbase.h:901
void notifyOnResourceBindError(const Error *error)
virtual const std::string & password() const
Definition: clientbase.h:227
void startSASL(SaslMechanism type)
Definition: clientbase.cpp:485
void notifyStreamEvent(StreamEvent event)
void registerStanzaExtension(StanzaExtension *ext)
void notifyOnResourceBind(const std::string &resource)
void reqStreamManagement()
Definition: client.cpp:629
virtual ~Client()
Definition: client.cpp:128
void disableRoster()
Definition: client.cpp:699
bool login()
Definition: client.cpp:453
Client(const std::string &server)
Definition: client.cpp:103
int priority() const
Definition: client.h:239
void setStreamManagement(bool enable=true, bool resume=true)
Definition: client.cpp:570
void setUsername(const std::string &username)
Definition: client.cpp:143
bool bindResource(const std::string &resource)
Definition: client.h:163
void ackStreamManagement()
Definition: client.cpp:619
void disconnect()
Definition: client.cpp:739
const std::string & resource() const
Definition: client.h:200
bool selectResource(const std::string &resource)
Definition: client.cpp:523
void setPresence()
Definition: client.h:293
void nonSaslLogin()
Definition: client.cpp:706
void setIdentity(const std::string &category, const std::string &type, const std::string &name=EmptyString)
Definition: disco.cpp:474
An abstraction of an IQ stanza.
Definition: iq.h:34
IqType subtype() const
Definition: iq.h:74
@ Set
Definition: iq.h:46
@ Error
Definition: iq.h:49
@ Result
Definition: iq.h:48
An abstraction of a JID.
Definition: jid.h:31
const std::string & serverRaw() const
Definition: jid.h:110
bool setServer(const std::string &server)
Definition: jid.cpp:56
const std::string & resource() const
Definition: jid.h:116
bool setResource(const std::string &resource)
Definition: jid.cpp:64
bool setUsername(const std::string &username)
Definition: jid.cpp:49
void warn(LogArea area, const std::string &message) const
Definition: logsink.h:75
void dbg(LogArea area, const std::string &message) const
Definition: logsink.h:66
void err(LogArea area, const std::string &message) const
Definition: logsink.h:84
This class is an implementation of XEP-0078 (Non-SASL Authentication).
Definition: nonsaslauth.h:40
void doAuth(const std::string &sid)
An abstraction of a presence stanza.
Definition: presence.h:33
void setPriority(int priority)
Definition: presence.cpp:93
void setPresence(PresenceType type)
Definition: presence.h:95
void resetStatus()
Definition: presence.cpp:86
void addStatus(const std::string &status, const std::string &lang=EmptyString)
Definition: presence.h:117
This class implements Jabber/XMPP roster handling in the jabber:iq:roster namespace.
Definition: rostermanager.h:49
void addExtension(const StanzaExtension *se)
Definition: stanza.cpp:52
const Error * error() const
Definition: stanza.cpp:47
const StanzaExtension * findExtension(int type) const
Definition: stanza.cpp:57
virtual bool hasChannelBinding() const
Definition: tlsbase.h:111
virtual bool handshake()=0
This is an abstraction of an XML element.
Definition: tag.h:47
const std::string xmlns() const
Definition: tag.cpp:543
bool addAttribute(Attribute *attr)
Definition: tag.cpp:354
const std::string cdata() const
Definition: tag.cpp:497
const std::string & findAttribute(const std::string &name) const
Definition: tag.cpp:589
const std::string & name() const
Definition: tag.h:394
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
Definition: tag.cpp:522
The namespace for the gloox library.
Definition: adhoc.cpp:28
const std::string XMLNS_STREAM
Definition: gloox.cpp:84
const std::string XMLNS_STREAM_COMPRESS
Definition: gloox.cpp:95
StreamFeature
Definition: gloox.h:734
@ StreamFeatureCompressDclz
Definition: gloox.h:745
@ StreamFeatureStartTls
Definition: gloox.h:738
@ StreamFeatureStreamManagement
Definition: gloox.h:747
@ StreamFeatureCompressZlib
Definition: gloox.h:743
@ StreamFeatureIqRegister
Definition: gloox.h:739
@ StreamFeatureSession
Definition: gloox.h:737
@ StreamFeatureClientStateIndication
Definition: gloox.h:748
@ StreamFeatureIqAuth
Definition: gloox.h:741
@ StreamFeatureBind
Definition: gloox.h:735
@ StreamFeatureUnbind
Definition: gloox.h:736
const std::string XMLNS_STREAM_BIND
Definition: gloox.cpp:90
ConnectionError
Definition: gloox.h:684
@ ConnUserDisconnected
Definition: gloox.h:714
@ ConnAuthenticationFailed
Definition: gloox.h:712
@ ConnNoSupportedAuth
Definition: gloox.h:703
@ ConnTlsFailed
Definition: gloox.h:705
@ ConnCompressionFailed
Definition: gloox.h:710
@ ConnTlsNotAvailable
Definition: gloox.h:707
@ LogAreaClassClient
Definition: gloox.h:1056
const std::string XMLNS_STREAM_IQREGISTER
Definition: gloox.cpp:93
const std::string XMLNS_CLIENT
Definition: gloox.cpp:19
@ StreamEventSMResumed
Definition: gloox.h:665
@ StreamEventResourceBinding
Definition: gloox.h:659
@ StreamEventEncryption
Definition: gloox.h:655
@ StreamEventCompression
Definition: gloox.h:656
@ StreamEventSMResume
Definition: gloox.h:662
@ StreamEventAuthentication
Definition: gloox.h:657
@ StreamEventRoster
Definition: gloox.h:676
@ StreamEventSMResumeFailed
Definition: gloox.h:671
@ StreamEventSMEnable
Definition: gloox.h:660
@ StreamEventFinished
Definition: gloox.h:677
@ StreamEventSMEnableFailed
Definition: gloox.h:668
@ StreamEventSessionCreation
Definition: gloox.h:674
const std::string XMLNS_STREAM_SASL
Definition: gloox.cpp:89
@ TLSRequired
Definition: gloox.h:725
@ TLSDisabled
Definition: gloox.h:723
const std::string XMLNS_STREAM_SESSION
Definition: gloox.cpp:91
const std::string EmptyString
Definition: gloox.cpp:124
const std::string XMLNS_STREAM_IQAUTH
Definition: gloox.cpp:92
const std::string XMLNS
Definition: gloox.cpp:122
const std::string XMLNS_CLIENT_STATE_INDICATION
Definition: gloox.cpp:115
const std::string XMLNS_COMPRESSION
Definition: gloox.cpp:27
@ ExtResourceBind
@ SaslMechScramSha1Plus
Definition: gloox.h:760
@ SaslMechNTLM
Definition: gloox.h:767
@ SaslMechDigestMd5
Definition: gloox.h:761
@ SaslMechExternal
Definition: gloox.h:765
@ SaslMechGssapi
Definition: gloox.h:766
@ SaslMechScramSha1
Definition: gloox.h:759
@ SaslMechNone
Definition: gloox.h:758
@ SaslMechAnonymous
Definition: gloox.h:763
@ SaslMechPlain
Definition: gloox.h:762
@ StateConnected
Definition: gloox.h:644
const std::string XMLNS_STREAM_TLS
Definition: gloox.cpp:87
const std::string XMLNS_STREAM_MANAGEMENT
Definition: gloox.cpp:109