libpurple/protocols/msnp9/userlist.c

changeset 21674
7e183cd7e0b5
parent 21621
4b51f1ade230
child 22823
ad030cc32c49
equal deleted inserted replaced
21673:f26901ad164e 21674:7e183cd7e0b5
130 130
131 return TRUE; 131 return TRUE;
132 } 132 }
133 133
134 static const char* 134 static const char*
135 get_store_name(MsnUser *user) 135 get_friendly_name(MsnUser *user)
136 { 136 {
137 const char *store_name; 137 const char *friendly_name;
138 138
139 g_return_val_if_fail(user != NULL, NULL); 139 g_return_val_if_fail(user != NULL, NULL);
140 140
141 store_name = msn_user_get_store_name(user); 141 friendly_name = msn_user_get_friendly_name(user);
142 142
143 if (store_name != NULL) 143 if (friendly_name != NULL)
144 store_name = purple_url_encode(store_name); 144 friendly_name = purple_url_encode(friendly_name);
145 else 145 else
146 store_name = msn_user_get_passport(user); 146 friendly_name = msn_user_get_passport(user);
147 147
148 /* this might be a bit of a hack, but it should prevent notification server 148 /* this might be a bit of a hack, but it should prevent notification server
149 * disconnections for people who have buddies with insane friendly names 149 * disconnections for people who have buddies with insane friendly names
150 * who added you to their buddy list from being disconnected. Stu. */ 150 * who added you to their buddy list from being disconnected. Stu. */
151 /* Shx: What? Isn't the store_name obtained from the server, and hence it's 151 /* Shx: What? Isn't the store_name obtained from the server, and hence it's
152 * below the BUDDY_ALIAS_MAXLEN ? */ 152 * below the BUDDY_ALIAS_MAXLEN ? */
153 /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're 153 /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're
154 * probably decoding the incoming store_name wrong, or something. bleh. */ 154 * probably decoding the incoming store_name wrong, or something. bleh. */
155 155
156 if (strlen(store_name) > BUDDY_ALIAS_MAXLEN) 156 if (strlen(friendly_name) > BUDDY_ALIAS_MAXLEN)
157 store_name = msn_user_get_passport(user); 157 friendly_name = msn_user_get_passport(user);
158 158
159 return store_name; 159 return friendly_name;
160 } 160 }
161 161
162 static void 162 static void
163 msn_request_add_group(MsnUserList *userlist, const char *who, 163 msn_request_add_group(MsnUserList *userlist, const char *who,
164 const char *old_group_name, const char *new_group_name) 164 const char *old_group_name, const char *new_group_name)
358 358
359 account = session->account; 359 account = session->account;
360 gc = purple_account_get_connection(account); 360 gc = purple_account_get_connection(account);
361 361
362 passport = msn_user_get_passport(user); 362 passport = msn_user_get_passport(user);
363 store = msn_user_get_store_name(user); 363 store = msn_user_get_friendly_name(user);
364 364
365 if (list_op & MSN_LIST_FL_OP) 365 if (list_op & MSN_LIST_FL_OP)
366 { 366 {
367 GSList *c; 367 GSList *c;
368 for (c = group_ids; c != NULL; c = g_slist_next(c)) 368 for (c = group_ids; c != NULL; c = g_slist_next(c))
637 const char *group_name) 637 const char *group_name)
638 { 638 {
639 MsnUser *user; 639 MsnUser *user;
640 int group_id; 640 int group_id;
641 const char *list; 641 const char *list;
642 const char *store_name; 642 const char *friendly_name;
643 643
644 group_id = -1; 644 group_id = -1;
645 645
646 if (!purple_email_is_valid(who)) 646 if (!purple_email_is_valid(who))
647 { 647 {
679 list = lists[list_id]; 679 list = lists[list_id];
680 purple_debug_error("msn", "User '%s' is already there: %s\n", who, list); 680 purple_debug_error("msn", "User '%s' is already there: %s\n", who, list);
681 return; 681 return;
682 } 682 }
683 683
684 store_name = (user != NULL) ? get_store_name(user) : who; 684 friendly_name = (user != NULL) ? get_friendly_name(user) : who;
685 685
686 /* Then request the add to the server. */ 686 /* Then request the add to the server. */
687 list = lists[list_id]; 687 list = lists[list_id];
688 688
689 msn_notification_add_buddy(userlist->session->notification, list, who, 689 msn_notification_add_buddy(userlist->session->notification, list, who,
690 store_name, group_id); 690 friendly_name, group_id);
691 } 691 }
692 692
693 void 693 void
694 msn_userlist_move_buddy(MsnUserList *userlist, const char *who, 694 msn_userlist_move_buddy(MsnUserList *userlist, const char *who,
695 const char *old_group_name, const char *new_group_name) 695 const char *old_group_name, const char *new_group_name)

mercurial