Accessing StateData with User/Server/Resource

I am looking for an easy way to access a users StateData by using their JID/Server/Resource information.

Is their an easy way of accessing this data? Ive poked around in ejabberd_sm.erl but haven't found an easy way of accessing it.

Can anyone point me in the right direction or give me pointers?

What StateData do you refer

What StateData do you refer to exactly? I guess you are interested in the one implemented in ejabberd_c2s.erl:

-record(state, {socket,
		sockmod,
		socket_monitor,
		streamid,
		sasl_state,
		access,
		shaper,
		zlib = false,
		tls = false,
		tls_required = false,
		tls_enabled = false,
		tls_options = [],
		authenticated = false,
		jid,
		user = "", server = ?MYNAME, resource = "",
		sid,
		pres_t = ?SETS:new(),
		pres_f = ?SETS:new(),
		pres_a = ?SETS:new(),
		pres_i = ?SETS:new(),
		pres_last, pres_pri,
		pres_timestamp,
		pres_invis = false,
		privacy_list = none,
		ip,
		lang}).

What information are you interested in, IP address, method of connection...?

Thanks for your input, i was

Thanks for your input, i was able to find what i needed through support on the process-one forum.

Link: http://www.process-one.net/en/forum/viewthread/79/

Jeffrey R. | dS

If I'm understanding you

If I'm understanding you correctly, this is almost the same thing that I needed while hacking my PEP patch. Thus I added ejabberd_sm:get_session_pid/3, which returns the PID of the ejabberd_c2s process, and then ejabberd_c2s:get_subscribed_and_online/1, which returns the data that I need. These functions may or may not eventually find their way into ejabberd proper in this shape, but I hope the code might serve as inspiration…

Syndicate content