I'm writing an implementation very close to Google Talk's shared status extension (). So far I've managed to implement most of the features except sending out presence information to all subscribers. It currently loops through all of the resources (ejabberd_sm:get_user_resources()) and grabs the presence information via ejabberd_c2s:get_presence() but get_presence timesout when trying to grab the presence of the resource that this hook is running for (the hook is being ran on the same process as get_presence is trying to get information from).
So my question is: what is the best method to implement this kind of functionality? The only reason I need to get the users presence is to access the "show" value since the whole point of this extension is to change the status I already have the status I want to send out. I can't just get show from one of the resources and use it for all since each resource can have its own show value.
tldr: How can you get the current presence of a user when that user is the one requesting the information since you can't use get_presence() since they're the same process.
Thanks
As example code, download
As example code, download from ejabberd-modules SVN the file mod_admin_extra.erl and search for the function user_sessions_info(User, Host).