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 00041 00042 class QXmppConfiguration 00043 { 00044 public: 00048 enum StreamSecurityMode 00049 { 00050 TLSEnabled = 0, 00051 TLSDisabled, 00052 TLSRequired 00053 00054 }; 00055 00059 enum NonSASLAuthMechanism 00060 { 00061 NonSASLPlain = 0, 00062 NonSASLDigest 00063 }; 00064 00069 enum SASLAuthMechanism 00070 { 00071 SASLPlain = 0, 00072 SASLDigestMD5, 00073 SASLAnonymous 00074 }; 00075 00077 enum CompressionMethod 00078 { 00079 ZlibCompression = 0 00080 }; 00081 00082 QXmppConfiguration(); 00083 ~QXmppConfiguration(); 00084 00085 QString host() const; 00086 void setHost(const QString&); 00087 00088 QString domain() const; 00089 void setDomain(const QString&); 00090 00091 int port() const; 00092 void setPort(int); 00093 00094 QString user() const; 00095 void setUser(const QString&); 00096 00097 QString password() const; 00098 void setPassword(const QString&); 00099 00100 QString resource() const; 00101 void setResource(const QString&); 00102 00103 QString jid() const; 00104 void setJid(const QString &jid); 00105 00106 QString jidBare() const; 00107 00108 bool autoAcceptSubscriptions() const; 00109 void setAutoAcceptSubscriptions(bool); 00110 00111 bool autoReconnectionEnabled() const; 00112 void setAutoReconnectionEnabled(bool); 00113 00114 bool useSASLAuthentication() const; 00115 void setUseSASLAuthentication(bool); 00116 00117 bool ignoreSslErrors() const; 00118 void setIgnoreSslErrors(bool); 00119 00120 QXmppConfiguration::StreamSecurityMode streamSecurityMode() const; 00121 void setStreamSecurityMode(QXmppConfiguration::StreamSecurityMode mode); 00122 00123 QXmppConfiguration::NonSASLAuthMechanism nonSASLAuthMechanism() const; 00124 void setNonSASLAuthMechanism(QXmppConfiguration::NonSASLAuthMechanism); 00125 00126 QXmppConfiguration::SASLAuthMechanism sASLAuthMechanism() const; 00127 void setSASLAuthMechanism(QXmppConfiguration::SASLAuthMechanism); 00128 00129 QNetworkProxy networkProxy() const; 00130 void setNetworkProxy(const QNetworkProxy& proxy); 00131 00132 int keepAliveInterval() const; 00133 void setKeepAliveInterval(int secs); 00134 00135 int keepAliveTimeout() const; 00136 void setKeepAliveTimeout(int secs); 00137 00139 // deprecated in release 0.3.0 00140 QString Q_DECL_DEPRECATED passwd() const; 00141 void Q_DECL_DEPRECATED setPasswd(const QString&); 00142 00143 // deprecated in release 0.2.0 00144 // deprecated accessors, use the form without "get" instead 00145 QString Q_DECL_DEPRECATED getHost() const; 00146 QString Q_DECL_DEPRECATED getDomain() const; 00147 int Q_DECL_DEPRECATED getPort() const; 00148 QString Q_DECL_DEPRECATED getUser() const; 00149 QString Q_DECL_DEPRECATED getPasswd() const; 00150 QString Q_DECL_DEPRECATED getResource() const; 00151 QString Q_DECL_DEPRECATED getJid() const; 00152 QString Q_DECL_DEPRECATED getJidBare() const; 00153 00154 bool Q_DECL_DEPRECATED getAutoAcceptSubscriptions() const; 00155 bool Q_DECL_DEPRECATED getAutoReconnectionEnabled() const; 00156 bool Q_DECL_DEPRECATED getUseSASLAuthentication() const; 00157 bool Q_DECL_DEPRECATED getIgnoreSslErrors() const; 00158 QXmppConfiguration::StreamSecurityMode Q_DECL_DEPRECATED getStreamSecurityMode() const; 00159 QXmppConfiguration::NonSASLAuthMechanism Q_DECL_DEPRECATED getNonSASLAuthMechanism() const; 00160 QXmppConfiguration::SASLAuthMechanism Q_DECL_DEPRECATED getSASLAuthMechanism() const; 00161 QNetworkProxy Q_DECL_DEPRECATED getNetworkProxy() const; 00163 00164 private: 00165 QString m_host; 00166 int m_port; 00167 QString m_user; 00168 QString m_password; 00169 QString m_domain; 00170 QString m_resource; 00171 00172 // default is false 00173 bool m_autoAcceptSubscriptions; 00174 // default is true 00175 bool m_sendIntialPresence; 00176 // default is true 00177 bool m_sendRosterRequest; 00178 // interval in seconds, if zero won't ping 00179 int m_keepAliveInterval; 00180 // interval in seconds, if zero won't timeout 00181 int m_keepAliveTimeout; 00182 // will keep reconnecting if disconnected, default is true 00183 bool m_autoReconnectionEnabled; 00184 bool m_useSASLAuthentication; 00185 00186 00187 00188 // default is true 00189 bool m_ignoreSslErrors; 00190 00191 StreamSecurityMode m_streamSecurityMode; 00192 NonSASLAuthMechanism m_nonSASLAuthMechanism; 00193 SASLAuthMechanism m_SASLAuthMechanism; 00194 00195 QNetworkProxy m_networkProxy; 00196 }; 00197 00198 #endif // QXMPPCONFIGURATION_H