Public feed #891156

Something

public text v1 · immutable
Raw Edit
·published 2008-02-04 12:40 UTC
rendered paste body
  * [LOCAL] dbus account reconnect
diff -rN -u old-worktree/src/dbus.cpp new-worktree/src/dbus.cpp
--- old-worktree/src/dbus.cpp   2008-02-04 13:39:05.000000000 +0100
+++ new-worktree/src/dbus.cpp   2008-02-04 13:39:05.000000000 +0100
@@ -27,6 +27,7 @@
 public Q_SLOTS:
 //     void openURI(QString uri);
        void raise();
+       void reconnectLater(int secs);
 /*Q_SIGNALS:
        void psi_pong();
 */
@@ -55,6 +56,14 @@
        psicon->raiseMainwin();
 }
 
+void PsiConAdapter::reconnectLater(int secs)
+{
+       foreach(PsiAccount *pa, psicon->contactList()->accounts()) {
+               pa->reconnectLater(secs);
+
+       }
+}
+
 
 
 
diff -rN -u old-worktree/src/psiaccount.cpp new-worktree/src/psiaccount.cpp
--- old-worktree/src/psiaccount.cpp     2008-02-04 13:39:05.000000000 +0100
+++ new-worktree/src/psiaccount.cpp     2008-02-04 13:39:14.000000000 +0100
@@ -1614,6 +1614,28 @@
        m->show();
 }
 
+
+
+void PsiAccount::reconnectLater(int secs)
+{
+       if (!isActive()) return;
+
+       d->client->close();
+       cleanupStream();
+
+       isDisconnecting = true;
+
+       if ( loggedIn() ) { // FIXME: is this condition okay?
+               simulateRosterOffline();
+       }
+
+       presenceSent = false; // this stops the idle detector?? (FIXME)
+
+       doReconnect = true;
+       stateChanged();
+       QTimer::singleShot(secs * 1000, this, SLOT(reconnect()));
+}
+
 void PsiAccount::client_rosterRequestFinished(bool success, int, const QString &)
 {
        if(success) {
@@ -2170,7 +2192,6 @@
 {
        if(doReconnect) {
                //printf("PsiAccount: [%s] reconnecting...\n", name().latin1());
-               emit reconnecting();
                v_isActive = false;
                doReconnect = false;
                login();
diff -rN -u old-worktree/src/psiaccount.h new-worktree/src/psiaccount.h
--- old-worktree/src/psiaccount.h       2008-02-04 13:39:05.000000000 +0100
+++ new-worktree/src/psiaccount.h       2008-02-04 13:39:14.000000000 +0100
@@ -167,6 +167,8 @@
        bool checkConnected(QWidget *parent=0);
        void playSound(const QString &);
 
+       void reconnectLater(int secs);
+
        QStringList hiddenChats(const Jid &) const;
 
        int sendMessageEncrypted(const Message &);