Mercurial > pidgin
changeset 24337:7a1d01cc98d8
Fix Tcl to compile with the hidden structs.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 30 Oct 2008 05:40:51 +0000 |
parents | 03c73e917b1b |
children | c06b85e1d020 |
files | libpurple/plugins/tcl/tcl_cmds.c libpurple/plugins/tcl/tcl_signals.c |
diffstat | 2 files changed, 29 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/tcl/tcl_cmds.c Thu Oct 30 03:59:08 2008 +0000 +++ b/libpurple/plugins/tcl/tcl_cmds.c Thu Oct 30 05:40:51 2008 +0000 @@ -414,7 +414,7 @@ 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; - PurpleBuddyList *blist; + PurpleBlistNodeType type; PurpleBlistNode *node, *gnode, *bnode; PurpleAccount *account; PurpleBuddy *bud; @@ -428,6 +428,7 @@ if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) return error; + type = purple_blist_node_get_type(node); switch (cmd) { case CMD_BUDDY_ALIAS: if (objc != 3) { @@ -438,10 +439,10 @@ return error; if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL) return TCL_ERROR; - if (node->type == PURPLE_BLIST_CHAT_NODE) + if (type == PURPLE_BLIST_CHAT_NODE) Tcl_SetObjResult(interp, - Tcl_NewStringObj(((PurpleChat *)node)->alias, -1)); - else if (node->type == PURPLE_BLIST_BUDDY_NODE) + Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); + else if (type == PURPLE_BLIST_BUDDY_NODE) Tcl_SetObjResult(interp, Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1)); return TCL_OK; @@ -494,15 +495,17 @@ } } list = Tcl_NewListObj(0, NULL); - blist = purple_get_blist(); - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) { + for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_get_sibling_next(gnode)) { tclgroup = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, tclgroup, Tcl_NewStringObj("group", -1)); Tcl_ListObjAppendElement(interp, tclgroup, - Tcl_NewStringObj(((PurpleGroup *)gnode)->name, -1)); + Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)gnode), -1)); tclgrouplist = Tcl_NewListObj(0, NULL); - for (node = gnode->child; node != NULL; node = node->next) { - switch (node->type) { + for (node = purple_blist_node_get_first_child(gnode); node != NULL; node = purple_blist_node_get_sibling_next(node)) { + PurpleAccount *account; + + type = purple_blist_node_get_type(node); + switch (type) { case PURPLE_BLIST_CONTACT_NODE: tclcontact = Tcl_NewListObj(0, NULL); Tcl_IncrRefCount(tclcontact); @@ -510,17 +513,18 @@ tclcontactlist = Tcl_NewListObj(0, NULL); Tcl_IncrRefCount(tclcontactlist); count = 0; - for (bnode = node->child; bnode != NULL; bnode = bnode ->next) { - if (bnode->type != PURPLE_BLIST_BUDDY_NODE) + 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) continue; bud = (PurpleBuddy *)bnode; - if (!all && !purple_account_is_connected(bud->account)) + account = purple_buddy_get_account(bud); + if (!all && !purple_account_is_connected(account)) continue; count++; tclbud = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("buddy", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(bud->name, -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, bud->account)); + Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_buddy_get_name(bud), -1)); + Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); Tcl_ListObjAppendElement(interp, tclcontactlist, tclbud); } if (count) { @@ -532,16 +536,17 @@ break; case PURPLE_BLIST_CHAT_NODE: cnode = (PurpleChat *)node; - if (!all && !purple_account_is_connected(cnode->account)) + account = purple_chat_get_account(cnode); + if (!all && !purple_account_is_connected(account)) continue; tclbud = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("chat", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(cnode->alias, -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, cnode->account)); + 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", node->type); + purple_debug(PURPLE_DEBUG_WARNING, "tcl", "Unexpected buddy type %d", type); continue; } }
--- a/libpurple/plugins/tcl/tcl_signals.c Thu Oct 30 03:59:08 2008 +0000 +++ b/libpurple/plugins/tcl/tcl_signals.c Thu Oct 30 05:40:51 2008 +0000 @@ -292,13 +292,13 @@ node = *va_arg(args, PurpleBlistNode **); else node = va_arg(args, PurpleBlistNode *); - switch (node->type) { + switch (purple_blist_node_get_type(node)) { case PURPLE_BLIST_GROUP_NODE: arg = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(handler->interp, arg, Tcl_NewStringObj("group", -1)); Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(((PurpleGroup *)node)->name, -1)); + Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)node), -1)); break; case PURPLE_BLIST_CONTACT_NODE: /* g_string_printf(val, "contact {%s}", Contact Name? ); */ @@ -309,20 +309,20 @@ Tcl_ListObjAppendElement(handler->interp, arg, Tcl_NewStringObj("buddy", -1)); Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(((PurpleBuddy *)node)->name, -1)); + Tcl_NewStringObj(purple_buddy_get_name((PurpleBuddy *)node), -1)); Tcl_ListObjAppendElement(handler->interp, arg, purple_tcl_ref_new(PurpleTclRefAccount, - ((PurpleBuddy *)node)->account)); + purple_buddy_get_account((PurpleBuddy *)node))); break; case PURPLE_BLIST_CHAT_NODE: arg = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(handler->interp, arg, Tcl_NewStringObj("chat", -1)); Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(((PurpleChat *)node)->alias, -1)); + Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); Tcl_ListObjAppendElement(handler->interp, arg, purple_tcl_ref_new(PurpleTclRefAccount, - ((PurpleChat *)node)->account)); + purple_chat_get_account((PurpleChat *)node))); break; case PURPLE_BLIST_OTHER_NODE: arg = Tcl_NewStringObj("other", -1);