[JDEV] Newbie questions

Rodolphe Duge de Bernonville rod at idealx.com
Wed Jun 13 05:44:51 CDT 2001


David Soulayrol a écrit :
> 
> Hi.
> 
> I'm a french newbie with Jabber and didn't find some answers in the
> documents presents on the web.
> 
> I don't understand what is the job of 'js_session_to' or
> 'js_session_from'. More precisely, i'm trying to understand how the
> 'mod_presence' module runs. Can someone help me ?
> 

salut !
(en anglais maintenant ... :)

js_session_from and js_session_to are both functions of the jsm 
(jabber session manager), they will send and receive packet
from/to jabberd (ie other instance, mainly pthsock_client)
from/to the session of the client located in jsm.

if you look at the code, you see that js_session_from/to are just 
wrap function that in fact send the function _js_session_from/to
to mtq (but ... thats not your question ..)

so you need to watch these functions to understand how it works.

_js_session_to will try to deliver a jpacket to a session in jsm
(will try to run callback register in es_IN phase).

_js_session_from will try to send a jpacket from a session in jsm
(modules in es_OUT, to other instances in jabber).

in mod_presence these functions will be use to deliver tour presence
to people in your roster ...
the problem is that people in your roster
may not be on your jabber server not even on a jabber server (its may be
a transport, other jabber server), so you need to send them your 
presence packet with a js_session_from because this packet may need
to be delivered to other instances.

js_session_from call js_deliver which will see
if packet are for jsm or other instances. If for jsm
it will call the modules in es_DELIVER phase (==> mod_presence_deliver)
mod_presence_deliver send to the packet to the session of the people
in your roster via js_session_to.

js_session_to will call the handler in es_IN phase and finally route it
to c2s which will write it to the client socket.


so it was long and confuse, and the name of the functions are not very
well chosen
but
js_session_from = all packets coming from the client.
js_session_to = all packets arriving from other client and that may be
writed on socket

Ouf!



More information about the JDev mailing list