[polari/gnome-3-24] telepathyClient: Only identify with nickname when necessary



commit c2f4a6a967ec621e6bcc6549e0abd0d54decc887
Author: Justyn Temme <Justyntemme gmail com>
Date:   Wed May 10 06:37:58 2017 -0500

    telepathyClient: Only identify with nickname when necessary
    
    Many NickServ bots only take a password parameter, while we currently
    send the username along unconditionally to make sure that identification
    is still possible when connecting with a nickname that doesn't match
    the registered one.
    In order to work both with bots that support an optional username
    parameter and those that don't understand the parameter at all,
    omit the username when it already matches the currently used nick.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772915

 src/telepathyClient.js |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index d6b5011..f57affc 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -310,6 +310,11 @@ const TelepathyClient = new Lang.Class({
                     return;
 
                 let room = this._roomManager.lookupRoomByChannel(channel);
+                let activeNick = room.channel.connection.self_contact.alias;
+                // Omit username parameter when it matches the default, to
+                // support NickServ bots that don't support the parameter at all
+                if (activeNick == username)
+                    username = null;
                 room.send_identify_message_async(command, username, password, (r, res) => {
                     try {
                         r.send_identify_message_finish(res);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]