mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Check if mod_last is loaded before calling its functions
This commit is contained in:
parent
2e35252aed
commit
370226417a
@ -707,9 +707,7 @@ list_given_users(Host, Users, Prefix, Lang, URLFunc) ->
|
|||||||
Server)
|
Server)
|
||||||
of
|
of
|
||||||
[] ->
|
[] ->
|
||||||
case mod_last:get_last_info(User,
|
case get_last_info(User, Server) of
|
||||||
Server)
|
|
||||||
of
|
|
||||||
not_found -> translate:translate(Lang, ?T("Never"));
|
not_found -> translate:translate(Lang, ?T("Never"));
|
||||||
{ok, Shift, _Status} ->
|
{ok, Shift, _Status} ->
|
||||||
TimeStamp = {Shift div
|
TimeStamp = {Shift div
|
||||||
@ -755,9 +753,22 @@ get_offlinemsg_module(Server) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
get_lastactivity_menuitem_list(Server) ->
|
get_lastactivity_menuitem_list(Server) ->
|
||||||
|
case gen_mod:is_loaded(Server, mod_last) of
|
||||||
|
true ->
|
||||||
case mod_last_opt:db_type(Server) of
|
case mod_last_opt:db_type(Server) of
|
||||||
mnesia -> [{<<"last-activity">>, ?T("Last Activity")}];
|
mnesia -> [{<<"last-activity">>, ?T("Last Activity")}];
|
||||||
_ -> []
|
_ -> []
|
||||||
|
end;
|
||||||
|
false ->
|
||||||
|
[]
|
||||||
|
end.
|
||||||
|
|
||||||
|
get_last_info(User, Server) ->
|
||||||
|
case gen_mod:is_loaded(Server, mod_last) of
|
||||||
|
true ->
|
||||||
|
mod_last:get_last_info(User, Server);
|
||||||
|
false ->
|
||||||
|
not_found
|
||||||
end.
|
end.
|
||||||
|
|
||||||
us_to_list({User, Server}) ->
|
us_to_list({User, Server}) ->
|
||||||
@ -890,7 +901,7 @@ user_info(User, Server, Query, Lang) ->
|
|||||||
Server)
|
Server)
|
||||||
of
|
of
|
||||||
[] ->
|
[] ->
|
||||||
case mod_last:get_last_info(User, Server) of
|
case get_last_info(User, Server) of
|
||||||
not_found -> translate:translate(Lang, ?T("Never"));
|
not_found -> translate:translate(Lang, ?T("Never"));
|
||||||
{ok, Shift, _Status} ->
|
{ok, Shift, _Status} ->
|
||||||
TimeStamp = {Shift div 1000000,
|
TimeStamp = {Shift div 1000000,
|
||||||
|
Loading…
Reference in New Issue
Block a user