[polari/wip/fmuellner/nickserv: 58/62] app: Add 'discard-identify-password' action
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/nickserv: 58/62] app: Add 'discard-identify-password' action
- Date: Mon, 29 Aug 2016 12:21:52 +0000 (UTC)
commit eb1c558959d1d30211b364d306c6bdcecf6a6416
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 10 08:26:51 2016 +0200
app: Add 'discard-identify-password' action
Users will not only be offered the choice of saving "identify"
credentials, but also to dismiss the operation. Discard the
cached parameters in that case as well as on shutdown when
the cache becomes invalid.
https://bugzilla.gnome.org/show_bug.cgi?id=709982
src/application.js | 2 ++
src/telepathyClient.js | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 694db37..9700751 100644
--- a/src/application.js
+++ b/src/application.js
@@ -80,6 +80,8 @@ const Application = new Lang.Class({
parameter_type: GLib.VariantType.new('o') },
{ name: 'save-identify-password',
parameter_type: GLib.VariantType.new('o') },
+ { name: 'discard-identify-password',
+ parameter_type: GLib.VariantType.new('o') },
{ name: 'help',
activate: Lang.bind(this, this._onShowHelp),
accels: ['F1'] },
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index b93fcd5..07aab54 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -118,6 +118,7 @@ const TelepathyClient = new Lang.Class({
this._app = Gio.Application.get_default();
this._app.connect('prepare-shutdown', () => {
[...this._pendingRequests.values()].forEach(r => { r.cancel(); });
+ [...this._pendingBotPasswords.keys()].forEach(a => { this._discardIdentifyPassword(a); });
});
this._pendingBotPasswords = new Map();
@@ -152,7 +153,9 @@ const TelepathyClient = new Lang.Class({
{ name: 'authenticate-account',
handler: Lang.bind(this, this._onAuthenticateAccountActivated) },
{ name: 'save-identify-password',
- handler: Lang.bind(this, this._onSaveIdentifyPasswordActivated) }
+ handler: Lang.bind(this, this._onSaveIdentifyPasswordActivated) },
+ { name: 'discard-identify-password',
+ handler: Lang.bind(this, this._onDiscardIdentifyPasswordActivated) }
];
actions.forEach(a => {
this._app.lookup_action(a.name).connect('activate', a.handler);
@@ -368,6 +371,16 @@ const TelepathyClient = new Lang.Class({
settings.set_string('identify-username', data.username);
},
+ _onDiscardIdentifyPasswordActivated: function(action, parameter) {
+ let accountPath = parameter.deep_unpack();
+ this._discardIdentifyPassword(accountPath);
+ },
+
+ _discardIdentifyPassword: function(accountPath) {
+ this._pendingBotPasswords.delete(accountPath);
+ },
+
+
_isAuthChannel: function(channel) {
return channel.channel_type == Tp.IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]