pidgin: 72705438: Fix Tcl to compile with the hidden struc...

rlaager at pidgin.im rlaager at pidgin.im
Thu Oct 30 01:55:38 EDT 2008


-----------------------------------------------------------------
Revision: 72705438ab1c635bd9c55b0eb26637c8bf85ea82
Ancestor: 564818d9f5f6acfd1ce9615576d91ff2069cf99c
Author: rlaager at pidgin.im
Date: 2008-10-30T05:40:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/72705438ab1c635bd9c55b0eb26637c8bf85ea82

Modified files:
        libpurple/plugins/tcl/tcl_cmds.c
        libpurple/plugins/tcl/tcl_signals.c

ChangeLog: 

Fix Tcl to compile with the hidden structs.

-------------- next part --------------
============================================================
--- libpurple/plugins/tcl/tcl_cmds.c	3103e2ca8041f296979f316d9c3b5ff8b216b187
+++ libpurple/plugins/tcl/tcl_cmds.c	6ce941ea4e61f1019cb1b2ee3ec2ef555ef5d65b
@@ -414,7 +414,7 @@ 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;
-	PurpleBuddyList *blist;
+	PurpleBlistNodeType type;
 	PurpleBlistNode *node, *gnode, *bnode;
 	PurpleAccount *account;
 	PurpleBuddy *bud;
@@ -428,6 +428,7 @@ int tcl_cmd_buddy(ClientData unused, Tcl
 	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 @@ int tcl_cmd_buddy(ClientData unused, Tcl
 			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 @@ int tcl_cmd_buddy(ClientData unused, Tcl
 			}
 		}
 		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 @@ int tcl_cmd_buddy(ClientData unused, Tcl
 					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 @@ int tcl_cmd_buddy(ClientData unused, Tcl
 					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;
 				}
 			}
============================================================
--- libpurple/plugins/tcl/tcl_signals.c	b37abf9e185c5cf3832d910a9ee5b44ed327c61b
+++ libpurple/plugins/tcl/tcl_signals.c	51bf25251be26b57609deec47562eff384c96dca
@@ -292,13 +292,13 @@ static void *tcl_signal_callback(va_list
 					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 @@ static void *tcl_signal_callback(va_list
 					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);


More information about the Commits mailing list