Created
October 5, 2012 06:05
-
-
Save mweibel/3838341 to your computer and use it in GitHub Desktop.
mod_onlineusers with list of users online
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%---------------------------------------------------------------------- | |
%%% File : mod_onlineusers.erl | |
%%% Author : Michael Weibel <[email protected]> | |
%%% Purpose : Display number & list of online users | |
%%% Created : 2011-08-16 | |
%%%---------------------------------------------------------------------- | |
-module(mod_onlineusers). | |
-author('[email protected]'). | |
-behaviour(gen_mod). | |
-export([ | |
start/2, | |
stop/1, | |
process/2 | |
]). | |
-include("ejabberd.hrl"). | |
-include("jlib.hrl"). | |
-include("web/ejabberd_http.hrl"). | |
%%%---------------------------------------------------------------------- | |
%%% REQUEST HANDLERS | |
%%%---------------------------------------------------------------------- | |
process([], _Request) -> | |
{200, [], integer_to_list(ejabberd_sm:connected_users_number())}; | |
process(["list"], _Request) -> | |
{200, [], ejabberd_sm:connected_users()}; | |
%%%---------------------------------------------------------------------- | |
%%% BEHAVIOUR CALLBACKS | |
%%%---------------------------------------------------------------------- | |
start(_Host, _Opts) -> | |
ok. | |
stop(_Host) -> | |
ok. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment