* src/mod_caps.erl: Fix compilation warnings: Part 2 (EJAB-290)

* src/mod_configure.erl: 
* src/mod_configure2.erl: 
* src/mod_offline_odbc.erl: 
* src/mod_shared_roster.erl: 
* src/mod_stats.erl: 
* src/mod_version.erl:

SVN Revision: 1046
This commit is contained in:
Badlop 2007-12-07 00:09:48 +00:00
parent 6342c258a7
commit b7c0a89a79
8 changed files with 82 additions and 74 deletions

View File

@ -1,5 +1,13 @@
2007-12-07 Badlop <badlop@process-one.net> 2007-12-07 Badlop <badlop@process-one.net>
* src/mod_caps.erl: Fix compilation warnings: Part 2 (EJAB-290)
* src/mod_configure.erl:
* src/mod_configure2.erl:
* src/mod_offline_odbc.erl:
* src/mod_shared_roster.erl:
* src/mod_stats.erl:
* src/mod_version.erl:
* src/cyrsasl.erl: Fix compilation warnings: Part 1 (EJAB-290) * src/cyrsasl.erl: Fix compilation warnings: Part 1 (EJAB-290)
* src/ejabberd_auth_odbc.erl: Likewise * src/ejabberd_auth_odbc.erl: Likewise
* src/ejabberd_config.erl: Likewise * src/ejabberd_config.erl: Likewise

View File

@ -140,7 +140,7 @@ maybe_get_features(#caps{node = Node, version = Version, exts = Exts}) ->
timestamp() -> timestamp() ->
{MegaSecs, Secs, _MicroSecs} = now(), {MegaSecs, Secs, _MicroSecs} = now(),
MegaSecs * 1000000 + Secs. MegaSecs * 1000000 + Secs.
handle_call({get_features, Caps}, From, State) -> handle_call({get_features, Caps}, From, State) ->
case maybe_get_features(Caps) of case maybe_get_features(Caps) of
{ok, Features} -> {ok, Features} ->
@ -204,7 +204,7 @@ handle_cast({disco_response, From, _To,
sub_el = SubEls}}, sub_el = SubEls}},
#state{disco_requests = Requests} = State) -> #state{disco_requests = Requests} = State) ->
case {Type, SubEls} of case {Type, SubEls} of
{result, [{xmlelement, "query", Attrs, Els}]} -> {result, [{xmlelement, "query", _Attrs, Els}]} ->
case ?DICT:find(ID, Requests) of case ?DICT:find(ID, Requests) of
{ok, {Node, SubNode}} -> {ok, {Node, SubNode}} ->
Features = Features =

View File

@ -1261,7 +1261,7 @@ set_form(_From, _Host, ["running nodes", ENode, "DB"], _Lang, XData) ->
Node -> Node ->
lists:foreach( lists:foreach(
fun({SVar, SVals}) -> fun({SVar, SVals}) ->
%% We believe that this is allowed only for good people %% We believe that this is allowed only for good people
Table = list_to_atom(SVar), Table = list_to_atom(SVar),
Type = case SVals of Type = case SVals of
["unknown"] -> unknown; ["unknown"] -> unknown;
@ -1604,7 +1604,7 @@ set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
FLast = FLast =
case ejabberd_sm:get_user_resources(User, Server) of case ejabberd_sm:get_user_resources(User, Server) of
[] -> [] ->
US = {User, Server}, _US = {User, Server},
case get_last_info(User, Server) of case get_last_info(User, Server) of
not_found -> not_found ->
?T(Lang, "Never"); ?T(Lang, "Never");

View File

@ -30,7 +30,7 @@ stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE). gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE).
process_local_iq(From, To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) -> process_local_iq(From, To, #iq{type = Type, lang = _Lang, sub_el = SubEl} = IQ) ->
case acl:match_rule(To#jid.lserver, configure, From) of case acl:match_rule(To#jid.lserver, configure, From) of
deny -> deny ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
@ -39,38 +39,38 @@ process_local_iq(From, To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) -
set -> set ->
IQ#iq{type = error, IQ#iq{type = error,
sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]}; sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]};
%case xml:get_tag_attr_s("type", SubEl) of %%case xml:get_tag_attr_s("type", SubEl) of
% "cancel" -> %% "cancel" ->
% IQ#iq{type = result, %% IQ#iq{type = result,
% sub_el = [{xmlelement, "query", %% sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], []}]}; %% [{"xmlns", XMLNS}], []}]};
% "submit" -> %% "submit" ->
% XData = jlib:parse_xdata_submit(SubEl), %% XData = jlib:parse_xdata_submit(SubEl),
% case XData of %% case XData of
% invalid -> %% invalid ->
% IQ#iq{type = error, %% IQ#iq{type = error,
% sub_el = [SubEl, ?ERR_BAD_REQUEST]}; %% sub_el = [SubEl, ?ERR_BAD_REQUEST]};
% _ -> %% _ ->
% Node = %% Node =
% string:tokens( %% string:tokens(
% xml:get_tag_attr_s("node", SubEl), %% xml:get_tag_attr_s("node", SubEl),
% "/"), %% "/"),
% case set_form(Node, Lang, XData) of %% case set_form(Node, Lang, XData) of
% {result, Res} -> %% {result, Res} ->
% IQ#iq{type = result, %% IQ#iq{type = result,
% sub_el = [{xmlelement, "query", %% sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], %% [{"xmlns", XMLNS}],
% Res %% Res
% }]}; %% }]};
% {error, Error} -> %% {error, Error} ->
% IQ#iq{type = error, %% IQ#iq{type = error,
% sub_el = [SubEl, Error]} %% sub_el = [SubEl, Error]}
% end %% end
% end; %% end;
% _ -> %% _ ->
% IQ#iq{type = error, %% IQ#iq{type = error,
% sub_el = [SubEl, ?ERR_NOT_ALLOWED]} %% sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
%end; %%end;
get -> get ->
case process_get(SubEl) of case process_get(SubEl) of
{result, Res} -> {result, Res} ->
@ -145,8 +145,8 @@ process_get({xmlelement, "last", Attrs, _SubEls}) ->
[[integer_to_list(TimeStamp - V), " "] || V <- Vals])), [[integer_to_list(TimeStamp - V), " "] || V <- Vals])),
{result, {xmlelement, "last", Attrs, [{xmlcdata, Str}]}} {result, {xmlelement, "last", Attrs, [{xmlcdata, Str}]}}
end; end;
%process_get({xmlelement, Name, Attrs, SubEls}) -> %%process_get({xmlelement, Name, Attrs, SubEls}) ->
% {result, }; %% {result, };
process_get(_) -> process_get(_) ->
{error, ?ERR_BAD_REQUEST}. {error, ?ERR_BAD_REQUEST}.

View File

@ -320,7 +320,7 @@ user_queue(User, Server, Query, Lang) ->
end, end,
FMsgs = FMsgs =
lists:map( lists:map(
fun({xmlelement, Name, Attrs, Els} = Msg) -> fun({xmlelement, _Name, _Attrs, _Els} = Msg) ->
ID = jlib:encode_base64(binary_to_list(term_to_binary(Msg))), ID = jlib:encode_base64(binary_to_list(term_to_binary(Msg))),
Packet = Msg, Packet = Msg,
FPacket = ejabberd_web_admin:pretty_print_xml(Packet), FPacket = ejabberd_web_admin:pretty_print_xml(Packet),

View File

@ -64,8 +64,8 @@ start(Host, _Opts) ->
?MODULE, get_jid_info, 70), ?MODULE, get_jid_info, 70),
ejabberd_hooks:add(roster_process_item, Host, ejabberd_hooks:add(roster_process_item, Host,
?MODULE, process_item, 50). ?MODULE, process_item, 50).
%ejabberd_hooks:add(remove_user, Host, %%ejabberd_hooks:add(remove_user, Host,
% ?MODULE, remove_user, 50), %% ?MODULE, remove_user, 50),
stop(Host) -> stop(Host) ->
ejabberd_hooks:delete(webadmin_menu_host, Host, ejabberd_hooks:delete(webadmin_menu_host, Host,
@ -84,8 +84,8 @@ stop(Host) ->
?MODULE, get_jid_info, 70), ?MODULE, get_jid_info, 70),
ejabberd_hooks:delete(roster_process_item, Host, ejabberd_hooks:delete(roster_process_item, Host,
?MODULE, process_item, 50). ?MODULE, process_item, 50).
%ejabberd_hooks:delete(remove_user, Host, %%ejabberd_hooks:delete(remove_user, Host,
% ?MODULE, remove_user, 50), %% ?MODULE, remove_user, 50),
get_user_roster(Items, US) -> get_user_roster(Items, US) ->
@ -120,7 +120,7 @@ get_user_roster(Items, US) ->
{Item, SRUsers1} {Item, SRUsers1}
end end
end, SRUsers, Items), end, SRUsers, Items),
%% Export items in roster format: %% Export items in roster format:
SRItems = [#roster{usj = {U, S, {U1, S1, ""}}, SRItems = [#roster{usj = {U, S, {U1, S1, ""}},
us = US, us = US,
@ -313,11 +313,11 @@ get_group_users(Host, Group) ->
get_group_explicit_users(Host, Group) -> get_group_explicit_users(Host, Group) ->
case catch mnesia:dirty_index_read( case catch mnesia:dirty_index_read(
sr_user, {Group, Host}, #sr_user.group_host) of sr_user, {Group, Host}, #sr_user.group_host) of
Rs when is_list(Rs) -> Rs when is_list(Rs) ->
[R#sr_user.us || R <- Rs]; [R#sr_user.us || R <- Rs];
_ -> _ ->
[] []
end. end.
get_group_name(Host, Group) -> get_group_name(Host, Group) ->
get_group_opt(Host, Group, name, Group). get_group_opt(Host, Group, name, Group).
@ -373,18 +373,18 @@ webadmin_menu(Acc, _Host) ->
[{"shared-roster", "Shared Roster"} | Acc]. [{"shared-roster", "Shared Roster"} | Acc].
webadmin_page(_, Host, webadmin_page(_, Host,
#request{us = US, #request{us = _US,
path = ["shared-roster"], path = ["shared-roster"],
q = Query, q = Query,
lang = Lang} = Request) -> lang = Lang} = _Request) ->
Res = list_shared_roster_groups(Host, Query, Lang), Res = list_shared_roster_groups(Host, Query, Lang),
{stop, Res}; {stop, Res};
webadmin_page(_, Host, webadmin_page(_, Host,
#request{us = US, #request{us = _US,
path = ["shared-roster", Group], path = ["shared-roster", Group],
q = Query, q = Query,
lang = Lang} = Request) -> lang = Lang} = _Request) ->
Res = shared_roster_group(Host, Group, Query, Lang), Res = shared_roster_group(Host, Group, Query, Lang),
{stop, Res}; {stop, Res};
@ -467,7 +467,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
Name = get_opt(GroupOpts, name, ""), Name = get_opt(GroupOpts, name, ""),
Description = get_opt(GroupOpts, description, ""), Description = get_opt(GroupOpts, description, ""),
AllUsers = get_opt(GroupOpts, all_users, false), AllUsers = get_opt(GroupOpts, all_users, false),
Disabled = false, %%Disabled = false,
DisplayedGroups = get_opt(GroupOpts, displayed_groups, []), DisplayedGroups = get_opt(GroupOpts, displayed_groups, []),
Members = mod_shared_roster:get_group_explicit_users(Host, Group), Members = mod_shared_roster:get_group_explicit_users(Host, Group),
FMembers = FMembers =

View File

@ -26,17 +26,17 @@ stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_STATS). gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_STATS).
process_local_iq(From, To, #iq{id = ID, type = Type, process_local_iq(_From, To, #iq{id = _ID, type = Type,
xmlns = XMLNS, sub_el = SubEl} = IQ) -> xmlns = XMLNS, sub_el = SubEl} = IQ) ->
Lang = xml:get_tag_attr_s("xml:lang", SubEl), %%Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
get -> get ->
{xmlelement, _, Attrs, Els} = SubEl, {xmlelement, _, _Attrs, Els} = SubEl,
Node = string:tokens(xml:get_tag_attr_s("node", SubEl), "/"), Node = string:tokens(xml:get_tag_attr_s("node", SubEl), "/"),
Names = get_names(Els, []), Names = get_names(Els, []),
case get_local_stats(To#jid.server, Node, Names) of case get_local_stats(To#jid.server, Node, Names) of
{result, Res} -> {result, Res} ->
IQ#iq{type = result, IQ#iq{type = result,
@ -120,16 +120,16 @@ get_local_stats(_Server, _, _) ->
get_local_stat(Server, [], Name) when Name == "users/online" -> get_local_stat(Server, [], Name) when Name == "users/online" ->
case catch ejabberd_sm:get_vh_session_list(Server) of case catch ejabberd_sm:get_vh_session_list(Server) of
{'EXIT', Reason} -> {'EXIT', _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(length(Users)), "users") ?STATVAL(integer_to_list(length(Users)), "users")
end; end;
get_local_stat(Server, [], Name) when Name == "users/total" -> get_local_stat(Server, [], Name) when Name == "users/total" ->
LServer = jlib:nameprep(Server), %%LServer = jlib:nameprep(Server),
case catch ejabberd_auth:get_vh_registered_users_number(Server) of case catch ejabberd_auth:get_vh_registered_users_number(Server) of
{'EXIT', Reason} -> {'EXIT', _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
NUsers -> NUsers ->
?STATVAL(integer_to_list(NUsers), "users") ?STATVAL(integer_to_list(NUsers), "users")
@ -137,7 +137,7 @@ get_local_stat(Server, [], Name) when Name == "users/total" ->
get_local_stat(_Server, [], Name) when Name == "users/all-hosts/online" -> get_local_stat(_Server, [], Name) when Name == "users/all-hosts/online" ->
case catch mnesia:table_info(session, size) of case catch mnesia:table_info(session, size) of
{'EXIT', Reason} -> {'EXIT', _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(Users), "users") ?STATVAL(integer_to_list(Users), "users")
@ -145,7 +145,7 @@ get_local_stat(_Server, [], Name) when Name == "users/all-hosts/online" ->
get_local_stat(_Server, [], Name) when Name == "users/all-hosts/total" -> get_local_stat(_Server, [], Name) when Name == "users/all-hosts/total" ->
case catch mnesia:table_info(passwd, size) of case catch mnesia:table_info(passwd, size) of
{'EXIT', Reason} -> {'EXIT', _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(Users), "users") ?STATVAL(integer_to_list(Users), "users")
@ -158,7 +158,7 @@ get_local_stat(_Server, _, Name) ->
get_node_stat(Node, Name) when Name == "time/uptime" -> get_node_stat(Node, Name) when Name == "time/uptime" ->
case catch rpc:call(Node, erlang, statistics, [wall_clock]) of case catch rpc:call(Node, erlang, statistics, [wall_clock]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
CPUTime -> CPUTime ->
?STATVAL( ?STATVAL(
@ -167,7 +167,7 @@ get_node_stat(Node, Name) when Name == "time/uptime" ->
get_node_stat(Node, Name) when Name == "time/cputime" -> get_node_stat(Node, Name) when Name == "time/cputime" ->
case catch rpc:call(Node, erlang, statistics, [runtime]) of case catch rpc:call(Node, erlang, statistics, [runtime]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
RunTime -> RunTime ->
?STATVAL( ?STATVAL(
@ -176,7 +176,7 @@ get_node_stat(Node, Name) when Name == "time/cputime" ->
get_node_stat(Node, Name) when Name == "users/online" -> get_node_stat(Node, Name) when Name == "users/online" ->
case catch rpc:call(Node, ejabberd_sm, dirty_get_my_sessions_list, []) of case catch rpc:call(Node, ejabberd_sm, dirty_get_my_sessions_list, []) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(length(Users)), "users") ?STATVAL(integer_to_list(length(Users)), "users")
@ -184,7 +184,7 @@ get_node_stat(Node, Name) when Name == "users/online" ->
get_node_stat(Node, Name) when Name == "transactions/commited" -> get_node_stat(Node, Name) when Name == "transactions/commited" ->
case catch rpc:call(Node, mnesia, system_info, [transaction_commits]) of case catch rpc:call(Node, mnesia, system_info, [transaction_commits]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Transactions -> Transactions ->
?STATVAL(integer_to_list(Transactions), "transactions") ?STATVAL(integer_to_list(Transactions), "transactions")
@ -192,7 +192,7 @@ get_node_stat(Node, Name) when Name == "transactions/commited" ->
get_node_stat(Node, Name) when Name == "transactions/aborted" -> get_node_stat(Node, Name) when Name == "transactions/aborted" ->
case catch rpc:call(Node, mnesia, system_info, [transaction_failures]) of case catch rpc:call(Node, mnesia, system_info, [transaction_failures]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Transactions -> Transactions ->
?STATVAL(integer_to_list(Transactions), "transactions") ?STATVAL(integer_to_list(Transactions), "transactions")
@ -200,7 +200,7 @@ get_node_stat(Node, Name) when Name == "transactions/aborted" ->
get_node_stat(Node, Name) when Name == "transactions/restarted" -> get_node_stat(Node, Name) when Name == "transactions/restarted" ->
case catch rpc:call(Node, mnesia, system_info, [transaction_restarts]) of case catch rpc:call(Node, mnesia, system_info, [transaction_restarts]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Transactions -> Transactions ->
?STATVAL(integer_to_list(Transactions), "transactions") ?STATVAL(integer_to_list(Transactions), "transactions")
@ -208,7 +208,7 @@ get_node_stat(Node, Name) when Name == "transactions/restarted" ->
get_node_stat(Node, Name) when Name == "transactions/logged" -> get_node_stat(Node, Name) when Name == "transactions/logged" ->
case catch rpc:call(Node, mnesia, system_info, [transaction_log_writes]) of case catch rpc:call(Node, mnesia, system_info, [transaction_log_writes]) of
{badrpc, Reason} -> {badrpc, _Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Transactions -> Transactions ->
?STATVAL(integer_to_list(Transactions), "transactions") ?STATVAL(integer_to_list(Transactions), "transactions")

View File

@ -28,8 +28,8 @@ stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_VERSION). gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_VERSION).
process_local_iq(From, To, #iq{id = ID, type = Type, process_local_iq(_From, To, #iq{id = _ID, type = Type,
xmlns = XMLNS, sub_el = SubEl} = IQ) -> xmlns = _XMLNS, sub_el = SubEl} = IQ) ->
case Type of case Type of
set -> set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};