diff libpurple/protocols/jabber/jabber.c @ 17883:9a19c46adf66

The server's ad-hoc commands are now listed in the account's action menu. Note that this requires an additional field in the _PurplePluginAction struct. There's no other way, since there was no way to supply user_data, and dynamically created functions are not supported by C. This should be fine, since that struct is only malloced in purple_plugin_action_new, which is part of the core. Applications have to either pass the struct unmodified, or restore the user_data pointer if the action is recreated when necessary (as is the case in Adium).
author Andreas Monitzer <pidgin@monitzer.com>
date Mon, 25 Jun 2007 19:08:16 +0000
parents a8b1159fd95b
children b8de63d3bf89
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Jun 23 02:57:21 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Jun 25 19:08:16 2007 +0000
@@ -55,6 +55,7 @@
 #include "si.h"
 #include "xdata.h"
 #include "pep.h"
+#include "adhoccommands.h"
 
 #include <assert.h>
 
@@ -1115,6 +1116,14 @@
 #endif
 	if(js->serverFQDN)
 		g_free(js->serverFQDN);
+	while(js->commands) {
+		JabberAdHocCommands *cmd = js->commands->data;
+		g_free(cmd->jid);
+		g_free(cmd->node);
+		g_free(cmd->node);
+		g_free(cmd);
+		js->commands = g_list_delete_link(js->commands, js->commands);
+	}
 	g_free(js->server_name);
 	g_free(js->gmail_last_time);
 	g_free(js->gmail_last_tid);
@@ -1632,6 +1641,9 @@
 
 	if(js->pep)
 		jabber_pep_init_actions(&m);
+	
+	if(js->commands)
+		jabber_adhoc_init_server_commands(js, &m);
 
 	return m;
 }