[polari/wip/fmuellner/clean-retry-data] app: Clean up retry data of removed accounts



commit 2e5bc25dd1b89375a2111509864f433a308d93a1
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 11 23:56:42 2017 +0100

    app: Clean up retry data of removed accounts
    
    Telepathy's account IDs use a pattern of <CM>/<protocol>/<identifier>num,
    which is mostly redundant for us: We only support idle/irc, and for
    predefined networks the original nick (which ends up being the identifier
    recorded in the ID) is the login username. So usually account IDs only
    differ in the uniquifying number - starting from 0, telepathy will simply
    pick the smallest number that hasn't been taken yet. That strategy means
    that when removing an account, the next account that is created may well
    use an identical ID. In case we have retry data (like alternative servers)
    for the old account, we must make sure to not accidentally apply it to
    the new one, so clean it on account removal.
    
    Fixes https://gitlab.gnome.org/GNOME/polari/issues/27

 src/application.js | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/application.js b/src/application.js
index 8b276c5..66aa6c0 100644
--- a/src/application.js
+++ b/src/application.js
@@ -261,6 +261,11 @@ var Application = GObject.registerClass({
                 a.set_nickname_finish(res);
             });
         });
+        this._accountsMonitor.connect('account-removed', (am, account) => {
+            // Make sure we don't 'inject' outdated data into
+            // a new account with the same ID
+            this._retryData.delete(account.object_path);
+        });
 
         this.pasteManager = new PasteManager();
         this.notificationQueue = new AppNotifications.NotificationQueue();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]