diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-05-16 12:41:35 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-05-16 12:41:35 +0200 |
| commit | 0e938469ba2361e0f77661b2cb5485041df7a4c2 (patch) | |
| tree | be0c9bacd068a548e0ab269bc894d61709555fb4 /src | |
| parent | b6f99322cf46d7667cf69f7eec0b257277868707 (diff) | |
| download | qxmpp-0e938469ba2361e0f77661b2cb5485041df7a4c2.tar.gz | |
fully remove QXmppReconnectionManager
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/QXmppClient.cpp | 11 | ||||
| -rw-r--r-- | src/client/QXmppClient.h | 6 | ||||
| -rw-r--r-- | src/client/QXmppReconnectionManager.cpp | 101 | ||||
| -rw-r--r-- | src/client/QXmppReconnectionManager.h | 61 | ||||
| -rw-r--r-- | src/client/client.pri | 2 |
5 files changed, 0 insertions, 181 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp index a41a90bf..de7acb5d 100644 --- a/src/client/QXmppClient.cpp +++ b/src/client/QXmppClient.cpp @@ -455,17 +455,6 @@ void QXmppClient::setClientPresence(const QXmppPresence& presence) connectToServer(d->stream->configuration(), presence); } -QXmppReconnectionManager* QXmppClient::reconnectionManager() -{ - return 0; -} - -bool QXmppClient::setReconnectionManager(QXmppReconnectionManager* reconnectionManager) -{ - Q_UNUSED(reconnectionManager); - return false; -} - /// Returns the socket error if error() is QXmppClient::SocketError. /// diff --git a/src/client/QXmppClient.h b/src/client/QXmppClient.h index 0f6a6ea2..9d475338 100644 --- a/src/client/QXmppClient.h +++ b/src/client/QXmppClient.h @@ -40,7 +40,6 @@ class QXmppStream; // managers class QXmppDiscoveryIq; -class QXmppReconnectionManager; class QXmppRosterManager; class QXmppVCardManager; class QXmppVersionManager; @@ -155,11 +154,6 @@ public: QXmppVCardManager& vCardManager(); QXmppVersionManager& versionManager(); - /// cond - QXmppReconnectionManager Q_DECL_DEPRECATED *reconnectionManager(); - bool Q_DECL_DEPRECATED setReconnectionManager(QXmppReconnectionManager*); - /// \endcond - signals: /// This signal is emitted when the client connects successfully to the XMPP diff --git a/src/client/QXmppReconnectionManager.cpp b/src/client/QXmppReconnectionManager.cpp deleted file mode 100644 index adb84e9f..00000000 --- a/src/client/QXmppReconnectionManager.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * Author: - * Manjeet Dahiya - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - - -#include "QXmppReconnectionManager.h" -#include "QXmppClient.h" -#include "QXmppLogger.h" -#include "QXmppUtils.h" - -QXmppReconnectionManager::QXmppReconnectionManager(QXmppClient* client) : - QObject(client), - m_receivedConflict(false), - m_reconnectionTries(0), - m_timer(this), - m_client(client) -{ - m_timer.setSingleShot(true); - bool check = connect(&m_timer, SIGNAL(timeout()), SLOT(reconnect())); - Q_ASSERT(check); - Q_UNUSED(check); -} - -void QXmppReconnectionManager::connected() -{ - m_receivedConflict = false; - m_reconnectionTries = 0; -} - -void QXmppReconnectionManager::error(QXmppClient::Error error) -{ - if(m_client && error == QXmppClient::XmppStreamError) - { - // if we receive a resource conflict, inhibit reconnection - if(m_client->xmppStreamError() == QXmppStanza::Error::Conflict) - m_receivedConflict = true; - } - else if(m_client && error == QXmppClient::SocketError && !m_receivedConflict) - { - int time = getNextReconnectingInTime(); - - // time is in sec - m_timer.start(time*1000); - emit reconnectingIn(time); - } - else if (m_client && error == QXmppClient::KeepAliveError) - { - // if we got a keepalive error, reconnect in one second - m_timer.start(1000); - } -} - -int QXmppReconnectionManager::getNextReconnectingInTime() -{ - int reconnectingIn; - if(m_reconnectionTries < 5) - reconnectingIn = 10; - else if(m_reconnectionTries < 10) - reconnectingIn = 20; - else if(m_reconnectionTries < 15) - reconnectingIn = 40; - else - reconnectingIn = 60; - - return reconnectingIn; -} - -void QXmppReconnectionManager::reconnect() -{ - if(m_client) - { - emit reconnectingNow(); - m_client->connectToServer(m_client->configuration(), m_client->clientPresence()); - } -} - -void QXmppReconnectionManager::cancelReconnection() -{ - m_timer.stop(); - m_receivedConflict = false; - m_reconnectionTries = 0; -} diff --git a/src/client/QXmppReconnectionManager.h b/src/client/QXmppReconnectionManager.h deleted file mode 100644 index cc9d309e..00000000 --- a/src/client/QXmppReconnectionManager.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * Author: - * Manjeet Dahiya - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - - -#ifndef QXMPPRECONNECTIONMANAGER_H -#define QXMPPRECONNECTIONMANAGER_H - -#include <QObject> -#include <QTimer> -#include "QXmppClient.h" - -class QXMPP_EXPORT QXmppReconnectionManager : public QObject -{ - Q_OBJECT - -public: - QXmppReconnectionManager(QXmppClient* client); - -signals: - void reconnectingIn(int); - void reconnectingNow(); - -public slots: - void cancelReconnection(); - -private slots: - void connected(); - void error(QXmppClient::Error); - void reconnect(); - -private: - int getNextReconnectingInTime(); - bool m_receivedConflict; - int m_reconnectionTries; - QTimer m_timer; - - // reference to to client object (no ownership) - QXmppClient* m_client; -}; - -#endif // QXMPPRECONNECTIONMANAGER_H diff --git a/src/client/client.pri b/src/client/client.pri index aa138442..82d46cc6 100644 --- a/src/client/client.pri +++ b/src/client/client.pri @@ -12,7 +12,6 @@ INSTALL_HEADERS += \ client/QXmppMessageReceiptManager.h \ client/QXmppMucManager.h \ client/QXmppOutgoingClient.h \ - client/QXmppReconnectionManager.h \ client/QXmppRemoteMethod.h \ client/QXmppRosterManager.h \ client/QXmppRpcManager.h \ @@ -35,7 +34,6 @@ SOURCES += \ client/QXmppMessageReceiptManager.cpp \ client/QXmppMucManager.cpp \ client/QXmppOutgoingClient.cpp \ - client/QXmppReconnectionManager.cpp \ client/QXmppRemoteMethod.cpp \ client/QXmppRosterManager.cpp \ client/QXmppRpcManager.cpp \ |
