00001 /* 00002 * Copyright (C) 2008-2010 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 00076 QXmppConfiguration(); 00077 ~QXmppConfiguration(); 00078 00079 QString host() const; 00080 QString domain() const; 00081 int port() const; 00082 QString user() const; 00083 QString passwd() const; 00084 QString resource() const; 00085 QString jid() const; 00086 QString jidBare() const; 00087 00088 bool autoAcceptSubscriptions() const; 00089 bool autoReconnectionEnabled() const; 00090 bool useSASLAuthentication() const; 00091 bool ignoreSslErrors() const; 00092 QXmppConfiguration::StreamSecurityMode streamSecurityMode() const; 00093 QXmppConfiguration::NonSASLAuthMechanism nonSASLAuthMechanism() const; 00094 QXmppConfiguration::SASLAuthMechanism sASLAuthMechanism() const; 00095 QNetworkProxy networkProxy() const; 00096 00097 int keepAliveInterval() const; 00098 void setKeepAliveInterval(int secs); 00099 int keepAliveTimeout() const; 00100 void setKeepAliveTimeout(int secs); 00101 00102 void setHost(const QString&); 00103 void setDomain(const QString&); 00104 void setPort(int); 00105 void setUser(const QString&); 00106 void setPasswd(const QString&); 00107 void setResource(const QString&); 00108 00109 void setAutoAcceptSubscriptions(bool); 00110 void setAutoReconnectionEnabled(bool); 00111 void setUseSASLAuthentication(bool); 00112 void setIgnoreSslErrors(bool); 00113 00114 void setStreamSecurityMode(QXmppConfiguration::StreamSecurityMode mode); 00115 void setNonSASLAuthMechanism(QXmppConfiguration::NonSASLAuthMechanism); 00116 void setSASLAuthMechanism(QXmppConfiguration::SASLAuthMechanism); 00117 00118 void setNetworkProxy(const QNetworkProxy& proxy); 00119 00120 // deprecated accessors, use the form without "get" instead 00122 QString Q_DECL_DEPRECATED getHost() const; 00123 QString Q_DECL_DEPRECATED getDomain() const; 00124 int Q_DECL_DEPRECATED getPort() const; 00125 QString Q_DECL_DEPRECATED getUser() const; 00126 QString Q_DECL_DEPRECATED getPasswd() const; 00127 QString Q_DECL_DEPRECATED getResource() const; 00128 QString Q_DECL_DEPRECATED getJid() const; 00129 QString Q_DECL_DEPRECATED getJidBare() const; 00130 00131 bool Q_DECL_DEPRECATED getAutoAcceptSubscriptions() const; 00132 bool Q_DECL_DEPRECATED getAutoReconnectionEnabled() const; 00133 bool Q_DECL_DEPRECATED getUseSASLAuthentication() const; 00134 bool Q_DECL_DEPRECATED getIgnoreSslErrors() const; 00135 QXmppConfiguration::StreamSecurityMode Q_DECL_DEPRECATED getStreamSecurityMode() const; 00136 QXmppConfiguration::NonSASLAuthMechanism Q_DECL_DEPRECATED getNonSASLAuthMechanism() const; 00137 QXmppConfiguration::SASLAuthMechanism Q_DECL_DEPRECATED getSASLAuthMechanism() const; 00138 QNetworkProxy Q_DECL_DEPRECATED getNetworkProxy() const; 00140 00141 private: 00142 QString m_host; 00143 int m_port; 00144 QString m_user; 00145 QString m_passwd; 00146 QString m_domain; 00147 QString m_resource; 00148 00149 // default is false 00150 bool m_autoAcceptSubscriptions; 00151 // default is true 00152 bool m_sendIntialPresence; 00153 // default is true 00154 bool m_sendRosterRequest; 00155 // interval in seconds, if zero won't ping 00156 int m_keepAliveInterval; 00157 // interval in seconds, if zero won't timeout 00158 int m_keepAliveTimeout; 00159 // will keep reconnecting if disconnected, default is true 00160 bool m_autoReconnectionEnabled; 00161 bool m_useSASLAuthentication; 00162 00163 00164 00165 // default is true 00166 bool m_ignoreSslErrors; 00167 00168 StreamSecurityMode m_streamSecurityMode; 00169 NonSASLAuthMechanism m_nonSASLAuthMechanism; 00170 SASLAuthMechanism m_SASLAuthMechanism; 00171 00172 QNetworkProxy m_networkProxy; 00173 }; 00174 00175 #endif // QXMPPCONFIGURATION_H