views:

74

answers:

1

Does anyone know if there's a direct way to map an IP address to a user logged into ejabberd? I found an indirect way by modifying ejabberd_receiver.erl and calling inet:peername(Socket) from here: http://stackoverflow.com/questions/1240312/determining-ip-address-and-port-of-an-incoming-tcp-ip-connection-in-erlang

but there doesn't seem to be a way to link a socket to a user after they've successfully been authenticated. If anyone knows of a way, please let me know! Thanks.

A: 

Depending on the size of your installation, you might want to run ejabberd_sm:dirty_get_sessions_list/0 and call get_user_ip/3 on each triple to implement a reverse lookup.