Mercurial > pidgin.yaz
changeset 25033:f5188d4d84e3
Move the check for whether to update the server alias out of nln_cmd and
into msn_user_set_friendly_name instead. This is because it should be done
for nln_cmd and iln_cmd (since we have the friendly name already from the
address book).
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 30 Jan 2009 03:14:29 +0000 |
parents | c434094cf298 |
children | ea9e0fa89c02 |
files | libpurple/protocols/msn/notification.c libpurple/protocols/msn/user.c libpurple/protocols/msn/user.h |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c Thu Jan 29 10:29:25 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Fri Jan 30 03:14:29 2009 +0000 @@ -1094,8 +1094,8 @@ return; } - serv_got_alias(gc, passport, friendly); - msn_user_set_friendly_name(user, friendly); + if (msn_user_set_friendly_name(user, friendly)) + serv_got_alias(gc, passport, friendly); g_free(friendly); msn_user_set_object(user, msnobj); @@ -1220,7 +1220,7 @@ MsnObject *msnobj; unsigned long clientid; int networkid; - const char *state, *passport, *friendly, *old_friendly; + const char *state, *passport, *friendly; session = cmdproc->session; account = session->account; @@ -1234,11 +1234,9 @@ user = msn_userlist_find_user(session->userlist, passport); if (user == NULL) return; - old_friendly = msn_user_get_friendly_name(user); - if (!old_friendly || (old_friendly && (!friendly || strcmp(old_friendly, friendly)))) + if (msn_user_set_friendly_name(user, friendly)) { serv_got_alias(gc, passport, friendly); - msn_user_set_friendly_name(user, friendly); } if (cmd->param_count == 6)
--- a/libpurple/protocols/msn/user.c Thu Jan 29 10:29:25 2009 +0000 +++ b/libpurple/protocols/msn/user.c Fri Jan 30 03:14:29 2009 +0000 @@ -177,13 +177,18 @@ user->passport = g_strdup(passport); } -void +gboolean msn_user_set_friendly_name(MsnUser *user, const char *name) { g_return_if_fail(user != NULL); + if (user->friendly_name && name && !strcmp(user->friendly_name, name)) + return FALSE; + g_free(user->friendly_name); user->friendly_name = g_strdup(name); + + return TRUE; } void
--- a/libpurple/protocols/msn/user.h Thu Jan 29 10:29:25 2009 +0000 +++ b/libpurple/protocols/msn/user.h Fri Jan 30 03:14:29 2009 +0000 @@ -178,8 +178,10 @@ * * @param user The user. * @param name The friendly name. + * + * @returns TRUE is name actually changed, FALSE otherwise. */ -void msn_user_set_friendly_name(MsnUser *user, const char *name); +gboolean msn_user_set_friendly_name(MsnUser *user, const char *name); /** * Sets the buddy icon for a local user.