diff libpurple/protocols/jabber/disco.c @ 17610: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 f88b3a093cba
children 22c848c81ccd
line wrap: on
line diff
--- a/libpurple/protocols/jabber/disco.c	Sat Jun 23 02:57:21 2007 +0000
+++ b/libpurple/protocols/jabber/disco.c	Mon Jun 25 19:08:16 2007 +0000
@@ -281,6 +281,11 @@
 	gpresence = purple_account_get_presence(js->gc->account);
 	status = purple_presence_get_active_status(gpresence);
 	jabber_presence_send(js->gc->account, status);
+	
+	if (js->server_caps & JABBER_CAP_ADHOC) {
+		/* The server supports ad-hoc commands, so let's request the list */
+		jabber_adhoc_server_get_list(js);
+	}
 }
 
 static void
@@ -346,6 +351,8 @@
 		} else if (!strcmp("google:roster", var)) {
 			js->server_caps |= JABBER_CAP_GOOGLE_ROSTER;
 			jabber_google_roster_init(js);
+		} else if (!strcmp("http://jabber.org/protocol/commands", var)) {
+			js->server_caps |= JABBER_CAP_ADHOC;
 		}
 	}