25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-07 14:58:56 +02:00

* 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>
* 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/ejabberd_auth_odbc.erl: Likewise
* src/ejabberd_config.erl: Likewise

View File

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

View File

@ -1261,7 +1261,7 @@ set_form(_From, _Host, ["running nodes", ENode, "DB"], _Lang, XData) ->
Node ->
lists:foreach(
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),
Type = case SVals of
["unknown"] -> unknown;
@ -1604,7 +1604,7 @@ set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
FLast =
case ejabberd_sm:get_user_resources(User, Server) of
[] ->
US = {User, Server},
_US = {User, Server},
case get_last_info(User, Server) of
not_found ->
?T(Lang, "Never");

View File

@ -30,7 +30,7 @@ stop(Host) ->
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
deny ->
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 ->
IQ#iq{type = error,
sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]};
%case xml:get_tag_attr_s("type", SubEl) of
% "cancel" ->
% IQ#iq{type = result,
% sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], []}]};
% "submit" ->
% XData = jlib:parse_xdata_submit(SubEl),
% case XData of
% invalid ->
% IQ#iq{type = error,
% sub_el = [SubEl, ?ERR_BAD_REQUEST]};
% _ ->
% Node =
% string:tokens(
% xml:get_tag_attr_s("node", SubEl),
% "/"),
% case set_form(Node, Lang, XData) of
% {result, Res} ->
% IQ#iq{type = result,
% sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}],
% Res
% }]};
% {error, Error} ->
% IQ#iq{type = error,
% sub_el = [SubEl, Error]}
% end
% end;
% _ ->
% IQ#iq{type = error,
% sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
%end;
%%case xml:get_tag_attr_s("type", SubEl) of
%% "cancel" ->
%% IQ#iq{type = result,
%% sub_el = [{xmlelement, "query",
%% [{"xmlns", XMLNS}], []}]};
%% "submit" ->
%% XData = jlib:parse_xdata_submit(SubEl),
%% case XData of
%% invalid ->
%% IQ#iq{type = error,
%% sub_el = [SubEl, ?ERR_BAD_REQUEST]};
%% _ ->
%% Node =
%% string:tokens(
%% xml:get_tag_attr_s("node", SubEl),
%% "/"),
%% case set_form(Node, Lang, XData) of
%% {result, Res} ->
%% IQ#iq{type = result,
%% sub_el = [{xmlelement, "query",
%% [{"xmlns", XMLNS}],
%% Res
%% }]};
%% {error, Error} ->
%% IQ#iq{type = error,
%% sub_el = [SubEl, Error]}
%% end
%% end;
%% _ ->
%% IQ#iq{type = error,
%% sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
%%end;
get ->
case process_get(SubEl) of
{result, Res} ->
@ -145,8 +145,8 @@ process_get({xmlelement, "last", Attrs, _SubEls}) ->
[[integer_to_list(TimeStamp - V), " "] || V <- Vals])),
{result, {xmlelement, "last", Attrs, [{xmlcdata, Str}]}}
end;
%process_get({xmlelement, Name, Attrs, SubEls}) ->
% {result, };
%%process_get({xmlelement, Name, Attrs, SubEls}) ->
%% {result, };
process_get(_) ->
{error, ?ERR_BAD_REQUEST}.

View File

@ -320,7 +320,7 @@ user_queue(User, Server, Query, Lang) ->
end,
FMsgs =
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))),
Packet = Msg,
FPacket = ejabberd_web_admin:pretty_print_xml(Packet),

View File

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

View File

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