#include <client.h>
Inherits ClientBase.
Inheritance diagram for Client:


Public Member Functions | |
| Client (const std::string &server) | |
| Client (const JID &jid, const std::string &password, int port=-1) | |
| Client (const std::string &username, const std::string &password, const std::string &server, const std::string &resource, int port=-1) | |
| virtual | ~Client () |
| void | bindResource () |
| const std::string & | resource () const |
| int | priority () const |
| void | setUsername (const std::string &username) |
| void | setResource (const std::string &resource) |
| void | setPresence (Presence presence, int priority=0, const std::string &msg="") |
| Presence | presence () const |
| const std::string & | status () const |
| void | addPresenceExtension (StanzaExtension *se) |
| void | removePresenceExtensions () |
| GLOOX_DEPRECATED void | setForceNonSasl (bool force=true) |
| void | disableRoster () |
| RosterManager * | rosterManager () |
| void | disconnect () |
| bool | login () |
Protected Member Functions | |
| void | nonSaslLogin () |
It supports SASL Authentication as well as TLS (Encryption), which can be switched on/off separately. They are used automatically if the server supports them.
To use, create a new Client instance and feed it connection credentials, either in the Constructor or afterwards using the setters. You should then register packet handlers implementing the corresponding Interfaces (ConnectionListener, PresenceHandler, MessageHandler, IqHandler, SubscriptionHandler), and call connect() to establish the connection to the server.
using namespace gloox; void TestProg::doIt() { Client* j = new Client( "user@server/resource", "password" ); j->registerPresenceHandler( this ); j->disco()->setVersion( "TestProg", "1.0" ); j->disco()->setIdentity( "client", "bot" ); j->connect(); } virtual void TestProg::presenceHandler( Stanza *stanza ) { // handle incoming presence packets here }
However, you can skip the presence handling stuff if you make use of the RosterManager.
By default, the library handles a few (incoming) IQ namespaces on the application's behalf. These include:
As of gloox 0.9, initial presence is automatically sent. Presence: available, Priority: 0. To disable sending of initial Presence use setPresence() with a value of PresenceUnavailable prior to connecting.
Definition at line 97 of file client.h.
|
|
Constructs a new Client which can be used for account registration only. SASL and TLS are on by default. The port will be determined by looking up SRV records. Alternatively, you can set the port explicitly by calling setPort().
Definition at line 45 of file client.cpp. |
|
||||||||||||||||
|
Constructs a new Client. SASL and TLS are on by default. This should be the default constructor for most use cases. The server address will be taken from the JID. The actual host will be resolved using SRV records. The domain part of the JID is used as a fallback in case no SRV record is found, or you can set the server address separately by calling setServer().
Definition at line 56 of file client.cpp. |
|
||||||||||||||||||||||||
|
Constructs a new Client. SASL and TLS are on by default. The actual host will be resolved using SRV records. The server value is used as a fallback in case no SRV record is found.
Definition at line 68 of file client.cpp. |
|
|
Virtual destructor. Definition at line 83 of file client.cpp. |
|
|
Use this function to add a StanzaExtension which will be sent with eacha nd every Presence Stanza that is sent out. Use cases include signed presence (GPGSigned , XEP-0027), VCard avatar notifications (VCardUpdate , XEP-0153), and others (see StanzaExtension for derived classes.
Definition at line 481 of file client.cpp. |
|
|
Use this function to re-try to bind a resource only in case you were notified about an error by means of ConnectionListener::onResourceBindError(). You may (or should) use setResource() before. Definition at line 360 of file client.cpp. |
|
|
Disables the automatic roster management. You have to keep track of incoming presence yourself if you want to have a roster. Definition at line 511 of file client.cpp. |
|
|
Disconnects from the server. Definition at line 578 of file client.cpp. |
|
|
Initiates a login attempt (currently SASL External not supported). This is useful after registering a new account. Simply use setUsername() and setPassword, and call login().
Definition at line 335 of file client.cpp. |
|
|
Initiates non-SASL login. Definition at line 518 of file client.cpp. |
|
|
Returns the current presence.
|
|
|
Returns the current priority.
|
|
|
Use this function to remove all extensions added using addPresenceExtension(). Definition at line 486 of file client.cpp. |
|
|
Returns the current prepped resource.
|
|
|
This function gives access to the
|
|
|
This is a temporary hack to enforce Non-SASL login. You should not need to use it.
|
|
||||||||||||||||
|
Use this function to set the entity's presence. If used prior to establishing a connection, the set values will be sent with the initial presence stanza. If used while a connection already is established a repective presence stanza will be sent out immediately.
Definition at line 496 of file client.cpp. |
|
|
Sets the resource to use to connect to the XMPP server.
|
|
|
Sets the username to use to connect to the XMPP server.
Definition at line 96 of file client.cpp. |
|
|
Returns the current status message.
|
1.4.1