QXmppConfiguration.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (C) 2008-2012 The QXmpp developers
  3. *
  4. * Author:
  5. * Manjeet Dahiya
  6. *
  7. * Source:
  8. * http://code.google.com/p/qxmpp
  9. *
  10. * This file is a part of QXmpp library.
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. */
  23. #ifndef QXMPPCONFIGURATION_H
  24. #define QXMPPCONFIGURATION_H
  25. #include <QString>
  26. #include <QSharedDataPointer>
  27. #include "QXmppGlobal.h"
  28. class QNetworkProxy;
  29. class QSslCertificate;
  30. class QXmppConfigurationPrivate;
  31. /// \brief The QXmppConfiguration class holds configuration options.
  32. ///
  33. /// It can be passed to QXmppClient to specify the options when connecting to
  34. /// an XMPP server.
  35. ///
  36. /// It is a container of all the settings, configuration required for
  37. /// connecting to an XMPP server. E.g. server name, username, port, type
  38. /// of authentication mechanism, type of security used by stream (encryption),
  39. /// etc..
  40. ///
  41. class QXMPP_EXPORT QXmppConfiguration
  42. {
  43. public:
  44. /// An enumeration for type of the Security Mode that is stream is encrypted or not.
  45. /// The server may or may not have TLS feature. Server may force the encryption.
  46. /// Depending upon all this user can specify following options.
  47. enum StreamSecurityMode
  48. {
  49. TLSEnabled = 0, ///< Encryption is used if available (default)
  50. TLSDisabled, ///< No encryption is server allows
  51. TLSRequired ///< Encryption is a must otherwise connection would not
  52. ///< be established
  53. };
  54. /// An enumeration for various Non-SASL authentication mechanisms available.
  55. /// The server may or may not allow QXmppConfiguration::Plain mechanism. So
  56. /// specifying the mechanism is just a hint to the library.
  57. enum NonSASLAuthMechanism
  58. {
  59. NonSASLPlain = 0,///< Plain
  60. NonSASLDigest ///< Digest (default)
  61. };
  62. /// An enumeration for various SASL authentication mechanisms available.
  63. /// The server may or may not allow any particular mechanism. So depending
  64. /// upon the availability of mechanisms on the server the library will choose
  65. /// a mechanism.
  66. QXmppConfiguration();
  67. QXmppConfiguration(const QXmppConfiguration &other);
  68. ~QXmppConfiguration();
  69. QXmppConfiguration& operator=(const QXmppConfiguration &other);
  70. QString host() const;
  71. void setHost(const QString&);
  72. QString domain() const;
  73. void setDomain(const QString&);
  74. int port() const;
  75. void setPort(int);
  76. QString user() const;
  77. void setUser(const QString&);
  78. QString password() const;
  79. void setPassword(const QString&);
  80. QString resource() const;
  81. void setResource(const QString&);
  82. QString jid() const;
  83. void setJid(const QString &jid);
  84. QString jidBare() const;
  85. QString facebookAccessToken() const;
  86. void setFacebookAccessToken(const QString&);
  87. QString facebookAppId() const;
  88. void setFacebookAppId(const QString&);
  89. QString googleAccessToken() const;
  90. void setGoogleAccessToken(const QString &accessToken);
  91. QString windowsLiveAccessToken() const;
  92. void setWindowsLiveAccessToken(const QString &accessToken);
  93. bool autoAcceptSubscriptions() const;
  94. void setAutoAcceptSubscriptions(bool);
  95. bool autoReconnectionEnabled() const;
  96. void setAutoReconnectionEnabled(bool);
  97. bool useSASLAuthentication() const;
  98. void setUseSASLAuthentication(bool);
  99. bool useNonSASLAuthentication() const;
  100. void setUseNonSASLAuthentication(bool);
  101. bool ignoreSslErrors() const;
  102. void setIgnoreSslErrors(bool);
  103. QXmppConfiguration::StreamSecurityMode streamSecurityMode() const;
  104. void setStreamSecurityMode(QXmppConfiguration::StreamSecurityMode mode);
  105. QXmppConfiguration::NonSASLAuthMechanism nonSASLAuthMechanism() const;
  106. void setNonSASLAuthMechanism(QXmppConfiguration::NonSASLAuthMechanism);
  107. QString saslAuthMechanism() const;
  108. void setSaslAuthMechanism(const QString &mechanism);
  109. QNetworkProxy networkProxy() const;
  110. void setNetworkProxy(const QNetworkProxy& proxy);
  111. int keepAliveInterval() const;
  112. void setKeepAliveInterval(int secs);
  113. int keepAliveTimeout() const;
  114. void setKeepAliveTimeout(int secs);
  115. QList<QSslCertificate> caCertificates() const;
  116. void setCaCertificates(const QList<QSslCertificate> &);
  117. private:
  118. QSharedDataPointer<QXmppConfigurationPrivate> d;
  119. };
  120. #endif // QXMPPCONFIGURATION_H