Commit 37b69b37 authored by Florian Müllner's avatar Florian Müllner
Browse files

telepathyClient: Cache sent identify parameters for later saving

We won't save passwords immediately when we detect an "identify" command,
but only after confirmation from the user.  In order to have the data
available for saving later, we need to keep it until the user makes a
decision - the telepathy client is a reasonable place, as it will be
available even when we don't show any UI (once we support that), and
it will be one of the components asking for confirmation.
parent c1918ee3
......@@ -120,6 +120,7 @@ const TelepathyClient = new Lang.Class({
[...this._pendingRequests.values()].forEach(r => { r.cancel(); });
this._pendingBotPasswords = new Map();
this._pendingRequests = new Map();
......@@ -132,6 +133,7 @@ const TelepathyClient = new Lang.Class({
this._roomManager.connect('room-added', (mgr, room) => {
if (room.account.connection)
room.connect('identify-sent', Lang.bind(this, this._onIdentifySent));
this._accountsMonitor = AccountsMonitor.getDefault();
this._accountsMonitor.prepare(Lang.bind(this, this._onPrepared));
......@@ -426,6 +428,17 @@ const TelepathyClient = new Lang.Class({
return notification;
_onIdentifySent: function(room, username, password) {
let accountPath = room.account.object_path;
let data = {
username: username ||,
password: password
this._pendingBotPasswords.set(accountPath, data);
_onMessageReceived: function(channel, msg) {
let [id, ] = msg.get_pending_message_id();
let room = this._roomManager.lookupRoomByChannel(channel);
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