I'm trying to read users os "Windows XP, Windows 7, Linux .... etc"
when they connected I'm working on ejabberd 2.1.x but nothing shown to me.
What I'm doing is :
-module(mod_test).
-behaviour(gen_mod).
%% gen_mod callbacks
-export([start/2, stop/1]).
%% hook handlers
-export([user_send_packet/3, filter_packet/1]).
-include("ejabberd.hrl").
-include("jlib.hrl").
-define(PROCNAME, ejabberd_mod_filter).
start(Host, _Opts) ->
ejabberd_hooks:add(user_send_packet, Host, ?MODULE, user_send_packet, 75),
ejabberd_hooks:add(filter_packet, global, ?MODULE, filter_packet, 75),
ok.
stop(Host) ->
ejabberd_hooks:delete(filter_packet, global, ?MODULE, filter_packet, 75),
ejabberd_hooks:delete(user_send_packet, Host, ?MODULE, user_send_packet, 75),
ok.
user_send_packet(_From, _To, _Packet) ->
ok.
filter_packet({From, To, Packet}) ->
io:format("~p", [Packet]),
filter_packet(Arg) ->
Arg.
It's return with all users data like (status, resource, caps ... etc) else (version, os, client name) are there any way to do this ?
I belive there is away to do this cuz in (muc chat) there is many bot do this like if I type :
version some_user
return to me with this msg :
name : Psi+
version : 1.1
os : Windows XP
but I don't know how they do this.
You can get this information by sending a "Software Version" request to the client as described in XEP-0092. This is something ejabberd usually doesn't do, so you may have to write code for tracking responses yourself. (The basic idea is that the server sends the request with a certain id, and then needs to check for responses with that same id, taking timeouts and errors into account.)