#include <clientbase.h>
Inherited by Client, and Component.
Inheritance diagram for ClientBase:
Public Member Functions | |
ClientBase (const std::string &ns, const std::string &server, int port=-1) | |
ClientBase (const std::string &ns, const std::string &password, const std::string &server, int port=-1) | |
virtual | ~ClientBase () |
bool | connect (bool block=true) |
ConnectionError | recv (int timeout=-1) |
void | disconnect () |
virtual const std::string | username () const =0 |
JID & | jid () |
void | setSasl (bool sasl) |
void | setTls (bool tls) |
void | setPort (int port) |
void | setServer (const std::string &server) |
void | setPassword (const std::string &password) |
const std::string | server () const |
bool | sasl () const |
bool | tls () const |
int | port () const |
virtual const std::string | password () const |
const std::string | getID () |
virtual void | send (Tag *tag) |
bool | authed () const |
ConnectionState | state () const |
const std::string & | xmlLang () const |
void | setXmlLang (const std::string &xmllang) |
int | fileDescriptor () const |
void | registerConnectionListener (ConnectionListener *cl) |
void | registerIqHandler (IqHandler *ih, const std::string &xmlns) |
void | trackID (IqHandler *ih, const std::string &id, int context) |
void | registerMessageHandler (MessageHandler *mh) |
void | registerPresenceHandler (PresenceHandler *ph) |
void | registerSubscriptionHandler (SubscriptionHandler *sh) |
void | registerLogHandler (LogHandler *lh) |
void | registerTagHandler (TagHandler *th, const std::string &tag, const std::string &xmlns) |
void | removeConnectionListener (ConnectionListener *cl) |
void | removeIqHandler (const std::string &xmlns) |
void | removeMessageHandler (MessageHandler *mh) |
void | removePresenceHandler (PresenceHandler *ph) |
void | removeSubscriptionHandler (SubscriptionHandler *sh) |
void | removeTagHandler (TagHandler *th, const std::string &tag, const std::string &xmlns) |
void | removeLogHandler (LogHandler *lh) |
void | setCACerts (const StringList &cacerts) |
StreamError | streamError () const |
const std::string | streamErrorText (const std::string &lang="default") const |
const std::string | streamErrorCData () const |
const Tag * | streamErrorAppCondition () const |
AuthenticationError | authError () const |
Protected Types | |
enum | SaslMechanisms { SASL_DIGEST_MD5, SASL_PLAIN, SASL_ANONYMOUS } |
Protected Member Functions | |
void | notifyOnResourceBindError (ConnectionListener::ResourceBindError error) |
void | notifyOnSessionCreateError (ConnectionListener::SessionCreateError error) |
bool | notifyOnTLSConnect (const CertInfo &info) |
void | log (const std::string &xml, bool incoming) |
void | notifyOnConnect () |
void | disconnect (ConnectionError reason) |
void | header () |
void | setAuthed (bool authed) |
void | setAuthFailure (AuthenticationError e) |
virtual bool | checkStreamVersion (const std::string &version) |
void | startSASL (SaslMechanisms type) |
void | processSASLChallenge (const std::string &challenge) |
void | processSASLError (Stanza *stanza) |
void | startTls () |
bool | hasTls () |
Protected Attributes | |
JID | m_jid |
Connection * | m_connection |
std::string | m_namespace |
std::string | m_password |
std::string | m_xmllang |
std::string | m_server |
std::string | m_sid |
bool | m_authed |
bool | m_sasl |
bool | m_tls |
int | m_port |
Friends | |
class | Parser |
It manages connection establishing, authentication, filter registrationa and invocation.
Definition at line 50 of file clientbase.h.
|
Definition at line 385 of file clientbase.h. |
|
Constructs a new ClientBase. You should not need to use this class directly. Use Client or Component instead.
Definition at line 37 of file clientbase.cpp. |
|
Constructs a new ClientBase. You should not need to use this class directly. Use Client or Component instead.
Definition at line 45 of file clientbase.cpp. |
|
Virtual destrcuctor. Definition at line 54 of file clientbase.cpp. References ClientBase::m_connection. |
|
Returns whether authentication has taken place and was successful.
Definition at line 204 of file clientbase.h. Referenced by Registration::changePassword(), and Registration::removeAccount(). |
|
Use this function to retrieve the type of the authentication error after it occurs and you received a ConnectionError of type CONN_AUTHENTICATION_FAILED from the ConnectionListener.
Definition at line 382 of file clientbase.h. |
|
Initiates the connection to a server. This function blocks as long as a connection is established. You can have the connection block 'til the end of the connection, or you can have it return immediately. If you choose the latter, its your responsibility to call recv() every now and then to actually receive data from the socket and to feed the parser.
Definition at line 68 of file clientbase.cpp. References Connection::connect(), ClientBase::header(), ClientBase::m_connection, ClientBase::m_port, ClientBase::m_server, ClientBase::Parser, Connection::receive(), Connection::setCACerts(), and gloox::STATE_CONNECTED. |
|
Disconnects from the server. Definition at line 159 of file clientbase.cpp. References gloox::CONN_USER_DISCONNECTED. Referenced by NonSaslAuth::handleIqID(). |
|
Gives access to the raw file descriptor of the current connection. Use it wisely. Especially, you should not recv() any data from it. There is no way to feed that back into the parser. You can use select() on it and use Connection::recv( -1 ) to fetch the data.
Definition at line 515 of file clientbase.cpp. References Connection::fileDescriptor(), and ClientBase::m_connection. |
|
Creates a string which is unique in the current instance and can be used as an ID for queries.
Definition at line 388 of file clientbase.cpp. Referenced by RosterManager::add(), Registration::changePassword(), Registration::createAccount(), NonSaslAuth::doAuth(), FlexibleOffline::fetchMessages(), Registration::fetchRegistrationFields(), RosterManager::fill(), Disco::getDiscoInfo(), Disco::getDiscoItems(), LastActivity::query(), Registration::removeAccount(), PrivacyManager::removeList(), FlexibleOffline::removeMessages(), PrivacyManager::requestList(), PrivacyManager::requestListNames(), PrivateXML::requestXML(), PrivacyManager::setActive(), PrivacyManager::setDefault(), ClientBase::startSASL(), PrivacyManager::store(), PrivateXML::storeXML(), RosterManager::synchronize(), PrivacyManager::unsetActive(), PrivacyManager::unsetDefault(), and RosterManager::unsubscribe(). |
|
Returns the current jabber id.
Definition at line 121 of file clientbase.h. Referenced by RosterManager::ackSubscriptionRequest(), FlexibleOffline::checkSupport(), Client::Client(), NonSaslAuth::doAuth(), FlexibleOffline::fetchHeaders(), Disco::getDiscoInfo(), Disco::getDiscoItems(), FlexibleOffline::getMsgCount(), Disco::handleIq(), Registration::removeAccount(), RosterManager::RosterManager(), RosterManager::subscribe(), and RosterManager::unsubscribe(). |
|
Returns the current password.
Reimplemented in Component. Definition at line 185 of file clientbase.h. |
|
Returns the port. The default of -1 means that the actual port will be looked up using SRV records, or the XMPP default port of 5222 will be used.
Definition at line 179 of file clientbase.h. |
|
Use this periodically to receive data from the socket and to feed the parser. You need to use this only if you chose to connect in non-blocking mode.
Definition at line 60 of file clientbase.cpp. References gloox::CONN_OK, ClientBase::m_connection, and Connection::recv(). |
|
Registers
Definition at line 604 of file clientbase.cpp. |
|
Registers
Definition at line 545 of file clientbase.cpp. Referenced by Adhoc::Adhoc(), Disco::Disco(), NonSaslAuth::NonSaslAuth(), PrivacyManager::PrivacyManager(), PrivateXML::PrivateXML(), Registration::Registration(), and RosterManager::RosterManager(). |
|
Registers
Definition at line 535 of file clientbase.cpp. |
|
Registers
Definition at line 568 of file clientbase.cpp. |
|
Registers
Definition at line 523 of file clientbase.cpp. Referenced by RosterManager::RosterManager(). |
|
Registers
Definition at line 580 of file clientbase.cpp. Referenced by RosterManager::RosterManager(). |
|
Registers
Definition at line 586 of file clientbase.cpp. |
|
Removes the given object from the list of connection listeners.
Definition at line 610 of file clientbase.cpp. |
|
Removes the handler for the given namespace from the list of Iq handlers.
Definition at line 562 of file clientbase.cpp. Referenced by Adhoc::~Adhoc(), Disco::~Disco(), NonSaslAuth::~NonSaslAuth(), PrivacyManager::~PrivacyManager(), PrivateXML::~PrivateXML(), Registration::~Registration(), and RosterManager::~RosterManager(). |
|
Removes the given object from the list of log handlers.
Definition at line 540 of file clientbase.cpp. |
|
Removes the given object from the list of message handlers.
Definition at line 574 of file clientbase.cpp. |
|
Removes the given object from the list of presence handlers.
Definition at line 529 of file clientbase.cpp. Referenced by RosterManager::~RosterManager(). |
|
Removes the given object from the list of subscription handlers.
Definition at line 598 of file clientbase.cpp. Referenced by RosterManager::~RosterManager(). |
|
Removes the given object from the list of tag handlers for the given element and namespace.
Definition at line 616 of file clientbase.cpp. |
|
Returns the current SASL status.
Definition at line 166 of file clientbase.h. |
|
|
Returns the current prepped server.
Definition at line 160 of file clientbase.h. Referenced by Registration::changePassword(). |
|
Use this function to set a number of trusted root CA certificates. which shall be used to verify a servers certificate.
Definition at line 343 of file clientbase.h. |
|
Sets the password to use to connect to the XMPP server.
Definition at line 154 of file clientbase.h. |
|
Sets the port to connect to. This is not necessary if either the default port (5222) is used or SRV records exist which will be resolved.
Definition at line 140 of file clientbase.h. |
|
Switches usage of SASL on/off. Default: on
Definition at line 127 of file clientbase.h. |
|
Sets the XMPP server to connect to.
Definition at line 148 of file clientbase.h. |
|
Switches usage of TLS on/off (if available). Default: on
Definition at line 133 of file clientbase.h. |
|
Sets the value for the xml:lang attribute of the initial stream.
Definition at line 224 of file clientbase.h. |
|
Returns the current connection status.
Definition at line 381 of file clientbase.cpp. References ClientBase::m_connection, Connection::state(), and gloox::STATE_DISCONNECTED. Referenced by Registration::fetchRegistrationFields(). |
|
Use this function to retrieve the type of the stream error after it occurs and you received a ConnectionError of type CONN_STREAM_ERROR from the ConnectionListener. Definition at line 349 of file clientbase.h. |
|
This function can be used to retrieve the application-specific error condition of a stream error.
Definition at line 375 of file clientbase.h. |
|
In case the defined-condition element of an stream error contains XML character data you can use this function to retrieve it. RFC 3920 only defines one condition (see-other-host)where this is possible.
Definition at line 368 of file clientbase.h. |
|
Returns the text of a stream error for the given language if available. If the requested language is not available, the default text (without a xml:lang attribute) will be returned.
Definition at line 488 of file clientbase.cpp. |
|
Returns the current TLS status.
Definition at line 172 of file clientbase.h. |
|
Use this function to be notified of incoming IQ stanzas with the given value of the id attribute. Since IDs are supposed to be unique, this notification works only once.
Definition at line 551 of file clientbase.cpp. Referenced by Registration::changePassword(), Registration::createAccount(), NonSaslAuth::doAuth(), Registration::fetchRegistrationFields(), Disco::getDiscoInfo(), Disco::getDiscoItems(), LastActivity::query(), Registration::removeAccount(), PrivacyManager::removeList(), PrivacyManager::requestList(), PrivacyManager::requestListNames(), PrivateXML::requestXML(), PrivacyManager::setActive(), PrivacyManager::setDefault(), PrivateXML::storeXML(), PrivacyManager::unsetActive(), and PrivacyManager::unsetDefault(). |
|
Reimplement this function to provide a username for connection purposes.
Implemented in Client, and Component. Referenced by Registration::changePassword(). |
|
Retrieves the value of the xml:lang attribute of the initial stream. Default is 'en', i.e. if not changed by a call to setXmlLang(). Definition at line 216 of file clientbase.h. |