process presence show and status

i use ejabberd as my xmpp server

recently i want save presence status information to database,

when user presence show and status.

i just find all files, can't make sure which file to process presence

is there someone can help me ?

thanks.

Maybe mod_logsession, which

Maybe mod_logsession, which is available in ejabberd-modules SVN.

Not mod_logsession

it seems not mod_logsession.
i find that module README.txt say:"
this module is intended to log in a text file the session connections.
Right now it only logs the forbidden connection attempts.
Each vhost is logged in a different file"

i just want find which file process user presence.
such as this xmpp defines:
<presence><show>chat</show><status>i am free to chat</status></presence>
if i know which file process this xml stanza. i can parse status xmlelement cdata "i am free to chat" and save to database.

thanks.

> i just want find which file

> i just want find which file process user presence.

ejabberd_c2s.erl

Maybe ejabberd_c2s.erl

i find ejabberd_c2s.erl have an fun handle_sync_event at line 1001(my ejabberd version is 2.0.2), that maybe it.

but when i change this fun from

handle_sync_event({get_presence}, _From, StateName, StateData) ->
    User = StateData#state.user,
    PresLast = StateData#state.pres_last,

    Show = get_showtag(PresLast),
    Status = get_statustag(PresLast),
    Resource = StateData#state.resource,

    Reply = {User, Resource, Show, Status},
    fsm_reply(Reply, StateName, StateData);

to

handle_sync_event({get_presence}, _From, StateName, StateData) ->
    User = StateData#state.user,
    PresLast = StateData#state.pres_last,

    Show = get_showtag(PresLast),
    Status = get_statustag(PresLast),
    ?INFO_MSG("~p, ~p~n",[Show,Status]),
    Resource = StateData#state.resource,

    Reply = {User, Resource, Show, Status},
    fsm_reply(Reply, StateName, StateData);

when i use psi to test user presence show and status. i can't find the info msg output in ejabberd log file.

maybe i use fun handle_sync_event to test is wrong.
thanks for help

Syndicate content