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



commit 79f762581f01b4b57f3258c786a1944b76076036
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.

 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]