QXmpp Version: 1.10.0
|
The QXmppConfiguration class holds configuration options. More...
#include <QXmppConfiguration.h>
Public Types | |
enum | StreamSecurityMode { TLSEnabled = 0 , TLSDisabled , TLSRequired , LegacySSL } |
enum | NonSASLAuthMechanism { NonSASLPlain = 0 , NonSASLDigest } |
Public Member Functions | |
QXmppConfiguration () | |
Creates a QXmppConfiguration object. | |
QXmppConfiguration (const QXmppConfiguration &other) | |
Creates a copy of other. | |
QXmppConfiguration & | operator= (const QXmppConfiguration &other) |
Assigns other to this QXmppConfiguration. | |
QString | host () const |
Returns the custom hostname to connect to. | |
void | setHost (const QString &) |
QString | domain () const |
Returns the domain part of the JID. | |
void | setDomain (const QString &) |
int | port () const |
Returns the port number. | |
quint16 | port16 () const |
void | setPort (int) |
QString | user () const |
Returns the localpart of the JID. | |
void | setUser (const QString &) |
QString | password () const |
Returns the password. | |
void | setPassword (const QString &) |
QString | resource () const |
Returns the resource identifier. | |
void | setResource (const QString &) |
QString | resourcePrefix () const |
void | setResourcePrefix (const QString &) |
QString | jid () const |
void | setJid (const QString &jid) |
QString | jidBare () const |
QXmppCredentials | credentials () const |
void | setCredentials (const QXmppCredentials &) |
QString | facebookAccessToken () const |
Returns the access token used for X-FACEBOOK-PLATFORM authentication. | |
void | setFacebookAccessToken (const QString &) |
QString | facebookAppId () const |
Returns the application ID used for X-FACEBOOK-PLATFORM authentication. | |
void | setFacebookAppId (const QString &) |
Sets the application ID used for X-FACEBOOK-PLATFORM authentication. | |
QString | googleAccessToken () const |
Returns the access token used for X-OAUTH2 authentication. | |
void | setGoogleAccessToken (const QString &accessToken) |
QString | windowsLiveAccessToken () const |
Returns the access token used for X-MESSENGER-OAUTH2 authentication. | |
void | setWindowsLiveAccessToken (const QString &accessToken) |
bool | autoAcceptSubscriptions () const |
void | setAutoAcceptSubscriptions (bool) |
bool | autoReconnectionEnabled () const |
void | setAutoReconnectionEnabled (bool) |
bool | useSasl2Authentication () const |
void | setUseSasl2Authentication (bool) |
bool | useFastTokenAuthentication () const |
void | setUseFastTokenAuthentication (bool) |
bool | useSASLAuthentication () const |
Returns whether to make use of SASL authentication. | |
void | setUseSASLAuthentication (bool) |
Sets whether to make use of SASL authentication. | |
bool | useNonSASLAuthentication () const |
Returns whether to make use of non-SASL authentication. | |
void | setUseNonSASLAuthentication (bool) |
Sets whether to make use of non-SASL authentication. | |
bool | ignoreSslErrors () const |
void | setIgnoreSslErrors (bool) |
QXmppConfiguration::StreamSecurityMode | streamSecurityMode () const |
void | setStreamSecurityMode (QXmppConfiguration::StreamSecurityMode mode) |
QXmppConfiguration::NonSASLAuthMechanism | nonSASLAuthMechanism () const |
Returns the Non-SASL authentication mechanism configuration. | |
void | setNonSASLAuthMechanism (QXmppConfiguration::NonSASLAuthMechanism) |
Hints the library the Non-SASL authentication mechanism to be used for authentication. | |
QString | saslAuthMechanism () const |
Returns the preferred SASL authentication mechanism. | |
void | setSaslAuthMechanism (const QString &mechanism) |
QList< QString > | disabledSaslMechanisms () const |
void | addDisabledSaslMechanism (const QString &) |
void | setDisabledSaslMechanisms (const QList< QString > &) |
std::optional< QXmppSasl2UserAgent > | sasl2UserAgent () const |
void | setSasl2UserAgent (const std::optional< QXmppSasl2UserAgent > &) |
QNetworkProxy | networkProxy () const |
void | setNetworkProxy (const QNetworkProxy &proxy) |
int | keepAliveInterval () const |
void | setKeepAliveInterval (int secs) |
int | keepAliveTimeout () const |
void | setKeepAliveTimeout (int secs) |
QList< QSslCertificate > | caCertificates () const |
Returns the a list of trusted CA certificates. | |
void | setCaCertificates (const QList< QSslCertificate > &) |
Specifies a list of trusted CA certificates. | |
The QXmppConfiguration class holds configuration options.
It can be passed to QXmppClient to specify the options when connecting to an XMPP server.
It is a container of all the settings, configuration required for connecting to an XMPP server. E.g. server name, username, port, type of authentication mechanism, type of security used by stream (encryption), etc..
An enumeration for type of the Security Mode that is stream is encrypted or not. The server may or may not have TLS feature. Server may force the encryption. Depending upon all this user can specify following options.
void QXmppConfiguration::addDisabledSaslMechanism | ( | const QString & | m | ) |
Adds to the list of disabled SASL mechanisms.
Those mechanisms are not used by the client, even if no other mechanism is available.
bool QXmppConfiguration::autoAcceptSubscriptions | ( | ) | const |
Returns the auto-accept-subscriptions-request configuration.
bool QXmppConfiguration::autoReconnectionEnabled | ( | ) | const |
Returns the auto-reconnect-on-disconnection-on-error configuration.
QXmppCredentials QXmppConfiguration::credentials | ( | ) | const |
Returns the credentials of this configuration.
QList< QString > QXmppConfiguration::disabledSaslMechanisms | ( | ) | const |
Returns the list of disabled SASL mechanisms.
Those mechanisms are not used by the client, even if no other mechanism is available.
bool QXmppConfiguration::ignoreSslErrors | ( | ) | const |
Returns whether SSL errors (such as certificate validation errors) are to be ignored when connecting to the XMPP server.
QString QXmppConfiguration::jid | ( | ) | const |
Returns the Jabber-ID (JID).
QString QXmppConfiguration::jidBare | ( | ) | const |
Returns the bare jabber id (jid), without the resource identifier.
int QXmppConfiguration::keepAliveInterval | ( | ) | const |
Returns the keep alive interval in seconds.
The default value is 60 seconds.
int QXmppConfiguration::keepAliveTimeout | ( | ) | const |
Returns the keep alive timeout in seconds.
The default value is 20 seconds.
QNetworkProxy QXmppConfiguration::networkProxy | ( | ) | const |
Returns the specified network proxy. The default value is QNetworkProxy::DefaultProxy that is the proxy is determined based on the application proxy set using QNetworkProxy::setApplicationProxy().
quint16 QXmppConfiguration::port16 | ( | ) | const |
Returns the port number as quint16.
QString QXmppConfiguration::resourcePrefix | ( | ) | const |
Returns the resource prefix ('tag' for this client) used when XEP-0386: Bind 2 is available.
std::optional< QXmppSasl2UserAgent > QXmppConfiguration::sasl2UserAgent | ( | ) | const |
Returns the user-agent used for XEP-0388: Extensible SASL Profile.
If this is empty, no user-agent will be sent.
void QXmppConfiguration::setAutoAcceptSubscriptions | ( | bool | value | ) |
Sets the auto-accept-subscriptions-request configuration.
value | boolean value true means that auto-accept-subscriptions-request is enabled else disabled for false |
void QXmppConfiguration::setAutoReconnectionEnabled | ( | bool | value | ) |
Sets the auto-reconnect-on-disconnection-on-error configuration.
value | boolean value true means that auto-reconnect is enabled else disabled for false |
void QXmppConfiguration::setCredentials | ( | const QXmppCredentials & | credentials | ) |
Sets the credentials for this configuration.
void QXmppConfiguration::setDisabledSaslMechanisms | ( | const QList< QString > & | disabled | ) |
Sets the list of disabled SASL mechanisms.
Those mechanisms are not used by the client, even if no other mechanism is available.
void QXmppConfiguration::setDomain | ( | const QString & | domain | ) |
Sets the domain name.
domain | Domain name e.g. "gmail.com" and "jabber.org". |
void QXmppConfiguration::setFacebookAccessToken | ( | const QString & | accessToken | ) |
Sets the access token used for X-FACEBOOK-PLATFORM authentication.
This token is returned by Facebook at the end of the OAuth authentication process.
void QXmppConfiguration::setGoogleAccessToken | ( | const QString & | accessToken | ) |
Sets the access token used for X-OAUTH2 authentication.
This token is returned by Google at the end of the OAuth authentication process.
void QXmppConfiguration::setHost | ( | const QString & | host | ) |
Sets the host name.
host | host name of the XMPP server where connection has to be made (e.g. "jabber.org" and "talk.google.com"). It can also be an IP address in the form of a string (e.g. "192.168.1.25"). |
void QXmppConfiguration::setIgnoreSslErrors | ( | bool | value | ) |
Specifies whether SSL errors (such as certificate validation errors) are to be ignored when connecting to an XMPP server.
void QXmppConfiguration::setJid | ( | const QString & | jid | ) |
Sets the JID. If a full JID (i.e. one with a resource) is given, calling this method will update the username, domain and resource. Otherwise, only the username and the domain will be updated.
void QXmppConfiguration::setKeepAliveInterval | ( | int | secs | ) |
Specifies the interval in seconds at which keep alive (ping) packets will be sent to the server.
If set to zero, no keep alive packets will be sent.
The default value is 60 seconds.
void QXmppConfiguration::setKeepAliveTimeout | ( | int | secs | ) |
Specifies the maximum time in seconds to wait for a keep alive response from the server before considering we are disconnected.
If set to zero or a value larger than the keep alive interval, no timeout will occur.
The default value is 20 seconds.
void QXmppConfiguration::setNetworkProxy | ( | const QNetworkProxy & | proxy | ) |
Specifies the network proxy used for the connection made by QXmppClient. The default value is QNetworkProxy::DefaultProxy that is the proxy is determined based on the application proxy set using QNetworkProxy::setApplicationProxy().
void QXmppConfiguration::setPassword | ( | const QString & | password | ) |
Sets the password.
password | Password for the specified username |
void QXmppConfiguration::setPort | ( | int | port | ) |
Sets the port number.
port | Port number at which the XMPP server is listening. The default value is 5222. |
void QXmppConfiguration::setResource | ( | const QString & | resource | ) |
Sets the resource identifier.
Multiple resources (e.g., devices or locations) may connect simultaneously to a server on behalf of each authorized client, with each resource differentiated by the resource identifier of an XMPP address (e.g. node@domain/home vs. node@domain/work)
The default value is "QXmpp".
resource | Resource identifier of the client in connection. |
void QXmppConfiguration::setResourcePrefix | ( | const QString & | resourcePrefix | ) |
Sets the resource prefix ('tag' for this client) used when XEP-0386: Bind 2 is available.
void QXmppConfiguration::setSasl2UserAgent | ( | const std::optional< QXmppSasl2UserAgent > & | userAgent | ) |
Sets the user-agent used for XEP-0388: Extensible SASL Profile.
If this is empty, no user-agent will be sent.
void QXmppConfiguration::setSaslAuthMechanism | ( | const QString & | mechanism | ) |
Sets the preferred SASL authentication mechanism.
Valid values: "SCRAM-SHA-256", "SCRAM-SHA-1", "DIGEST-MD5", "PLAIN", "ANONYMOUS",
void QXmppConfiguration::setStreamSecurityMode | ( | QXmppConfiguration::StreamSecurityMode | mode | ) |
Specifies the specified security mode for the stream. The default value is QXmppConfiguration::TLSEnabled.
void QXmppConfiguration::setUseFastTokenAuthentication | ( | bool | useFast | ) |
Sets whether to use FAST token-based authentication from XEP-0484: Fast Authentication Streamlining Tokens if available.
Note that FAST requires a valid SASL 2 user-agent to be set.
void QXmppConfiguration::setUser | ( | const QString & | user | ) |
Sets the username.
user | Username of the account at the specified XMPP server. It should be the name without the domain name. E.g. "qxmpp.test1" and not "qxmpp.test1@gmail.com" |
void QXmppConfiguration::setUseSasl2Authentication | ( | bool | enabled | ) |
Sets whether to use SASL 2 (XEP-0388: Extensible SASL Profile) authentication if available.
void QXmppConfiguration::setWindowsLiveAccessToken | ( | const QString & | accessToken | ) |
Sets the access token used for X-MESSENGER-OAUTH2 authentication.
This token is returned by Windows Live at the end of the OAuth authentication process.
QXmppConfiguration::StreamSecurityMode QXmppConfiguration::streamSecurityMode | ( | ) | const |
Returns the specified security mode for the stream. The default value is QXmppConfiguration::TLSEnabled.
bool QXmppConfiguration::useFastTokenAuthentication | ( | ) | const |
Returns whether to use FAST token-based authentication from XEP-0484: Fast Authentication Streamlining Tokens if available.
Note that FAST requires a valid SASL 2 user-agent to be set.
bool QXmppConfiguration::useSasl2Authentication | ( | ) | const |
Returns whether SASL 2 (XEP-0388: Extensible SASL Profile) authentication is used if available.