From 34d7efe73e065e0bbb54f43be6519f4186925384 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 5 Oct 2012 12:42:16 +0100 Subject: [PATCH 3/8] 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 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mcd-account.c b/src/mcd-account.c index 2d51165..2f588d4 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -4614,11 +4614,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); } -- 1.7.10.4