Mercurial > pidgin
changeset 26665:60b39347b59c
merge of '6b905c49eee1ae5e6722251efa90cfd92d1fd557'
and 'f8e29008581f125525301f7a98874c63847b2c29'
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Wed, 25 Mar 2009 02:13:30 +0000 |
parents | 7c2506045671 (current diff) 4f6228f14461 (diff) |
children | e7f300fde262 |
files | |
diffstat | 27 files changed, 121 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Fri Mar 20 00:34:17 2009 +0000 +++ b/COPYRIGHT Wed Mar 25 02:13:30 2009 +0000 @@ -8,6 +8,7 @@ Dave Ahlswede Manuel Amador Matt Amato +Josef Andrysek Geoffrey Antos Daniel Atallah Paul Aurich
--- a/ChangeLog Fri Mar 20 00:34:17 2009 +0000 +++ b/ChangeLog Wed Mar 25 02:13:30 2009 +0000 @@ -4,6 +4,8 @@ General: * Theme support in libpurple thanks to Justin Rodriguez's summer of code project. With some minor additions and clean ups from Paul Aurich. + * It should no longer be possible to end up with duplicates of buddies + in a group on the buddy list. XMPP: * Add support for in-band bytestreams for file transfers (XEP-0047).
--- a/ChangeLog.API Fri Mar 20 00:34:17 2009 +0000 +++ b/ChangeLog.API Wed Mar 25 02:13:30 2009 +0000 @@ -30,10 +30,10 @@ Changed: * xmlnode_remove_attrib now removes all attributes with the - same name. Previously, it would remove the first one found, - which was completely non-deterministic. If you want to remove - the attribute with no namespace, then use NULL with - xmlnode_remove_with_namespace. + same name. Previously, it would remove the first one found, + which was completely non-deterministic. If you want to remove + the attribute with no namespace, then use NULL with + xmlnode_remove_with_namespace. Deprecated: * purple_buddy_get_local_alias
--- a/finch/gntblist.c Fri Mar 20 00:34:17 2009 +0000 +++ b/finch/gntblist.c Wed Mar 25 02:13:30 2009 +0000 @@ -643,10 +643,14 @@ purple_blist_add_group(grp, NULL); } - /* XXX: Ask if there's already the same buddy in the same group (#4553) */ - - buddy = purple_buddy_new(account, username, alias); - purple_blist_add_buddy(buddy, NULL, grp, NULL); + /* XXX: Ask to merge if there's already a buddy with the same alias in the same group (#4553) */ + + if ((buddy = purple_find_buddy_in_group(account, username, grp)) == NULL) + { + buddy = purple_buddy_new(account, username, alias); + purple_blist_add_buddy(buddy, NULL, grp, NULL); + } + purple_account_add_buddy(account, buddy); }
--- a/finch/gntlog.c Fri Mar 20 00:34:17 2009 +0000 +++ b/finch/gntlog.c Wed Mar 25 02:13:30 2009 +0000 @@ -66,7 +66,7 @@ g_str_hash(purple_account_get_username(viewer->account)); } - return (guint)viewer; + return g_direct_hash(viewer); } static gboolean log_viewer_equal(gconstpointer y, gconstpointer z)
--- a/finch/gntplugin.c Fri Mar 20 00:34:17 2009 +0000 +++ b/finch/gntplugin.c Wed Mar 25 02:13:30 2009 +0000 @@ -484,10 +484,10 @@ char *value = NULL; switch(type) { case PURPLE_PREF_BOOLEAN: - value = g_strdup_printf("%d", (int)list->next->data); + value = g_strdup_printf("%d", GPOINTER_TO_INT(list->next->data)); break; case PURPLE_PREF_INT: - value = g_strdup_printf("%d", (int)list->next->data); + value = g_strdup_printf("%d", GPOINTER_TO_INT(list->next->data)); break; case PURPLE_PREF_STRING: value = g_strdup(list->next->data);
--- a/finch/gntroomlist.c Fri Mar 20 00:34:17 2009 +0000 +++ b/finch/gntroomlist.c Wed Mar 25 02:13:30 2009 +0000 @@ -190,7 +190,7 @@ label = g_strdup(iter->data ? "True" : "False"); break; case PURPLE_ROOMLIST_FIELD_INT: - label = g_strdup_printf("%d", (int)iter->data); + label = g_strdup_printf("%d", GPOINTER_TO_INT(iter->data)); break; case PURPLE_ROOMLIST_FIELD_STRING: label = g_strdup(iter->data);
--- a/libpurple/circbuffer.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/circbuffer.c Wed Mar 25 02:13:30 2009 +0000 @@ -68,7 +68,8 @@ /* If the fill pointer is wrapped to before the remove * pointer, we need to shift the data */ - if (in_offset < out_offset) { + if (in_offset < out_offset + || (in_offset == out_offset && buf->bufused > 0)) { int shift_n = MIN(buf->buflen - start_buflen, in_offset); memcpy(buf->buffer + start_buflen, buf->buffer,
--- a/libpurple/protocols/irc/irc.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/irc/irc.c Wed Mar 25 02:13:30 2009 +0000 @@ -565,7 +565,7 @@ struct irc_conn *irc = (struct irc_conn *)gc->proto_data; struct irc_buddy *ib = g_new0(struct irc_buddy, 1); ib->name = g_strdup(purple_buddy_get_name(buddy)); - g_hash_table_insert(irc->buddies, ib->name, ib); + g_hash_table_replace(irc->buddies, ib->name, ib); /* if the timer isn't set, this is during signon, so we don't want to flood * ourself off with ISON's, so we don't, but after that we want to know when
--- a/libpurple/protocols/msn/notification.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Mar 25 02:13:30 2009 +0000 @@ -1609,7 +1609,7 @@ if ( (root = xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL) { - purple_debug_error("msn", "Unable to parse GCF payload into a XML tree"); + purple_debug_error("msn", "Unable to parse GCF payload into a XML tree\n"); return; } @@ -1682,7 +1682,7 @@ user = msn_userlist_find_user(session->userlist, passport); if (user == NULL) { char *str = g_strndup(payload, len); - purple_debug_info("msn", "unknown user %s, payload is %s", + purple_debug_info("msn", "unknown user %s, payload is %s\n", passport, str); g_free(str); return;
--- a/libpurple/protocols/msn/oim.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/msn/oim.c Wed Mar 25 02:13:30 2009 +0000 @@ -174,7 +174,7 @@ gchar *faultcode_str = xmlnode_get_data(faultcode); if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { - purple_debug_warning("msn", "OIM Request Error, Updating token now."); + purple_debug_warning("msn", "OIM Request Error, Updating token now.\n"); msn_nexus_update_token(data->oim->session->nexus, data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB, (GSourceFunc)msn_oim_request_helper, data); @@ -183,7 +183,7 @@ } else if (faultcode_str && g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { if (xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) { - purple_debug_warning("msn", "OIM Request Error, Updating token now."); + purple_debug_warning("msn", "OIM Request Error, Updating token now.\n"); msn_nexus_update_token(data->oim->session->nexus, data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB, (GSourceFunc)msn_oim_request_helper, data);
--- a/libpurple/protocols/msn/state.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/msn/state.c Wed Mar 25 02:13:30 2009 +0000 @@ -169,7 +169,7 @@ } currentmediaNode = xmlnode_get_child(payloadNode, "CurrentMedia"); if (currentmediaNode == NULL) { - purple_debug_info("msn", "No CurrentMedia Node"); + purple_debug_info("msn", "No CurrentMedia Node\n"); xmlnode_free(payloadNode); return NULL; } @@ -195,7 +195,7 @@ } psmNode = xmlnode_get_child(payloadNode, "PSM"); if (psmNode == NULL) { - purple_debug_info("msn", "No PSM status Node"); + purple_debug_info("msn", "No PSM status Node\n"); xmlnode_free(payloadNode); return NULL; }
--- a/libpurple/protocols/msn/switchboard.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/msn/switchboard.c Wed Mar 25 02:13:30 2009 +0000 @@ -590,7 +590,7 @@ payload = msn_message_gen_payload(msg, &payload_len); #ifdef MSN_DEBUG_SB - purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}", payload_len); + purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); msn_message_show_readable(msg, "SB SEND", FALSE); #endif
--- a/libpurple/protocols/msn/userlist.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/msn/userlist.c Wed Mar 25 02:13:30 2009 +0000 @@ -858,7 +858,7 @@ } if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!", who); + purple_debug_error("msn", "User %s not found!\n", who); return FALSE; } @@ -887,7 +887,7 @@ } if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!", who); + purple_debug_error("msn", "User %s not found!\n", who); return FALSE; }
--- a/libpurple/protocols/myspace/myspace.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.c Wed Mar 25 02:13:30 2009 +0000 @@ -388,7 +388,7 @@ g_return_val_if_fail(buddy != NULL, NULL); - user = msim_get_user_from_buddy(buddy); + user = msim_get_user_from_buddy(buddy, TRUE); account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); @@ -436,7 +436,7 @@ g_return_if_fail(buddy != NULL); g_return_if_fail(user_info != NULL); - user = msim_get_user_from_buddy(buddy); + user = msim_get_user_from_buddy(buddy, TRUE); if (PURPLE_BUDDY_IS_ONLINE(buddy)) { MsimSession *session; @@ -1053,7 +1053,7 @@ g_free(display_name); /* 3. Update buddy information */ - user = msim_get_user_from_buddy(buddy); + user = msim_get_user_from_buddy(buddy, TRUE); user->id = uid; /* Keep track of the user ID across sessions */ @@ -1377,7 +1377,7 @@ buddy = purple_buddy_new(session->account, username, NULL); purple_blist_add_buddy(buddy, NULL, NULL, NULL); - user = msim_get_user_from_buddy(buddy); + user = msim_get_user_from_buddy(buddy, TRUE); user->id = msim_msg_get_integer(msg, "f"); /* Keep track of the user ID across sessions */ @@ -2641,6 +2641,9 @@ name = purple_buddy_get_name(buddy); gname = group ? purple_group_get_name(group) : NULL; + if (msim_get_user_from_buddy(buddy, FALSE) != NULL) + return; + purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", name, gname ? gname : "(no group)");
--- a/libpurple/protocols/myspace/user.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/myspace/user.c Wed Mar 25 02:13:30 2009 +0000 @@ -41,10 +41,10 @@ } /** - * Get the MsimUser from a PurpleBuddy, creating it if needed. + * Get the MsimUser from a PurpleBuddy, optionally creating it if needed. */ MsimUser * -msim_get_user_from_buddy(PurpleBuddy *buddy) +msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create) { MsimUser *user; @@ -52,7 +52,8 @@ return NULL; } - if (!(user = purple_buddy_get_protocol_data(buddy))) { + user = purple_buddy_get_protocol_data(buddy); + if (create && !user) { /* No MsimUser for this buddy; make one. */ user = g_new0(MsimUser, 1); @@ -94,7 +95,7 @@ return NULL; } - user = msim_get_user_from_buddy(buddy); + user = msim_get_user_from_buddy(buddy, TRUE); return user; }
--- a/libpurple/protocols/myspace/user.h Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/myspace/user.h Wed Mar 25 02:13:30 2009 +0000 @@ -46,7 +46,7 @@ * initiated from a user lookup. */ typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, const MsimMessage *userinfo, gpointer data); -MsimUser *msim_get_user_from_buddy(PurpleBuddy *buddy); +MsimUser *msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create); void msim_user_free(MsimUser *user); MsimUser *msim_find_user(MsimSession *session, const gchar *username); void msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, MsimUser *user, gboolean full);
--- a/libpurple/protocols/novell/novell.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/novell/novell.c Wed Mar 25 02:13:30 2009 +0000 @@ -2547,7 +2547,7 @@ if (gc == NULL || buddy == NULL || group == NULL) return; - user = (NMUser *) gc->proto_data; + user = (NMUser *) purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -2557,6 +2557,10 @@ if (!user->clist_synched) return; + /* Don't re-add a buddy that is already on our contact list */ + if (nm_find_user_record(user, purple_buddy_get_name(buddy)) != NULL) + return; + contact = nm_create_contact(); nm_contact_set_dn(contact, purple_buddy_get_name(buddy));
--- a/libpurple/protocols/oscar/oscar.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/oscar/oscar.c Wed Mar 25 02:13:30 2009 +0000 @@ -4917,17 +4917,24 @@ return; } - if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY))) { - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s\n", bname, gname); - aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); - - /* Mobile users should always be online */ - if (bname[0] == '+') { - purple_prpl_got_user_status(account, - bname, OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - bname, OSCAR_STATUS_ID_MOBILE, NULL); + if (od->ssi.received_data) { + if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { + purple_debug_info("oscar", + "ssi: adding buddy %s to group %s\n", bname, gname); + aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); + + /* Mobile users should always be online */ + if (bname[0] == '+') { + purple_prpl_got_user_status(account, bname, + OSCAR_STATUS_ID_AVAILABLE, NULL); + purple_prpl_got_user_status(account, bname, + OSCAR_STATUS_ID_MOBILE, NULL); + } + } else if (aim_ssi_waitingforauth(od->ssi.local, + aim_ssi_itemlist_findparentname(od->ssi.local, bname), + bname)) { + /* Not authorized -- Re-request authorization */ + purple_auth_sendrequest(gc, bname); } }
--- a/libpurple/protocols/silc/buddy.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/silc/buddy.c Wed Mar 25 02:13:30 2009 +0000 @@ -1397,7 +1397,12 @@ void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - silcpurple_add_buddy_i(gc, buddy, FALSE); + /* Don't add if the buddy is already on the list. + * + * SILC doesn't have groups, so we also don't need to do anything + * for a move. */ + if (purple_buddy_get_protocol_data(buddy) == NULL) + silcpurple_add_buddy_i(gc, buddy, FALSE); } void silcpurple_send_buddylist(PurpleConnection *gc)
--- a/libpurple/protocols/silc10/buddy.c Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/protocols/silc10/buddy.c Wed Mar 25 02:13:30 2009 +0000 @@ -1390,7 +1390,12 @@ void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - silcpurple_add_buddy_i(gc, buddy, FALSE); + /* Don't add if the buddy is already on the list. + * + * SILC doesn't have groups, so we don't need to do anything + * for a move. */ + if (purple_buddy_get_protocol_data(buddy) == NULL) + silcpurple_add_buddy_i(gc, buddy, FALSE); } void silcpurple_send_buddylist(PurpleConnection *gc)
--- a/libpurple/prpl.h Fri Mar 20 00:34:17 2009 +0000 +++ b/libpurple/prpl.h Wed Mar 25 02:13:30 2009 +0000 @@ -296,6 +296,14 @@ void (*set_idle)(PurpleConnection *, int idletime); void (*change_passwd)(PurpleConnection *, const char *old_pass, const char *new_pass); + /** + * Add a buddy to a group on the server. + * + * This PRPL function may be called in situations in which the buddy is + * already in the specified group. If the protocol supports + * authorization and the user is not already authorized to see the + * status of \a buddy, \a add_buddy should request authorization. + */ void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups); void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
--- a/pidgin/gtkaccount.c Fri Mar 20 00:34:17 2009 +0000 +++ b/pidgin/gtkaccount.c Wed Mar 25 02:13:30 2009 +0000 @@ -756,10 +756,6 @@ dialog->protocol_frame = NULL; } - if (dialog->prpl_info == NULL || - dialog->prpl_info->protocol_options == NULL) - return; - while (dialog->protocol_opt_entries != NULL) { ProtocolOptEntry *opt_entry = dialog->protocol_opt_entries->data; g_free(opt_entry->setting); @@ -767,6 +763,10 @@ dialog->protocol_opt_entries = g_list_delete_link(dialog->protocol_opt_entries, dialog->protocol_opt_entries); } + if (dialog->prpl_info == NULL || + dialog->prpl_info->protocol_options == NULL) + return; + account = dialog->account; /* Build the protocol options frame. */
--- a/pidgin/gtkblist.c Fri Mar 20 00:34:17 2009 +0000 +++ b/pidgin/gtkblist.c Wed Mar 25 02:13:30 2009 +0000 @@ -6701,14 +6701,27 @@ whoalias = NULL; g = NULL; - if ((grp != NULL) && (*grp != '\0') && ((g = purple_find_group(grp)) == NULL)) + if ((grp != NULL) && (*grp != '\0')) { - g = purple_group_new(grp); - purple_blist_add_group(g, NULL); - } - - b = purple_buddy_new(data->account, who, whoalias); - purple_blist_add_buddy(b, NULL, g, NULL); + if ((g = purple_find_group(grp)) == NULL) + { + g = purple_group_new(grp); + purple_blist_add_group(g, NULL); + } + + b = purple_find_buddy_in_group(data->account, who, g); + } + else if ((b = purple_find_buddy(data->account, who)) != NULL) + { + g = purple_buddy_get_group(b); + } + + if (b == NULL) + { + b = purple_buddy_new(data->account, who, whoalias); + purple_blist_add_buddy(b, NULL, g, NULL); + } + purple_account_add_buddy(data->account, b); /* Offer to merge people with the same alias. */
--- a/pidgin/gtkdialogs.c Fri Mar 20 00:34:17 2009 +0000 +++ b/pidgin/gtkdialogs.c Wed Mar 25 02:13:30 2009 +0000 @@ -189,7 +189,7 @@ {N_("Italian"), "it", "Claudio Satriano", "satriano@na.infn.it"}, {N_("Japanese"), "ja", "Takashi Aihana", "aihana@gnome.gr.jp"}, {N_("Georgian"), "ka", N_("Ubuntu Georgian Translators"), "alexander.didebulidze@stusta.mhn.de"}, - {"Khmer", "km", "Khoem Sokhem", "khoemsokhem@khmeros.info"}, + {N_("Khmer"), "km", "Khoem Sokhem", "khoemsokhem@khmeros.info"}, {N_("Kannada"), "kn", N_("Kannada Translation team"), "translation@sampada.info"}, {N_("Korean"), "ko", "Sushizang", "sushizang@empal.com"}, {N_("Kurdish"), "ku", "Erdal Ronahi", "erdal.ronahi@gmail.com"},
--- a/pidgin/gtkprefs.c Fri Mar 20 00:34:17 2009 +0000 +++ b/pidgin/gtkprefs.c Wed Mar 25 02:13:30 2009 +0000 @@ -2385,14 +2385,12 @@ /* Auto-away stuff */ vbox = pidgin_make_frame(ret, _("Auto-away")); - button = pidgin_prefs_checkbox(_("Change status when _idle"), - "/purple/away/away_when_idle", vbox); - select = pidgin_prefs_labeled_spin_button(vbox, _("_Minutes before becoming idle:"), "/purple/away/mins_before_away", 1, 24 * 60, sg); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(pidgin_toggle_sensitive), select); + + button = pidgin_prefs_checkbox(_("Change status when _idle"), + "/purple/away/away_when_idle", vbox); /* TODO: Show something useful if we don't have any saved statuses. */ menu = pidgin_status_menu(purple_savedstatus_get_idleaway(), G_CALLBACK(set_idle_away)); @@ -2404,7 +2402,6 @@ if (!purple_prefs_get_bool("/purple/away/away_when_idle")) { gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); }
--- a/pidgin/plugins/gevolution/gevo-util.c Fri Mar 20 00:34:17 2009 +0000 +++ b/pidgin/plugins/gevolution/gevo-util.c Wed Mar 25 02:13:30 2009 +0000 @@ -41,8 +41,12 @@ purple_blist_add_group(group, NULL); } - buddy = purple_buddy_new(account, buddy_name, alias); - purple_blist_add_buddy(buddy, NULL, group, NULL); + if ((buddy = purple_find_buddy_in_group(account, buddy_name, group))) + { + buddy = purple_buddy_new(account, buddy_name, alias); + purple_blist_add_buddy(buddy, NULL, group, NULL); + } + purple_account_add_buddy(account, buddy); if (conv != NULL)