Mercurial > pidgin
changeset 25827:0e08c847517d
Update some casts (that the script didn't fix correctly) to GObject macros.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 14 Nov 2008 05:32:35 +0000 |
parents | d1a4088528ce |
children | c3ca613ab550 |
files | finch/gntblist.c finch/gntconv.c finch/plugins/grouping.c libpurple/blist.c libpurple/plugins/autoaccept.c libpurple/plugins/tcl/tcl_cmds.c pidgin/gtkblist.c pidgin/gtkconv.c |
diffstat | 8 files changed, 45 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntblist.c Fri Nov 14 02:26:28 2008 +0000 +++ b/finch/gntblist.c Fri Nov 14 05:32:35 2008 +0000 @@ -357,7 +357,7 @@ int color = 0; if (PURPLE_BLIST_NODE_IS_CONTACT(node)) - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); + node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) return 0; @@ -388,7 +388,7 @@ if (fnode && fnode->signed_timer) flag |= GNT_TEXT_FLAG_BLINK; else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact *)node); + node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); fnode = FINCH_GET_DATA(node); if (fnode && fnode->signed_timer) flag |= GNT_TEXT_FLAG_BLINK; @@ -886,7 +886,7 @@ const char *name = NULL; if (PURPLE_BLIST_NODE_IS_CONTACT(node)) - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); /* XXX: this can return NULL?! */ + node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); /* XXX: this can return NULL?! */ if (node == NULL) return NULL; @@ -1027,7 +1027,7 @@ return; if (PURPLE_BLIST_NODE_IS_CONTACT(node)) - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); + node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { @@ -1571,8 +1571,8 @@ ggblist->tagged = g_list_prepend(ggblist->tagged, node); } if (PURPLE_BLIST_NODE_IS_CONTACT(node)) - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) + update_buddy_display(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)), ggblist); + else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) update_buddy_display((PurpleBuddy*)node, ggblist); else update_node_display(node, ggblist); @@ -1612,7 +1612,7 @@ purple_blist_add_group((PurpleGroup*)node, (PurpleBlistNode*)tg); } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { update_buddy_display(purple_contact_get_priority_buddy((PurpleContact*)node), ggblist); - if ((PurpleBlistNode*)tg == target) { + if (PURPLE_BLIST_NODE(tg) == target) { /* The target is a group, just add the contact to the group. */ purple_blist_add_contact((PurpleContact*)node, tg, NULL); } else if (tc) { @@ -1624,7 +1624,7 @@ } } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { update_buddy_display((PurpleBuddy*)node, ggblist); - if ((PurpleBlistNode*)tg == target) { + if (PURPLE_BLIST_NODE(tg) == target) { /* The target is a group. Add this buddy in a new contact under this group. */ purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL); } else if (PURPLE_BLIST_NODE_IS_CONTACT(target)) { @@ -1639,7 +1639,7 @@ } } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { update_node_display(node, ggblist); - if ((PurpleBlistNode*)tg == target) + if (PURPLE_BLIST_NODE(tg) == target) purple_blist_add_chat((PurpleChat*)node, tg, NULL); else purple_blist_add_chat((PurpleChat*)node, NULL, target); @@ -1685,7 +1685,7 @@ create_group_menu(GNT_MENU(context), NULL); title = g_strdup(_("Buddy List")); } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - ggblist->cnode = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); + ggblist->cnode = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode); title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { @@ -2412,8 +2412,8 @@ switch (purple_blist_node_get_type(n1)) { case PURPLE_BLIST_CONTACT_NODE: - n1 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n1); - n2 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n2); + n1 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n1))); + n2 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n2))); /* now compare the presence of the priority buddies */ case PURPLE_BLIST_BUDDY_NODE: ret = purple_presence_compare(purple_buddy_get_presence((PurpleBuddy*)n1),
--- a/finch/gntconv.c Fri Nov 14 02:26:28 2008 +0000 +++ b/finch/gntconv.c Fri Nov 14 05:32:35 2008 +0000 @@ -530,7 +530,7 @@ gnt_menuitem_set_submenu(item, GNT_MENU(sub)); for (; buds; buds = g_slist_delete_link(buds, buds)) { - PurpleBlistNode *node = (PurpleBlistNode *)purple_buddy_get_contact((PurpleBuddy *)buds->data); + PurpleBlistNode *node = PURPLE_BLIST_NODE(purple_buddy_get_contact(PURPLE_BUDDY(buds->data))); for (node = purple_blist_node_get_first_child(node); node != NULL; node = purple_blist_node_get_sibling_next(node)) { PurpleBuddy *buddy = (PurpleBuddy *)node;
--- a/finch/plugins/grouping.c Fri Nov 14 02:26:28 2008 +0000 +++ b/finch/plugins/grouping.c Fri Nov 14 05:32:35 2008 +0000 @@ -87,7 +87,7 @@ switch (purple_blist_node_get_type(node)) { case PURPLE_BLIST_CONTACT_NODE: - node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); + node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); ret = PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) ? &online : &offline; break; case PURPLE_BLIST_BUDDY_NODE:
--- a/libpurple/blist.c Fri Nov 14 02:26:28 2008 +0000 +++ b/libpurple/blist.c Fri Nov 14 05:32:35 2008 +0000 @@ -813,6 +813,7 @@ PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); PurplePresence *presence; PurpleStatus *status; + PurpleBlistNode *cnode; g_return_if_fail(buddy != NULL); @@ -827,16 +828,18 @@ purple_signal_emit(purple_blist_get_handle(), "buddy-signed-on", buddy); - ((PurpleContact*)((PurpleBlistNode*)buddy)->parent)->online++; - if (((PurpleContact*)((PurpleBlistNode*)buddy)->parent)->online == 1) - ((PurpleGroup *)((PurpleBlistNode *)buddy)->parent->parent)->online++; + cnode = buddy->node.parent; + if (++(PURPLE_CONTACT(cnode)->online) == 1) + PURPLE_GROUP(cnode->parent)->online++; } else if (!purple_status_is_online(status) && purple_status_is_online(old_status)) { + purple_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); purple_signal_emit(purple_blist_get_handle(), "buddy-signed-off", buddy); - ((PurpleContact*)((PurpleBlistNode*)buddy)->parent)->online--; - if (((PurpleContact*)((PurpleBlistNode*)buddy)->parent)->online == 0) - ((PurpleGroup *)((PurpleBlistNode *)buddy)->parent->parent)->online--; + + cnode = buddy->node.parent; + if (--(PURPLE_CONTACT(cnode)->online) == 0) + PURPLE_GROUP(cnode->parent)->online--; } else { purple_signal_emit(purple_blist_get_handle(), "buddy-status-changed", buddy, old_status, @@ -1389,7 +1392,7 @@ g = (PurpleGroup*)node->parent->parent; } else if (contact) { c = contact; - g = (PurpleGroup *)((PurpleBlistNode *)c)->parent; + g = PURPLE_GROUP(PURPLE_BLIST_NODE(c)->parent); } else { g = group; if (g == NULL) @@ -1471,16 +1474,14 @@ } if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - ((PurpleContact*)bnode->parent)->online++; - if (((PurpleContact*)bnode->parent)->online == 1) - ((PurpleGroup*)bnode->parent->parent)->online++; + if (++(PURPLE_CONTACT(bnode->parent)->online) == 1) + PURPLE_GROUP(bnode->parent->parent)->online++; } if (purple_account_is_connected(buddy->account)) { - ((PurpleContact*)bnode->parent)->currentsize++; - if (((PurpleContact*)bnode->parent)->currentsize == 1) - ((PurpleGroup*)bnode->parent->parent)->currentsize++; + if (++(PURPLE_CONTACT(bnode->parent)->currentsize) == 1) + PURPLE_GROUP(bnode->parent->parent)->currentsize++; } - ((PurpleContact*)bnode->parent)->totalsize++; + PURPLE_CONTACT(bnode->parent)->totalsize++; hb = g_new(struct _purple_hbuddy, 1); hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); @@ -1596,7 +1597,7 @@ g_return_if_fail(contact != NULL); g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT((PurpleBlistNode*)contact)); - if ((PurpleBlistNode*)contact == node) + if (PURPLE_BLIST_NODE(contact) == node) return; if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || @@ -2341,7 +2342,7 @@ { g_return_val_if_fail(buddy != NULL, NULL); - return (PurpleContact*)((PurpleBlistNode*)buddy)->parent; + return PURPLE_CONTACT(PURPLE_BLIST_NODE(buddy)->parent); } PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy)
--- a/libpurple/plugins/autoaccept.c Fri Nov 14 02:26:28 2008 +0000 +++ b/libpurple/plugins/autoaccept.c Fri Nov 14 05:32:35 2008 +0000 @@ -95,7 +95,7 @@ char *dirname; account = xfer->account; - node = (PurpleBlistNode *)purple_find_buddy(account, xfer->who); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); if (!node) {
--- a/libpurple/plugins/tcl/tcl_cmds.c Fri Nov 14 02:26:28 2008 +0000 +++ b/libpurple/plugins/tcl/tcl_cmds.c Fri Nov 14 05:32:35 2008 +0000 @@ -401,9 +401,9 @@ return NULL; if (!strcmp(type, "buddy")) { - node = (PurpleBlistNode *)purple_find_buddy(account, name); + node = PURPLE_BLIST_NODE(purple_find_buddy(account, name)); } else if (!strcmp(type, "group")) { - node = (PurpleBlistNode *)purple_blist_find_chat(account, name); + node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, name)); } return node;
--- a/pidgin/gtkblist.c Fri Nov 14 02:26:28 2008 +0000 +++ b/pidgin/gtkblist.c Fri Nov 14 05:32:35 2008 +0000 @@ -2532,7 +2532,7 @@ node = g_value_get_pointer(&val); if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) { - PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? (PurpleBuddy*)node : purple_contact_get_priority_buddy((PurpleContact*)node); + PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); pidgin_dnd_file_manage(sd, b->account, b->name); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else { @@ -3843,9 +3843,9 @@ } /* XXX Good luck cleaning up this crap */ - contact = (PurpleContact*)((PurpleBlistNode*)b)->parent; + contact = PURPLE_CONTACT(PURPLE_BLIST_NODE(b)->parent); if(contact) - gtkcontactnode = ((PurpleBlistNode*)contact)->ui_data; + gtkcontactnode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(contact)); /* Name */ if (gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
--- a/pidgin/gtkconv.c Fri Nov 14 02:26:28 2008 +0000 +++ b/pidgin/gtkconv.c Fri Nov 14 05:32:35 2008 +0000 @@ -201,11 +201,11 @@ switch (purple_conversation_get_type(conv)) { case PURPLE_CONV_TYPE_IM: - node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name); + node = PURPLE_BLIST_NODE(purple_find_buddy(conv->account, conv->name)); node = node ? node->parent : NULL; break; case PURPLE_CONV_TYPE_CHAT: - node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name); + node = PURPLE_BLIST_NODE(purple_blist_find_chat(conv->account, conv->name)); break; default: break; @@ -3858,7 +3858,7 @@ { PurpleBlistNode *node; - node = (PurpleBlistNode *) purple_buddy_get_contact((PurpleBuddy *)l->data); + node = PURPLE_BLIST_NODE(purple_buddy_get_contact(PURPLE_BUDDY(l->data))); for (node = node->child; node != NULL; node = node->next) { @@ -5041,9 +5041,9 @@ static PidginConversation * pidgin_conv_find_gtkconv(PurpleConversation * conv) { - PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name), *b; + PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name); PurpleContact *c; - PurpleBlistNode *cn; + PurpleBlistNode *cn, *bn; if (!bud) return NULL; @@ -5051,8 +5051,9 @@ if (!(c = purple_buddy_get_contact(bud))) return NULL; - cn = (PurpleBlistNode *)c; - for (b = (PurpleBuddy *)cn->child; b; b = (PurpleBuddy *) ((PurpleBlistNode *)b)->next) { + cn = PURPLE_BLIST_NODE(c); + for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) { + PurpleBuddy *b = PURPLE_BUDDY(bn); PurpleConversation *conv; if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) { if (conv->ui_data)