gobjectification: f89b36da: Update group creation code in the prpls.
sadrul at pidgin.im
sadrul at pidgin.im
Tue Jul 6 01:57:21 EDT 2010
----------------------------------------------------------------------
Revision: f89b36da5be07f5153a6036edf97a1e5f5789b2f
Parent: 1e6d3dadea74d8d1617a106115b42c10cb6a4c1d
Author: sadrul at pidgin.im
Date: 07/05/10 23:43:25
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/f89b36da5be07f5153a6036edf97a1e5f5789b2f
Changelog:
Update group creation code in the prpls.
purple_group_new returns an existing group (if one exists) with the same
name. So instead of doing:
if (!(group = purple_find_group(name))) {
group = purple_group_new(name);
purple_blist_node_add_child(purple_blist_get_root(),
PURPLE_BLIST_NODE(g));
}
Do:
group = purple_group_new(name);
Keeping it real.
Changes against parent 1e6d3dadea74d8d1617a106115b42c10cb6a4c1d
patched libpurple/protocols/bonjour/buddy.c
patched libpurple/protocols/gg/buddylist.c
patched libpurple/protocols/jabber/roster.c
patched libpurple/protocols/msn/contact.c
patched libpurple/protocols/msn/sync.c
patched libpurple/protocols/msn/user.c
patched libpurple/protocols/mxit/roster.c
patched libpurple/protocols/myspace/myspace.c
patched libpurple/protocols/novell/novell.c
patched libpurple/protocols/oscar/oscar.c
patched libpurple/protocols/yahoo/libymsg.c
patched libpurple/protocols/zephyr/zephyr.c
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c c6d6a79a45f141a8c4c49588416f3fc339f64012
+++ libpurple/protocols/oscar/oscar.c 291f4baffaf14fed6080809fbfe0dc4f41334f6b
@@ -5323,11 +5323,7 @@ static int purple_ssi_parselist(OscarDat
} else
gname_utf8 = NULL;
- g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans"));
- if (g == NULL) {
- g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
+ g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name);
if (alias != NULL) {
@@ -5387,11 +5383,10 @@ static int purple_ssi_parselist(OscarDat
} else
gname_utf8 = NULL;
- if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) {
+ if (gname_utf8 != NULL) {
g = purple_group_new(gname_utf8);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
+ g_free(gname_utf8);
}
- g_free(gname_utf8);
} break;
case AIM_SSI_TYPE_PERMIT: { /* Permit buddy */
@@ -5580,10 +5575,7 @@ purple_ssi_parseaddmod(OscarData *od, Fl
*/
b = purple_buddy_new(account, name, alias_utf8);
- if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
- g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
+ g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
purple_debug_info("oscar",
"ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
============================================================
--- libpurple/protocols/zephyr/zephyr.c 159e828e259b32e0e7c1a0d1d28681ea7466623c
+++ libpurple/protocols/zephyr/zephyr.c 9eb2ff117e605dcf9bbb7e5f2943e860032e6fc7
@@ -1504,10 +1504,7 @@ static void process_anyone(PurpleConnect
PurpleGroup *g;
PurpleBuddy *b;
- if (!(g = purple_find_group(_("Anyone")))) {
- g = purple_group_new(_("Anyone"));
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
+ g = purple_group_new(_("Anyone"));
filename = g_strconcat(purple_home_dir(), "/.anyone", NULL);
if ((fd = g_fopen(filename, "r")) != NULL) {
============================================================
--- libpurple/protocols/yahoo/libymsg.c c866a1f5f1629e6807df3e759f2d39067342851a
+++ libpurple/protocols/yahoo/libymsg.c 1cc25e5e7ab414f740fa7dae838188b12ac2a495
@@ -427,10 +427,7 @@ static void yahoo_do_group_check(PurpleA
if (!onlist) {
purple_debug_misc("yahoo",
"Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
- if (!(g = purple_find_group(group))) {
- g = purple_group_new(group);
- purple_blist_node_add_child(purple_blist_get_root(), PURPLE_BLIST_NODE(g));
- }
+ g = purple_group_new(group);
b = purple_buddy_new(account, name, NULL);
purple_blist_add_buddy(b, NULL, g, NULL);
}
@@ -553,10 +550,7 @@ static void yahoo_process_list_15(Purple
/* This buddy is in a group */
f = yahoo_friend_find_or_new(gc, norm_bud);
if (!(b = purple_find_buddy(account, norm_bud))) {
- if (!(g = purple_find_group(yd->current_list15_grp))) {
- g = purple_group_new(yd->current_list15_grp);
- purple_blist_node_add_child(purple_blist_get_root(), PURPLE_BLIST_NODE(g));
- }
+ g = purple_group_new(yd->current_list15_grp);
b = purple_buddy_new(account, norm_bud, NULL);
purple_blist_add_buddy(b, NULL, g, NULL);
}
@@ -712,10 +706,7 @@ static void yahoo_process_list(PurpleCon
f = yahoo_friend_find_or_new(gc, norm_bud);
if (!(b = purple_find_buddy(account, norm_bud))) {
- if (!(g = purple_find_group(grp))) {
- g = purple_group_new(grp);
- purple_blist_node_add_child(purple_blist_get_root(), PURPLE_BLIST_NODE(g));
- }
+ g = purple_group_new(grp);
b = purple_buddy_new(account, norm_bud, NULL);
purple_blist_add_buddy(b, NULL, g, NULL);
export = TRUE;
============================================================
--- libpurple/protocols/msn/user.c 1cd0693e59a68ba53444bddeeacd7a9eb221d7f6
+++ libpurple/protocols/msn/user.c 67219475db569d6969143934d3011fd7b8ee2fe8
@@ -274,14 +274,7 @@ msn_user_add_group_id(MsnUser *user, con
purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport);
- g = purple_find_group(group_name);
-
- if ((group_id == NULL) && (g == NULL))
- {
- g = purple_group_new(group_name);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
-
+ g = purple_group_new(group_name);
b = purple_find_buddy_in_group(account, passport, g);
if (b == NULL)
{
============================================================
--- libpurple/protocols/jabber/roster.c cd322180dbfdaca78c16db6204bd0803fc7fbf35
+++ libpurple/protocols/jabber/roster.c 817a7b68717664e5b92214df8d284e27eddcd7d9
@@ -171,14 +171,9 @@ static void add_purple_buddy_to_groups(J
}
while(groups) {
- PurpleGroup *g = purple_find_group(groups->data);
+ PurpleGroup *g = purple_group_new(groups->data);
PurpleBuddy *b = purple_buddy_new(account, jid, alias);
- if(!g) {
- g = purple_group_new(groups->data);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
-
purple_blist_add_buddy(b, NULL, g, NULL);
purple_buddy_set_alias(b, alias);
============================================================
--- libpurple/protocols/novell/novell.c e9f4784285f9a07633e2ecfe5f84ecbe50bec506
+++ libpurple/protocols/novell/novell.c a832e3bc9e81767ae11db5acd21b0b8dee23d5ae
@@ -1298,11 +1298,7 @@ _add_contacts_to_purple_blist(NMUser * u
}
/* Does the Purple group exist already? */
- group = purple_find_group(fname);
- if (group == NULL) {
- group = purple_group_new(fname);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(group), purple_blist_get_root());
- }
+ group = purple_group_new(fname);
/* Get each contact for this folder */
cnt = nm_folder_get_contact_count(folder);
============================================================
--- libpurple/protocols/msn/sync.c c9e9a8255c13f028958770b786cff49f5437edb8
+++ libpurple/protocols/msn/sync.c c8c59a021273b5a219715bf43d89f8d21bf62c0c
@@ -113,11 +113,7 @@ lsg_cmd(MsnCmdProc *cmdproc, MsnCommand
return;
}
- if ((purple_find_group(name)) == NULL)
- {
- PurpleGroup *g = purple_group_new(name);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
+ purple_group_new(name);
}
static void
============================================================
--- libpurple/protocols/gg/buddylist.c 0dcba76280511391300df1fafd6a6a9f41495aba
+++ libpurple/protocols/gg/buddylist.c 8dee97bf69c146c149da3c1792bdd85eb3a08b9d
@@ -137,10 +137,7 @@ void ggp_buddylist_load(PurpleConnection
buddy = purple_buddy_new(purple_connection_get_account(gc), name,
strlen(show) ? show : NULL);
- if (!(group = purple_find_group(g))) {
- group = purple_group_new(g);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(group), purple_blist_get_root());
- }
+ group = purple_group_new(g);
purple_blist_add_buddy(buddy, NULL, group, NULL);
g_free(g);
============================================================
--- libpurple/protocols/bonjour/buddy.c 0b363785163f652f863e430704c14826377d8e84
+++ libpurple/protocols/bonjour/buddy.c 87e6dc4f2e5ff32b434cd6b8c71a4569ed9280af
@@ -141,11 +141,7 @@ bonjour_buddy_add_to_purple(BonjourBuddy
*/
/* Make sure the Bonjour group exists in our buddy list */
- group = purple_find_group(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */
- if (group == NULL) {
- group = purple_group_new(BONJOUR_GROUP_NAME);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(group), purple_blist_get_root());
- }
+ group = purple_group_new(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */
/* Make sure the buddy exists in our buddy list */
if (buddy == NULL)
============================================================
--- libpurple/protocols/msn/contact.c 9be13561bb30c71fbc098fb536e02ac2cd4f89f7
+++ libpurple/protocols/msn/contact.c 3b541dd34ee4ebc5c25aee1a658da4902381b026
@@ -609,10 +609,7 @@ msn_parse_addressbook_groups(MsnSession
msn_group_new(session->userlist, group_id, group_name);
purple_debug_info("msn", "AB group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)");
- if ((purple_find_group(group_name)) == NULL) {
- PurpleGroup *g = purple_group_new(group_name);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
- }
+ purple_group_new(group_name);
g_free(group_id);
g_free(group_name);
}
@@ -891,16 +888,14 @@ msn_parse_addressbook(MsnSession *sessio
purple_debug_misc("msn", "AB group_id:%s name:%s\n",
MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME);
if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){
- PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
+ purple_group_new(MSN_INDIVIDUALS_GROUP_NAME);
}
/*add a default No group to set up the no group Membership*/
msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME);
if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) {
- PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME);
- purple_blist_node_add_child(PURPLE_BLIST_NODE(g), purple_blist_get_root());
+ purple_group_new(MSN_NON_IM_GROUP_NAME);
}
/*Process contact List*/
============================================================
--- libpurple/protocols/myspace/myspace.c 12bd68c6c14fea3f70653f9a323f20b184291f9a
+++ libpurple/protocols/myspace/myspace.c 7d43cc918e3796b2c1a7e28d71a76161374aac23
@@ -1018,12 +1018,7 @@ msim_add_contact_from_server_cb(MsimSess
group_name = g_strdup(_("IM Friends"));
purple_debug_info("myspace", "No GroupName specified, defaulting to '%s'.\n", group_name);
}
- group = purple_find_group(group_name);
- if (!group) {
- group = purple_group_new(group_name);
- /* Add group to beginning. See #2752. */
- purple_blist_node_add_child(PURPLE_BLIST_NODE(group), purple_blist_get_root());
- }
+ group = purple_group_new(group_name); /* Add group to beginning. See #2752. */
g_free(group_name);
visibility = msim_msg_get_integer(contact_info, "Visibility");
============================================================
--- libpurple/protocols/mxit/roster.c 8b5604d2f09d4eadaecf062b2f1c5e582f606a93
+++ libpurple/protocols/mxit/roster.c 7f9509242ed837213d479e61ce39e1f284d7e184
@@ -362,9 +362,7 @@ void mxit_update_contact( struct MXitSes
}
/* find or create a group for this contact */
- group = purple_find_group( contact->groupname );
- if ( !group )
- group = purple_group_new( contact->groupname );
+ group = purple_group_new( contact->groupname );
/* see if the buddy is not in the group already */
buddy = purple_find_buddy_in_group( session->acc, contact->username, group );
More information about the Commits
mailing list