gobjectification: 15ef6801: Fix Tcl plugin with updated PurpleBlistN...
qulogic at pidgin.im
qulogic at pidgin.im
Sun Nov 8 03:30:58 EST 2009
-----------------------------------------------------------------
Revision: 15ef68012c11ecd3d61c7dd50c00263d52a312c0
Ancestor: 0dcd437058e5ff7ed942547e48fb39f1c67c4723
Author: qulogic at pidgin.im
Date: 2009-11-08T03:47:17
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/15ef68012c11ecd3d61c7dd50c00263d52a312c0
Modified files:
libpurple/plugins/tcl/tcl_cmds.c
libpurple/plugins/tcl/tcl_signals.c
ChangeLog:
Fix Tcl plugin with updated PurpleBlistNode stuff. Not as familiar with
these, so I hope this all makes sense.
-------------- next part --------------
============================================================
--- libpurple/plugins/tcl/tcl_cmds.c 3cb55c426d397b38d7f8a8913e6ee745325b6030
+++ libpurple/plugins/tcl/tcl_cmds.c ac39d2f2f86cff8951ba88a4f198932158432478
@@ -413,7 +413,6 @@ int tcl_cmd_buddy(ClientData unused, Tcl
Tcl_Obj *list, *tclgroup, *tclgrouplist, *tclcontact, *tclcontactlist, *tclbud, **elems, *result;
const char *cmds[] = { "alias", "handle", "info", "list", NULL };
enum { CMD_BUDDY_ALIAS, CMD_BUDDY_HANDLE, CMD_BUDDY_INFO, CMD_BUDDY_LIST } cmd;
- PurpleBlistNodeType type;
PurpleBlistNode *node, *gnode, *bnode;
PurpleAccount *account;
PurpleBuddy *bud;
@@ -437,13 +436,12 @@ int tcl_cmd_buddy(ClientData unused, Tcl
return error;
if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL)
return TCL_ERROR;
- type = purple_blist_node_get_type(node);
- if (type == PURPLE_BLIST_CHAT_NODE)
+ if (PURPLE_IS_CHAT(node))
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1));
- else if (type == PURPLE_BLIST_BUDDY_NODE)
+ Tcl_NewStringObj(purple_chat_get_name(PURPLE_CHAT(node)), -1));
+ else if (PURPLE_IS_BUDDY(node))
Tcl_SetObjResult(interp,
- Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1));
+ Tcl_NewStringObj((char *)purple_buddy_get_alias(PURPLE_BUDDY(node)), -1));
return TCL_OK;
break;
case CMD_BUDDY_HANDLE:
@@ -494,28 +492,26 @@ int tcl_cmd_buddy(ClientData unused, Tcl
}
}
list = Tcl_NewListObj(0, NULL);
- for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_get_sibling_next(gnode)) {
+ for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_next(gnode)) {
tclgroup = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(interp, tclgroup, Tcl_NewStringObj("group", -1));
Tcl_ListObjAppendElement(interp, tclgroup,
Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)gnode), -1));
tclgrouplist = Tcl_NewListObj(0, NULL);
- for (node = purple_blist_node_get_first_child(gnode); node != NULL; node = purple_blist_node_get_sibling_next(node)) {
+ for (node = purple_blist_node_first_child(gnode); node != NULL; node = purple_blist_node_next(node)) {
PurpleAccount *account;
- type = purple_blist_node_get_type(node);
- switch (type) {
- case PURPLE_BLIST_CONTACT_NODE:
+ if (PURPLE_IS_CONTACT(node)) {
tclcontact = Tcl_NewListObj(0, NULL);
Tcl_IncrRefCount(tclcontact);
Tcl_ListObjAppendElement(interp, tclcontact, Tcl_NewStringObj("contact", -1));
tclcontactlist = Tcl_NewListObj(0, NULL);
Tcl_IncrRefCount(tclcontactlist);
count = 0;
- for (bnode = purple_blist_node_get_first_child(node); bnode != NULL; bnode = purple_blist_node_get_sibling_next(bnode)) {
- if (purple_blist_node_get_type(bnode) != PURPLE_BLIST_BUDDY_NODE)
+ for (bnode = purple_blist_node_first_child(node); bnode != NULL; bnode = purple_blist_node_next(bnode)) {
+ if (!PURPLE_IS_BUDDY(bnode))
continue;
- bud = (PurpleBuddy *)bnode;
+ bud = PURPLE_BUDDY(bnode);
account = purple_buddy_get_account(bud);
if (!all && !purple_account_is_connected(account))
continue;
@@ -532,9 +528,9 @@ int tcl_cmd_buddy(ClientData unused, Tcl
}
Tcl_DecrRefCount(tclcontact);
Tcl_DecrRefCount(tclcontactlist);
- break;
- case PURPLE_BLIST_CHAT_NODE:
- cnode = (PurpleChat *)node;
+ }
+ else if (PURPLE_IS_CHAT(node)) {
+ cnode = PURPLE_CHAT(node);
account = purple_chat_get_account(cnode);
if (!all && !purple_account_is_connected(account))
continue;
@@ -543,9 +539,10 @@ int tcl_cmd_buddy(ClientData unused, Tcl
Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_chat_get_name(cnode), -1));
Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account));
Tcl_ListObjAppendElement(interp, tclgrouplist, tclbud);
- break;
- default:
- purple_debug(PURPLE_DEBUG_WARNING, "tcl", "Unexpected buddy type %d", type);
+ }
+ else {
+ purple_debug_warning("tcl", "Unexpected buddy type %s",
+ g_type_name(G_OBJECT_TYPE(node)));
continue;
}
}
============================================================
--- libpurple/plugins/tcl/tcl_signals.c 91cf4b0d9ca8e456fc45b853f3b773ca2a6da848
+++ libpurple/plugins/tcl/tcl_signals.c 46a443271384987b69a7133da23c5f752f82b143
@@ -294,41 +294,39 @@ static void *tcl_signal_callback(va_list
node = *va_arg(args, PurpleBlistNode **);
else
node = va_arg(args, PurpleBlistNode *);
- switch (purple_blist_node_get_type(node)) {
- case PURPLE_BLIST_GROUP_NODE:
+ if (PURPLE_IS_GROUP(node)) {
arg = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(handler->interp, arg,
Tcl_NewStringObj("group", -1));
Tcl_ListObjAppendElement(handler->interp, arg,
- Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)node), -1));
- break;
- case PURPLE_BLIST_CONTACT_NODE:
+ Tcl_NewStringObj(purple_group_get_name(PURPLE_GROUP(node)), -1));
+ }
+ else if (PURPLE_IS_CONTACT(node)) {
/* g_string_printf(val, "contact {%s}", Contact Name? ); */
arg = Tcl_NewStringObj("contact", -1);
- break;
- case PURPLE_BLIST_BUDDY_NODE:
+ }
+ else if (PURPLE_IS_BUDDY(node)) {
arg = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(handler->interp, arg,
Tcl_NewStringObj("buddy", -1));
Tcl_ListObjAppendElement(handler->interp, arg,
- Tcl_NewStringObj(purple_buddy_get_name((PurpleBuddy *)node), -1));
+ Tcl_NewStringObj(purple_buddy_get_name(PURPLE_BUDDY(node)), -1));
Tcl_ListObjAppendElement(handler->interp, arg,
purple_tcl_ref_new(PurpleTclRefAccount,
- purple_buddy_get_account((PurpleBuddy *)node)));
- break;
- case PURPLE_BLIST_CHAT_NODE:
+ purple_buddy_get_account(PURPLE_BUDDY(node))));
+ }
+ else if (PURPLE_IS_CHAT(node)) {
arg = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(handler->interp, arg,
Tcl_NewStringObj("chat", -1));
Tcl_ListObjAppendElement(handler->interp, arg,
- Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1));
+ Tcl_NewStringObj(purple_chat_get_name(PURPLE_CHAT(node)), -1));
Tcl_ListObjAppendElement(handler->interp, arg,
purple_tcl_ref_new(PurpleTclRefAccount,
- purple_chat_get_account((PurpleChat *)node)));
- break;
- case PURPLE_BLIST_OTHER_NODE:
+ purple_chat_get_account(PURPLE_CHAT(node))));
+ }
+ else /* FIXME: if (PURPLE_IS_OTHER(node)) ??? */ {
arg = Tcl_NewStringObj("other", -1);
- break;
}
break;
}
More information about the Commits
mailing list