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
timestamp() ->
{MegaSecs, Secs, _MicroSecs} = now(),
MegaSecs * 1000000 + Secs.
-
+
handle_call({get_features, Caps}, From, State) ->
case maybe_get_features(Caps) of
{ok, Features} ->
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 =
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;
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");
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]};
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} ->
[[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}.
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),
?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,
?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) ->
{Item, SRUsers1}
end
end, SRUsers, Items),
-
+
%% Export items in roster format:
SRItems = [#roster{usj = {U, S, {U1, S1, ""}},
us = US,
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).
[{"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};
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 =
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,
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")
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")
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")
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(
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(
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")
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")
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")
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")
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")
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]};