#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) | |
| virtual | ~Client () |
| bool | bindResource (const std::string &resource) |
| bool | selectResource (const std::string &resource) |
| bool | hasResourceBind () const |
| bool | unbindResource (const std::string &resource) |
| const std::string & | resource () const |
| int | priority () const |
| void | setUsername (const std::string &username) |
| void | setResource (const std::string &resource) |
| void | setPresence (const JID &to, Presence::PresenceType pres, int priority, const std::string &status=EmptyString) |
| void | setPresence (Presence::PresenceType pres, int priority, const std::string &status=EmptyString) |
| void | setPresence () |
| Presence & | presence () |
| GLOOX_DEPRECATED void | setForceNonSasl (bool force=true) |
| void | disableRoster () |
| RosterManager * | rosterManager () |
| void | disconnect () |
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( Presence* presence ) { // 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 Unavailable prior to connecting.
Definition at line 98 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 116 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 127 of file client.cpp. |
|
|
Virtual destructor. Definition at line 139 of file client.cpp. |
|
|
Use this function to bind an additional resource or to re-try to bind a resource in case previous binding failed and you were notified by means of ConnectionListener::onResourceBindError(). Use hasResourceBind() to find out if the server supports binding of multiple resources. bindResource() is a NOOP if it doesn't.
|
|
|
Disables the automatic roster management. You have to keep track of incoming presence yourself if you want to have a roster. Definition at line 526 of file client.cpp. |
|
|
Disconnects from the server. Definition at line 566 of file client.cpp. |
|
|
This function can be used to find out whether the server supports binding of multiple resources.
|
|
|
Initiates non-SASL login. Definition at line 533 of file client.cpp. |
|
|
Returns the current presence.
|
|
|
Returns the current priority.
|
|
|
Returns the current prepped main resource.
|
|
|
This function gives access to the
|
|
|
Use this function to select a resource identifier that has been bound previously by means of bindResource(). It is not necessary to call this function if only one resource is bound. Use hasResourceBind() to find out if the server supports binding of multiple resources. selectResource() is a NOOP if it doesn't.
Definition at line 425 of file client.cpp. |
|
|
This is a temporary hack to enforce Non-SASL login. You should not need to use it.
|
|
|
Use this function to broadcast the entity's presence to all subscribed entities. This is a NOOP if there's no active connection. To send directed presence, use setPresence( const JID&, Presence::PresenceType, int, const std::string& ). If used while a connection already is established a repective presence stanza will be sent out immediately. Use presence() to modify the Presence object.
|
|
||||||||||||||||
|
Use this function to set the entity's presence, that is, to broadcast presence to all subscribed entities. To send directed presence, use setPresence( const JID&, Presence::PresenceType, int, const std::string& ). 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 presence stanza will be sent out immediately.
Definition at line 504 of file client.cpp. |
|
||||||||||||||||||||
|
Sends directed presence to the given JID. This is a NOOP if there's no active connection. To broadcast presence use setPresence( Presence::PresenceType, int, const std::string& ).
Definition at line 513 of file client.cpp. |
|
|
Sets the main resource to use to connect to the XMPP server.
|
|
|
Sets the username to use to connect to the XMPP server.
Definition at line 154 of file client.cpp. |
|
|
Use this function to unbind a resource identifier that has been bound previously by means of bindResource(). Use hasResourceBind() to find out if the server supports binding of multiple resources. unbindResource() is a NOOP if it doesn't.
|
1.4.1