[JDEV] mod_mymod.c

Rodolphe Duge de Bernonville rod at idealx.com
Fri Dec 8 05:53:37 CST 2000


Dennis Noordsij a écrit :
> 
> 
> 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.
> 

jpacket are packets inside jsm ...
dpacket are packets inside jabberd ...


what you want to do here is to deliver your packet to another
instance in jabberd :

First, your instance must be registered with a "register_instance" 
(that may 
be done automatically if you are using the <accept> tag ).

Second, just create the xmlnode you want to send to your instance (here 
I suppose msg is your xmlnode )
and send it  with the "deliver" function ... 


you can also wrap your packet into a <route> tag if you dont
want to modify the "from" and "to" attributes of your packet 
  

js_mapi_session(es_END, m->s, mod_pub_logout_handler, NULL);


mreturn mod_example_logout_handler(mapi m, void *arg)
{
    xmlnode msg;

    msg = xmlnode_new_tag("message");
    xmlnode_put_attrib(msg, "from", jid_full(m->packet->from)); 
    xmlnode_put_attrib(msg, "to", NAME_OF_YOUR_INSTANCE);

    deliver(dpacket_new(msg), m->si->i);
  
    xmlnode_free(msg);
  
    return M_PASS;
}




More information about the JDev mailing list