Plugin devel - registering a handler for xmpp iq - not working

Michal Witkowski neuro at o2.pl
Wed Nov 19 13:05:03 EST 2008


Hi, 

I'm writing a plugin for libpurple to handle SOAP over XMPP 
(http://xmpp.org/extensions/xep-0072.html). I need it for debugging purposes and later on 
for implementing a WS-Notification consumer.

The draft specifies a way of transporting SOAP messages over XMPP inside IQ stanzas. I've 
taken a look around the source of libpurple and it seems it's possible to do so using 
jabber_iq_register_handler from protocols/jabber/iq.h. This would suit me just fine, as I 
could implement my own handler and respond to the message accordingly.

However, during compilation (make consumer_plugin.so) I get:

/bin/sh ../../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I../.. -
DDATADIR=\"/usr/local/share\" -I../../libpurple -I../../libpurple -Wall  -Waggregate-
return -Wcast-align -Wdeclaration-after-statement -Wendif-labels -Werror-implicit-
function-declaration -Wextra -Wno-sign-compare -Wno-unused-parameter -Winit-self -
Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes -Wpointer-arith -Wundef -
Wp,-D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include    -
I/usr/include/dbus-1.0-I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -
I/usr/lib/glib-2.0/include   -g -g -O2 -c consumer_plugin.c -o tmpconsumer_plugin.so.lo
In file included from ../../libpurple/protocols/jabber/iq.h:25,
                 from consumer_plugin.c:8:
../../libpurple/protocols/jabber/jabber.h:51:27: error: libxml/parser.h: No such file or 
directory
In file included from ../../libpurple/protocols/jabber/iq.h:25,
                 from consumer_plugin.c:8:
../../libpurple/protocols/jabber/jabber.h:88: error: expected specifier-qualifier-list 
before ‘xmlParserCtxt’
consumer_plugin.c:13: warning: return type defaults to ‘int’
consumer_plugin.c: In function ‘plugin_load’:
consumer_plugin.c:22: warning: passing argument 2 of ‘jabber_iq_register_handler’ from 
incompatible pointer type
make: *** [consumer_plugin.so] Error 1



The whole plugin is simple (I've cut the plugin initialization etc):
#include <glib.h>

#include "notify.h"
#include "plugin.h"
#include "version.h"
#include "protocols/jabber/iq.h"
#include "xmlnode.h"            

static PurplePlugin* consumer_plugin = NULL;

static my_handle_iq(JabberStream *js, xmlnode *packet) {
  purple_notify_message(consumer_plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!",
      xmlnode_get_data(packet), NULL, NULL, NULL);                              
}                                                                               

static gboolean
plugin_load(PurplePlugin *plugin) {

    consumer_plugin = plugin;
    jabber_iq_register_handler("env", my_handle_iq);
    return TRUE;                                    
}


Is it possible to call such deep-down protocol methods from inside a plugin? I wanted to 
use the "jabber-receiving-xmlnode" signal, however then the internal iq.c code will return 
feature-not-implemented to the sender, which violates the draft specification. Anyone could 
help me out on this one, please?

Michal




More information about the Devel mailing list