Mercurial > pidgin
changeset 21589:af5de2b08fe0
QuLogic submitted this patch a long time ago, References #2571. I believe
we need to do something for MSNP14 as well, but I haven't figured out
exactly what
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Mon, 19 Nov 2007 07:56:50 +0000 |
parents | 837c382af6a4 |
children | 25a522f544f9 |
files | libpurple/protocols/msnp9/notification.c libpurple/protocols/msnp9/notification.h libpurple/protocols/msnp9/user.c libpurple/protocols/msnp9/user.h libpurple/protocols/msnp9/userlist.c |
diffstat | 5 files changed, 31 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msnp9/notification.c Mon Nov 19 07:44:51 2007 +0000 +++ b/libpurple/protocols/msnp9/notification.c Mon Nov 19 07:56:50 2007 +0000 @@ -1348,7 +1348,7 @@ void msn_notification_add_buddy(MsnNotification *notification, const char *list, - const char *who, const char *store_name, + const char *who, const char *friendly_name, int group_id) { MsnCmdProc *cmdproc; @@ -1360,11 +1360,11 @@ if (group_id >= 0) { msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", - list, who, store_name, group_id); + list, who, friendly_name, group_id); } else { - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, store_name); + msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, friendly_name); } }
--- a/libpurple/protocols/msnp9/notification.h Mon Nov 19 07:44:51 2007 +0000 +++ b/libpurple/protocols/msnp9/notification.h Mon Nov 19 07:56:50 2007 +0000 @@ -46,7 +46,7 @@ void msn_notification_add_buddy(MsnNotification *notification, const char *list, const char *who, - const char *store_name, int group_id); + const char *friendly_name, int group_id); void msn_notification_rem_buddy(MsnNotification *notification, const char *list, const char *who, int group_id);
--- a/libpurple/protocols/msnp9/user.c Mon Nov 19 07:44:51 2007 +0000 +++ b/libpurple/protocols/msnp9/user.c Mon Nov 19 07:56:50 2007 +0000 @@ -27,7 +27,7 @@ MsnUser * msn_user_new(MsnUserList *userlist, const char *passport, - const char *store_name) + const char *friendly_name) { MsnUser *user; @@ -36,16 +36,7 @@ user->userlist = userlist; msn_user_set_passport(user, passport); - msn_user_set_store_name(user, store_name); - - /* - * XXX This seems to reset the friendly name from what it should be - * to the passport when moving users. So, screw it :) - */ -#if 0 - if (name != NULL) - msn_user_set_name(user, name); -#endif + msn_user_set_friendly_name(user, friendly_name); return user; } @@ -66,7 +57,6 @@ g_free(user->passport); g_free(user->friendly_name); - g_free(user->store_name); g_free(user->phone.home); g_free(user->phone.work); g_free(user->phone.mobile); @@ -135,22 +125,24 @@ void msn_user_set_friendly_name(MsnUser *user, const char *name) { + MsnCmdProc *cmdproc; + g_return_if_fail(user != NULL); + if (user->friendly_name && strcmp(user->friendly_name, name)) { + /* copy the new name to the server list, but only when new */ + /* should we check this more thoroughly? */ + cmdproc = user->userlist->session->notification->cmdproc; + msn_cmdproc_send(cmdproc, "REA", "%s %s", + user->passport, + purple_url_encode(name)); + } + g_free(user->friendly_name); user->friendly_name = g_strdup(name); } void -msn_user_set_store_name(MsnUser *user, const char *name) -{ - g_return_if_fail(user != NULL); - - g_free(user->store_name); - user->store_name = g_strdup(name); -} - -void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img) { MsnObject *msnobj = msn_user_get_object(user); @@ -344,14 +336,6 @@ } const char * -msn_user_get_store_name(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->store_name; -} - -const char * msn_user_get_home_phone(const MsnUser *user) { g_return_val_if_fail(user != NULL, NULL);
--- a/libpurple/protocols/msnp9/user.h Mon Nov 19 07:44:51 2007 +0000 +++ b/libpurple/protocols/msnp9/user.h Mon Nov 19 07:56:50 2007 +0000 @@ -42,7 +42,6 @@ MsnUserList *userlist; char *passport; /**< The passport account. */ - char *store_name; /**< The name stored in the server. */ char *friendly_name; /**< The friendly name. */ const char *status; /**< The state of the user. */ @@ -83,7 +82,7 @@ * @return A new user structure. */ MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, - const char *store_name); + const char *friendly_name); /** * Destroys a user structure. @@ -127,14 +126,6 @@ void msn_user_set_friendly_name(MsnUser *user, const char *name); /** - * Sets the store name for a user. - * - * @param user The user. - * @param name The store name. - */ -void msn_user_set_store_name(MsnUser *user, const char *name); - -/** * Sets the buddy icon for a local user. * * @param user The user. @@ -226,15 +217,6 @@ const char *msn_user_get_friendly_name(const MsnUser *user); /** - * Returns the store name for a user. - * - * @param user The user. - * - * @return The store name. - */ -const char *msn_user_get_store_name(const MsnUser *user); - -/** * Returns the home phone number for a user. * * @param user The user.
--- a/libpurple/protocols/msnp9/userlist.c Mon Nov 19 07:44:51 2007 +0000 +++ b/libpurple/protocols/msnp9/userlist.c Mon Nov 19 07:56:50 2007 +0000 @@ -132,18 +132,18 @@ } static const char* -get_store_name(MsnUser *user) +get_friendly_name(MsnUser *user) { - const char *store_name; + const char *friendly_name; g_return_val_if_fail(user != NULL, NULL); - store_name = msn_user_get_store_name(user); + friendly_name = msn_user_get_friendly_name(user); - if (store_name != NULL) - store_name = purple_url_encode(store_name); + if (friendly_name != NULL) + friendly_name = purple_url_encode(friendly_name); else - store_name = msn_user_get_passport(user); + friendly_name = msn_user_get_passport(user); /* this might be a bit of a hack, but it should prevent notification server * disconnections for people who have buddies with insane friendly names @@ -153,10 +153,10 @@ /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're * probably decoding the incoming store_name wrong, or something. bleh. */ - if (strlen(store_name) > BUDDY_ALIAS_MAXLEN) - store_name = msn_user_get_passport(user); + if (strlen(friendly_name) > BUDDY_ALIAS_MAXLEN) + friendly_name = msn_user_get_passport(user); - return store_name; + return friendly_name; } static void @@ -360,7 +360,7 @@ gc = purple_account_get_connection(account); passport = msn_user_get_passport(user); - store = msn_user_get_store_name(user); + store = msn_user_get_friendly_name(user); if (list_op & MSN_LIST_FL_OP) { @@ -639,7 +639,7 @@ MsnUser *user; int group_id; const char *list; - const char *store_name; + const char *friendly_name; group_id = -1; @@ -681,13 +681,13 @@ return; } - store_name = (user != NULL) ? get_store_name(user) : who; + friendly_name = (user != NULL) ? get_friendly_name(user) : who; /* Then request the add to the server. */ list = lists[list_id]; msn_notification_add_buddy(userlist->session->notification, list, who, - store_name, group_id); + friendly_name, group_id); } void