[polari] app: Trim trailing _ instead of restoring original account
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Trim trailing _ instead of restoring original account
- Date: Mon, 10 Apr 2017 22:40:36 +0000 (UTC)
commit af97e06ac4d6fd8ce533567d6567e59e7278ccca
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Mar 23 18:33:11 2017 +0100
app: Trim trailing _ instead of restoring original account
If a connection fails because the chosen nick is already in use, we
automatically retry with an appended underscore. But while we restore
the original name when the connection succeeds or we are giving up,
the underscores can stick around when polari is closed while still
connecting. And as the underscores are then considered part of the
original name when polari is next started, they tend to pile up after
a while. To counter that, assume that all trailing underscores aren't
part of the genuine nick and trim them instead of trying to restore the
original account name.
https://bugzilla.gnome.org/show_bug.cgi?id=781161
src/application.js | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index cf1faa8..d1d9d89 100644
--- a/src/application.js
+++ b/src/application.js
@@ -437,7 +437,6 @@ const Application = new Lang.Class({
data = {
retry: 0,
- originalAccountName: accountName,
alternateServers: accountServers.filter(s => s.address != server ||
s.port != port)
};
@@ -445,15 +444,16 @@ const Application = new Lang.Class({
return data;
},
- _restoreAccountName: function(account) {
- let data = this._retryData.get(account.object_path);
- if (!data || !data.retry || !data.originalAccountName)
- return;
+ _getTrimmedAccountName: function(account) {
+ let params = Connections.getAccountParams(account);
+ return params.account.replace(/_+$/, '');
+ },
- let params = { account: new GLib.Variant('s', data.originalAccountName) };
+ _restoreAccountName: function(account) {
+ let accountName = this._getTrimmedAccountName(account);
+ let params = { account: new GLib.Variant('s', accountName) };
let asv = new GLib.Variant('a{sv}', params);
account.update_parameters_vardict_async(asv, [], null);
- delete data.originalAccountName;
},
_retryWithParams: function(account, params) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]