Commit 3397da7d authored by Florian Müllner's avatar Florian Müllner
Browse files

telepathyClient: Ask users whether to save "identify" passwords

To identify with NickServ, users don't need to actually select the
corresponding room - they could use the /msg command or gnome-shell's
built-in chat notifications.  As the user likely won't see the info
bar added in the previous commit in that case, use a notification
to ask for confirmation when the bot's room isn't active.
parent 2ed6d7cb
......@@ -378,6 +378,7 @@ const TelepathyClient = new Lang.Class({
_discardIdentifyPassword: function(accountPath) {
......@@ -459,16 +460,31 @@ const TelepathyClient = new Lang.Class({
return 'pending-message-%s-%d'.format(, id);
_getIdentifyNotificationID: function(accountPath) {
return 'identify-password-%s'.format(accountPath);
_createNotification: function(room, summary, body) {
let notification = new Gio.Notification();
let param ='(ssu)',
[ room.account.object_path,
Utils.getTpEventTime() ]);
notification.set_default_action_and_target('app.join-room', param);
let params = [room.account.object_path,
let actionName, paramFormat;
if (room.type == Tp.HandleType.ROOM) {
actionName = 'app.join-room';
paramFormat = '(ssu)';
} else {
actionName = 'app.message-user';
paramFormat = '(sssu)';
params.splice(2, 0, '');
let param =, params);
notification.set_default_action_and_target(actionName, param);
return notification;
......@@ -481,6 +497,21 @@ const TelepathyClient = new Lang.Class({
password: password
this._pendingBotPasswords.set(accountPath, data);
if (this._app.isRoomFocused(room))
let accountName = room.account.display_name;
/* Translators: Those are a botname and an accountName, e.g.
"Save NickServ password for GNOME" */
let summary = _("Save %s password for %s?").format(data.botname, accountName);
let text = _("Identification will happen automatically the next time you connect to %s").format(accountName);
let notification = this._createNotification(room, summary, text);
notification.add_button_with_target(_("Save"), '',
new GLib.Variant('o', accountPath));
this._app.send_notification(this._getIdentifyNotificationID(accountPath), notification);
_onMessageReceived: function(channel, msg) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment