telepathy-mission-control: Don' t set the nickname to the normalized name on connect

Simon McVittie smcv at kemper.freedesktop.org
Tue Oct 9 09:11:23 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: b6d933c6927a8b0b4c60a414ccd7c271fb14e0dd
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=b6d933c6927a8b0b4c60a414ccd7c271fb14e0dd

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Oct  5 12:42:16 2012 +0100

Don't set the nickname to the normalized name on connect

We still allow the nickname to be set to the normalized name by
user action later, because in that case, the intention is unambiguous:
the user really does want their nickname to take that value.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39381

---

 src/mcd-account.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index 0a66b8b..6804c20 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -4585,11 +4585,25 @@ mcd_account_connection_ready_cb (McdAccount *account,
     /* FIXME: ideally, on protocols with server-stored nicknames, this should
      * only be done if the local Nickname has been changed since last time we
      * were online; Aliasing doesn't currently offer a way to tell whether
-     * this is such a protocol, though. */
-
+     * this is such a protocol, though.
+     *
+     * As a first step towards doing the right thing, we assume that if our
+     * locally-stored nickname is just the protocol identifer, the
+     * server-stored nickname (if any) takes precedence.
+     */
     nickname = mcd_account_get_alias (account);
 
-    if (nickname != NULL)
+    if (tp_str_empty (nickname))
+    {
+        DEBUG ("no nickname yet");
+    }
+    else if (!tp_strdiff (nickname,
+            tp_contact_get_identifier (priv->self_contact)))
+    {
+        DEBUG ("not setting nickname to '%s' since it matches the "
+            "NormalizedName", nickname);
+    }
+    else
     {
         mcd_account_send_nickname_to_connection (account, nickname);
     }



More information about the telepathy-commits mailing list