Mercurial > pidgin.yaz
changeset 31722:db330f8c1a8c
merge of '6118d1117f31a7fc8db4bd5431af400a7b46ff17'
and 'b28bde636d271fd90efcba54f25ecf7af2e5331b'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 01 Mar 2011 06:24:50 +0000 |
parents | 169ebed69ef0 (diff) 69094d578a45 (current diff) |
children | 4f414608eaad |
files | ChangeLog libpurple/protocols/msn/msn.c |
diffstat | 9 files changed, 68 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Mar 01 06:23:34 2011 +0000 +++ b/ChangeLog Tue Mar 01 06:24:50 2011 +0000 @@ -14,6 +14,10 @@ * Fix a bug where some buddies from your buddy list might not show up. Affected non-English ICQ users the most. (#13386) + MSN: + * Fix bug that prevented added buddies to your buddy list in certain + circumstances. (#13298) + XMPP: * Fix building on platforms with an older glib (inadvertantly broken in 2.7.10). (#13329)
--- a/ChangeLog.API Tue Mar 01 06:23:34 2011 +0000 +++ b/ChangeLog.API Tue Mar 01 06:24:50 2011 +0000 @@ -1,6 +1,11 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 2.7.11 (??/??/????): + * Perl: + Added: + * Purple::find_conversation_with_account + * Purple::Conversation::Chat::send_with_flags + * Purple::Conversation::IM::send_with_flags version 2.7.10 (02/06/2011): * No changes
--- a/libpurple/plugins/perl/common/Conversation.xs Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/plugins/perl/common/Conversation.xs Tue Mar 01 06:24:50 2011 +0000 @@ -118,6 +118,12 @@ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); } +Purple::Conversation +purple_find_conversation_with_account(type, name, account) + Purple::ConversationType type + const char *name + Purple::Account account + MODULE = Purple::Conversation PACKAGE = Purple::Conversations PREFIX = purple_conversations_ PROTOTYPES: ENABLE @@ -297,6 +303,12 @@ const char *message void +purple_conv_im_send_with_flags(im, message, flags) + Purple::Conversation::IM im + const char *message + Purple::MessageFlags flags + +void purple_conv_im_write(im, who, message, flags, mtime) Purple::Conversation::IM im const char *who @@ -410,6 +422,12 @@ const char * message void +purple_conv_chat_send_with_flags(chat, message, flags) + Purple::Conversation::Chat chat + const char * message + Purple::MessageFlags flags + +void purple_conv_chat_write(chat, who, message, flags, mtime) Purple::Conversation::Chat chat const char *who
--- a/libpurple/protocols/msn/msn.c Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/protocols/msn/msn.c Tue Mar 01 06:24:50 2011 +0000 @@ -1749,38 +1749,33 @@ MsnUser *user) { char *group; + MsnUserList *userlist; + MsnUser *user2; g_return_if_fail(user != NULL); + if (network == MSN_NETWORK_UNKNOWN) { + purple_debug_error("msn", "Network in FQY response was unknown. " + "Assuming %s is a passport user and adding anyway.\n", who); + network = MSN_NETWORK_PASSPORT; + } + group = msn_user_remove_pending_group(user); - if (network != MSN_NETWORK_UNKNOWN) { - MsnUserList *userlist = session->userlist; - MsnUser *user2 = msn_userlist_find_user(userlist, who); - if (user2 != NULL) { - /* User already in userlist, so just update it. */ - msn_user_unref(user); - user = user2; - } else { - msn_userlist_add_user(userlist, user); - } - - msn_user_set_network(user, network); - msn_userlist_add_buddy(userlist, who, group); - } - else - { - PurpleBuddy * buddy = purple_find_buddy(session->account, who); - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses."), who); - if (!purple_conv_present_error(who, session->account, buf)) - purple_notify_error(purple_account_get_connection(session->account), NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); + userlist = session->userlist; + user2 = msn_userlist_find_user(userlist, who); + if (user2 != NULL) { + /* User already in userlist, so just update it. */ + msn_user_unref(user); + user = user2; + } else { + msn_userlist_add_user(userlist, user); msn_user_unref(user); } + + msn_user_set_network(user, network); + msn_userlist_add_buddy(userlist, who, group); + g_free(group); } @@ -1817,7 +1812,10 @@ /* XXX - Would group ever be NULL here? I don't think so... * shx: Yes it should; MSN handles non-grouped buddies, and this is only - * internal. */ + * internal. + * KingAnt: But PurpleBuddys must always exist inside PurpleGroups, so + * won't group always be non-NULL here? + */ user = msn_userlist_find_user(userlist, who); if ((user != NULL) && (user->networkid != MSN_NETWORK_UNKNOWN)) { /* We already know this buddy and their network. This function knows @@ -1836,6 +1834,8 @@ fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", tokens[1], tokens[0]); + /* TODO: I think user will leak if we disconnect before receiving + a response to this FQY request */ msn_notification_send_fqy(session, fqy, strlen(fqy), (MsnFqyCb)add_pending_buddy, user); g_free(fqy);
--- a/libpurple/protocols/msn/session.c Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/protocols/msn/session.c Tue Mar 01 06:24:50 2011 +0000 @@ -46,7 +46,7 @@ session->user = msn_user_new(session->userlist, purple_account_get_username(account), NULL); - msn_userlist_add_user(session->userlist, msn_user_ref(session->user)); + msn_userlist_add_user(session->userlist, session->user); session->oim = msn_oim_new(session); session->protocol_ver = 0;
--- a/libpurple/protocols/msn/user.h Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/protocols/msn/user.h Tue Mar 01 06:24:50 2011 +0000 @@ -149,7 +149,7 @@ * @param passport The initial passport. * @param stored_name The initial stored name. * - * @return A new user structure. + * @return A new user structure. It will have a reference count of 1. */ MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, const char *friendly_name); @@ -164,7 +164,8 @@ MsnUser *msn_user_ref(MsnUser *user); /** - * Decrement the reference count. + * Decrement the reference count. When the count reaches 0 the object is + * automatically freed. * * @param user The user */
--- a/libpurple/protocols/msn/userlist.c Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/protocols/msn/userlist.c Tue Mar 01 06:24:50 2011 +0000 @@ -236,17 +236,18 @@ } MsnUser * -msn_userlist_find_add_user(MsnUserList *userlist,const char *passport,const char *userName) +msn_userlist_find_add_user(MsnUserList *userlist, const char *passport, const char *friendly_name) { MsnUser *user; user = msn_userlist_find_user(userlist, passport); if (user == NULL) { - user = msn_user_new(userlist, passport, userName); + user = msn_user_new(userlist, passport, friendly_name); msn_userlist_add_user(userlist, user); + msn_user_unref(user); } else { - msn_user_set_friendly_name(user, userName); + msn_user_set_friendly_name(user, friendly_name); } return user; } @@ -254,6 +255,7 @@ void msn_userlist_add_user(MsnUserList *userlist, MsnUser *user) { + msn_user_ref(user); userlist->users = g_list_prepend(userlist->users, user); } @@ -261,6 +263,7 @@ msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) { userlist->users = g_list_remove(userlist->users, user); + msn_user_unref(user); } MsnUser * @@ -287,7 +290,7 @@ MsnUser * msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid) { - GList *l; + GList *l; g_return_val_if_fail(uid != NULL, NULL);
--- a/libpurple/protocols/msn/userlist.h Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/protocols/msn/userlist.h Tue Mar 01 06:24:50 2011 +0000 @@ -73,7 +73,7 @@ MsnUser * msn_userlist_find_user(MsnUserList *userlist, const char *passport); MsnUser * msn_userlist_find_add_user(MsnUserList *userlist, - const char *passport, const char *userName); + const char *passport, const char *friendly_name); MsnUser * msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid); MsnUser * msn_userlist_find_user_with_mobile_phone(MsnUserList *userlist, const char *number);
--- a/libpurple/tests/test_util.c Tue Mar 01 06:23:34 2011 +0000 +++ b/libpurple/tests/test_util.c Tue Mar 01 06:24:50 2011 +0000 @@ -90,7 +90,9 @@ "a@singleLetterLocal.org", "singleLetterDomain@x.org", "&*=?^+{}'~@validCharsInLocal.net", - "foor@bar.newTLD" + "foor@bar.newTLD", + "HenryTheGreatWhiteCricket@live.ca", + "HenryThe__WhiteCricket@hotmail.com" }; const char *invalid_emails[] = {