[JDEV] mod_mymod.c
Rodolphe Duge de Bernonville
rod at idealx.com
Fri Dec 8 07:50:23 CST 2000
>
> Hi again,
>
> Got that bit working, really cool effects going on now, just one more question
>
> If my instance receives a message and it would like to store the message in
> the offline storage (ie only notify the user of the message but not send the
> message itself) - how would that go?
>
> Encapsulate the message into jabber:x:offline ?
>
well, i dont really see what you mean ...
but you can send directly your message to the offline storage ...
register your function with register_phandler
to be in jabberd's instance list
your_function_in_your_instance_whatever_you_want_to_do_but_i_dont_really_understand(instance
id, dpacket dp, void *arg))
{
ssi si = (ssi) arg;
xmlnode msg;
/* xmlnode sent to your instance is in dp->x */
... stuff with your xmlnode ....
xdb_set(si->xc, server_of_your_user, jid_of_your_user, NS_OFFLINE,
msg);
/* returns 1 if ok ... 0 for bad args
NS_OFFLINE is in jabber.h
*/
xmlnode_free(msg);
}
this would put the msg xmlnode you ve built to your database.
If you want to notify user for it you may try
to send him a message (no idea if it will work ...)
your_function_in_your_instance__whatever_you_want_to_do_but_maybe_it_is_what_you_need(instance
id, dpacket dp, void *arg))
{
xmlnode msg;
xmlnode notify;
/* xmlnode sent to your instance is in dp->x */
... stuff with your xmlnode ....
xdb_set(si->xc, server_of_your_user, jid_of_your_user, NS_OFFLINE,
msg);
/* returns 1 if ok ... 0 for bad args */
notify = xmlnode_new_tag("message");
xmlnode_put_attrib(notify, "to", jid_of_your_user);
... insert stuff in your message ...
deliver (dpacket_new(notify), si->i);
xmlnode_free(msg);
return M_PASS / M_HANDLED;
}
More information about the JDev
mailing list