Check presence

Is it possible to check presence via xmlrpc or by another method in addition to the web Admin?

Thanks

Yes, mod_xmlrpc can be

Yes, you can add that call to mod_xmlrpc and query it using a XML-RPC client.

How I can call mod_xmlrpc to

How I can call mod_xmlrpc to get presence(offline or online and resource). In mod_xmlrpc.txt documentation I do not view this call.
Thanks

Check the new mod_xmlrpc 0.2.0

I've just published a new version of mod_xmlrpc with two new calls:

  • 'num_resources USER HOST': reports the number of online resources for a user. If he is offline: 0, if he is online: 1, if he is logged with two clients: 2.
  • 'resource_num USER HOST NUM': it tells you the resource name in position NUM. If num_resources reports you '2', you can now ask resource names 1 and 2.

I haven't tried this, but I hope it'll work.

Where I get the new version

Where I get the new version of mod_xmlrpc, in "http://www.ejabberd.im/files/efiles/mod_xmlrpc.erl" I get the old.
Thanks

No, you don't. Reload.

No, you don't. Reload in your web browser.

ok,It is work.

ok,It is work.
Thank you very much badlop.

Using this I create a call that return "offline" or an array with the resources that is connected a user.

handler(_State, {call, resources, [{struct, [{user, U}, {host, H}]}]}) ->
    Resources = ejabberd_sm:get_user_resources(U, H),
    case (length(Resources)>0) of
           true ->
                {false, {response, [{array, Resources}]}};
           false ->
                 {false, {response,  ["offline"]}}
        end;

get status via xmlrpc

is it also possible to get the status of a user via xmlrpc?

ejabberd_c2s has a function called get_presence but i have no idea how to call it correctly or combine it with mod_xmlrpc. the function needs (eats) a FsmRef-variable. is it possible to use this function with mod_xmlrpc? if not, where would be a good place to look for a handler for status messages in the sources of ejabberd? best would be a function like get_status(User, Server) :)

thanks a lot.

flip

I would also like to see this

I would also like to see this added

error in recource_num of mod_xmlrpc

the function resource_num didn't work for me due to a wrong comparison in the source (line 4):

% resource_num struct[{user, String}, {host, String}, {num, Integer}]             String
handler(_State, {call, resource_num, [{struct, [{user, U}, {host, H}, {num, N}]}]}) ->
	Resources = ejabberd_sm:get_user_resources(U, H),
	case (0>N) and (N>=length(Resources)) of
		true -> 
			R = lists:nth(N, Resources),
			{false, {response, [R]}};
		false ->
		    FaultString = lists:flatten(io_lib:format("Wrong resource number: ~p", [N])),
			{false, {response, {fault, -1, FaultString}}}
	end;

this works, after changing line 4:

% resource_num struct[{user, String}, {host, String}, {num, Integer}]             String
handler(_State, {call, resource_num, [{struct, [{user, U}, {host, H}, {num, N}]}]}) ->
	Resources = ejabberd_sm:get_user_resources(U, H),
	case (N>0) and (length(Resources)>=N) of
		true -> 
			R = lists:nth(N, Resources),
			{false, {response, [R]}};
		false ->
		    FaultString = lists:flatten(io_lib:format("Wrong resource number: ~p", [N])),
			{false, {response, {fault, -1, FaultString}}}
	end;

flip

Thanks, I've fixed the code

Thanks, I've fixed the code and released a new revision.

Net::XMPP

You can use Net::XMPP package within Perl

use Net::XMPP;

my $client = new Net::XMPP::Client();
my $roster = $client->Roster();
if ($roster->online('john.doe@jabber.org')
{
CODE GOES HERE
}

my @resource = $roster->resources('john.doe@jabber.org');
OR
my $resource = $roster->resource('john.doe@jabber.org');

Check documentation for Net::XMPP how to connect to jabber server.

xmlrpc:call({127,0,0,1},

xmlrpc:call({127,0,0,1}, 4560, "/", {call, get_presence,
[{struct, [{user, "jenkins"}, {server, "localhost"}]}]}).

using ejabberd 2.1.13 and latest mod_xmlrpc from svn does not work. I get Unknown Call.
But create_account works...

is there any way I can add

is there any way I can add this call to mod_xmlrpc.erl ?

Syndicate content