aboutsummaryrefslogtreecommitdiff
path: root/src/web/ejabberd_web_admin.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2009-12-09 17:46:51 +0000
committerBadlop <badlop@process-one.net>2009-12-09 17:46:51 +0000
commit8ac16a0ec1eaf5ab1bb6168927aac0edf9f0ee85 (patch)
treefe106f0407ddc5bdc1be0267a0cd95a4fe08a440 /src/web/ejabberd_web_admin.erl
parentThis is ejabberd 2.1.x branch, not 2.1.0 tag. (diff)
Call in WebAdmin the proper mod_last backend module (EJAB-1031)
SVN Revision: 2798
Diffstat (limited to 'src/web/ejabberd_web_admin.erl')
-rw-r--r--src/web/ejabberd_web_admin.erl21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl
index d8e5ac848..ccc38d879 100644
--- a/src/web/ejabberd_web_admin.erl
+++ b/src/web/ejabberd_web_admin.erl
@@ -1467,7 +1467,7 @@ list_users(Host, Query, Lang, URLFunc) ->
FUsers =
case length(SUsers) of
N when N =< 100 ->
- [list_given_users(SUsers, "../", Lang, URLFunc)];
+ [list_given_users(Host, SUsers, "../", Lang, URLFunc)];
N ->
NParts = trunc(math:sqrt(N * 0.618)) + 1,
M = trunc(N / NParts) + 1,
@@ -1542,9 +1542,10 @@ list_users_in_diapason(Host, Diap, Lang, URLFunc) ->
N1 = list_to_integer(S1),
N2 = list_to_integer(S2),
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
- [list_given_users(Sub, "../../", Lang, URLFunc)].
+ [list_given_users(Host, Sub, "../../", Lang, URLFunc)].
-list_given_users(Users, Prefix, Lang, URLFunc) ->
+list_given_users(Host, Users, Prefix, Lang, URLFunc) ->
+ ModLast = get_lastactivity_module(Host),
?XE("table",
[?XE("thead",
[?XE("tr",
@@ -1562,11 +1563,10 @@ list_given_users(Users, Prefix, Lang, URLFunc) ->
FLast =
case ejabberd_sm:get_user_resources(User, Server) of
[] ->
- case mnesia:dirty_read({last_activity, US}) of
- [] ->
+ case ModLast:get_last_info(User, Server) of
+ not_found ->
?T("Never");
- [E] ->
- Shift = element(3, E),
+ {ok, Shift, _Status} ->
TimeStamp = {Shift div 1000000,
Shift rem 1000000,
0},
@@ -1591,6 +1591,13 @@ list_given_users(Users, Prefix, Lang, URLFunc) ->
end, Users)
)]).
+get_lastactivity_module(Server) ->
+ case lists:member(mod_last, gen_mod:loaded_modules(Server)) of
+ true -> mod_last;
+ _ -> mod_last_odbc
+ end.
+
+
us_to_list({User, Server}) ->
jlib:jid_to_string({User, Server, ""}).