[JDEV] mod_mymod.c

Dennis Noordsij dennis.noordsij at wiral.com
Fri Dec 8 04:32:12 CST 2000


Hi,

After having played with jabber enough to feel comfortable enough to try my 
luck at writing a mod_mymod.c module to add some some functionality (please 
don't tell me if there is already an easy way to do this :-)

The module register for session packets, start and ends.

>From the jabberd -d debug output from the module I can see the handlers get 
called at the right times. That's good :-)

What I want to do is this:
when a session ends, I want to send a packet (doesn't even matter what it 
looks like) to another instance (one that has connected via a tcp/ip socket, 
lets call it "myinstance") and carries as a payload the username of the user 
that disconnected. (not even the whole jid is necessary).

The m->s->x xmlnode is empty in the session end handler, but the 
m->s->presence xmlnode contains the full jid. So if I could send this jid to 
the other instance that would be cool :-)

x = m->s->presence
x = xmlnode_wrap(x, "route");
xmlnode_put_attrib(x, "to", "myinstance");

But there are jpackets and dpackets and several delivery mechanisms, all I 
want is for "myinstance" to receive a packet of the form

<presence from="dennis at mydomain/blah" type="unavailable"/>

Or encapsulated in <route> tags, thats all fine.

All the work in mod_mymod is done, (handling multiple resources online for a 
single user, etc) - the only thing not working is sending the packet to 
myinstance.

Any help appreciated :-)
Regards, 
Dennis

PS Keith thanks for the clarification on the MIO bit.




More information about the JDev mailing list