QXmpp Version:0.3.0
QXmppConfiguration.h
00001 /*
00002  * Copyright (C) 2008-2011 The QXmpp developers
00003  *
00004  * Author:
00005  *  Manjeet Dahiya
00006  *
00007  * Source:
00008  *  http://code.google.com/p/qxmpp
00009  *
00010  * This file is a part of QXmpp library.
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Lesser General Public License for more details.
00021  *
00022  */
00023 
00024 
00025 #ifndef QXMPPCONFIGURATION_H
00026 #define QXMPPCONFIGURATION_H
00027 
00028 #include <QString>
00029 #include <QNetworkProxy>
00030 #include <QSslCertificate>
00031 
00042 
00043 class QXmppConfiguration
00044 {
00045 public:
00049     enum StreamSecurityMode
00050     {
00051         TLSEnabled = 0, 
00052         TLSDisabled,    
00053         TLSRequired     
00054 
00055     };
00056 
00060     enum NonSASLAuthMechanism
00061     {
00062         NonSASLPlain = 0,
00063         NonSASLDigest    
00064     };
00065 
00070     enum SASLAuthMechanism
00071     {
00072         SASLPlain = 0,  
00073         SASLDigestMD5,  
00074         SASLAnonymous   
00075     };
00076 
00078     enum CompressionMethod
00079     {
00080         ZlibCompression = 0 
00081     };
00082 
00083     QXmppConfiguration();
00084     ~QXmppConfiguration();
00085 
00086     QString host() const;
00087     void setHost(const QString&);
00088 
00089     QString domain() const;
00090     void setDomain(const QString&);
00091 
00092     int port() const;
00093     void setPort(int);
00094 
00095     QString user() const;
00096     void setUser(const QString&);
00097 
00098     QString password() const;
00099     void setPassword(const QString&);
00100 
00101     QString resource() const;
00102     void setResource(const QString&);
00103 
00104     QString jid() const;
00105     void setJid(const QString &jid);
00106 
00107     QString jidBare() const;
00108 
00109     bool autoAcceptSubscriptions() const;
00110     void setAutoAcceptSubscriptions(bool);
00111 
00112     bool autoReconnectionEnabled() const;
00113     void setAutoReconnectionEnabled(bool);
00114 
00115     bool useSASLAuthentication() const;
00116     void setUseSASLAuthentication(bool);
00117 
00118     bool ignoreSslErrors() const;
00119     void setIgnoreSslErrors(bool);
00120 
00121     bool ignoreAuth() const;
00122     void setIgnoreAuth(bool);
00123 
00124     QXmppConfiguration::StreamSecurityMode streamSecurityMode() const;
00125     void setStreamSecurityMode(QXmppConfiguration::StreamSecurityMode mode);
00126 
00127     QXmppConfiguration::NonSASLAuthMechanism nonSASLAuthMechanism() const;
00128     void setNonSASLAuthMechanism(QXmppConfiguration::NonSASLAuthMechanism);
00129 
00130     QXmppConfiguration::SASLAuthMechanism sASLAuthMechanism() const;
00131     void setSASLAuthMechanism(QXmppConfiguration::SASLAuthMechanism);
00132 
00133     QNetworkProxy networkProxy() const;
00134     void setNetworkProxy(const QNetworkProxy& proxy);
00135 
00136     int keepAliveInterval() const;
00137     void setKeepAliveInterval(int secs);
00138 
00139     int keepAliveTimeout() const;
00140     void setKeepAliveTimeout(int secs);
00141 
00142     QList<QSslCertificate> caCertificates() const;
00143     void setCaCertificates(const QList<QSslCertificate> &);
00144 
00146     // deprecated in release 0.3.0
00147     QString Q_DECL_DEPRECATED passwd() const;
00148     void Q_DECL_DEPRECATED setPasswd(const QString&);
00149 
00150     // deprecated in release 0.2.0
00151     // deprecated accessors, use the form without "get" instead
00152     QString Q_DECL_DEPRECATED getHost() const;
00153     QString Q_DECL_DEPRECATED getDomain() const;
00154     int Q_DECL_DEPRECATED getPort() const;
00155     QString Q_DECL_DEPRECATED getUser() const;
00156     QString Q_DECL_DEPRECATED getPasswd() const;
00157     QString Q_DECL_DEPRECATED getResource() const;
00158     QString Q_DECL_DEPRECATED getJid() const;
00159     QString Q_DECL_DEPRECATED getJidBare() const;
00160 
00161     bool Q_DECL_DEPRECATED getAutoAcceptSubscriptions() const;
00162     bool Q_DECL_DEPRECATED getAutoReconnectionEnabled() const;
00163     bool Q_DECL_DEPRECATED getUseSASLAuthentication() const;
00164     bool Q_DECL_DEPRECATED getIgnoreSslErrors() const;
00165     QXmppConfiguration::StreamSecurityMode Q_DECL_DEPRECATED getStreamSecurityMode() const;
00166     QXmppConfiguration::NonSASLAuthMechanism Q_DECL_DEPRECATED getNonSASLAuthMechanism() const;
00167     QXmppConfiguration::SASLAuthMechanism Q_DECL_DEPRECATED getSASLAuthMechanism() const;
00168     QNetworkProxy Q_DECL_DEPRECATED getNetworkProxy() const;
00170 
00171 private:
00172     QString m_host;
00173     int m_port;
00174     QString m_user;
00175     QString m_password;
00176     QString m_domain;
00177     QString m_resource;
00178 
00179     // default is false
00180     bool m_autoAcceptSubscriptions;
00181     // default is true
00182     bool m_sendIntialPresence;
00183     // default is true
00184     bool m_sendRosterRequest;
00185     // interval in seconds, if zero won't ping
00186     int m_keepAliveInterval;
00187     // interval in seconds, if zero won't timeout
00188     int m_keepAliveTimeout;
00189     // will keep reconnecting if disconnected, default is true
00190     bool m_autoReconnectionEnabled;
00191     bool m_useSASLAuthentication; 
00192 
00193 
00194 
00195     // default is true
00196     bool m_ignoreSslErrors;
00197 
00198     // default is false
00199     bool m_ignoreAuth;
00200 
00201     StreamSecurityMode m_streamSecurityMode;
00202     NonSASLAuthMechanism m_nonSASLAuthMechanism;
00203     SASLAuthMechanism m_SASLAuthMechanism;
00204 
00205     QNetworkProxy m_networkProxy;
00206 
00207     QList<QSslCertificate> m_caCertificates;
00208 };
00209 
00210 #endif // QXMPPCONFIGURATION_H
 All Classes Functions Enumerations Enumerator Properties