mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
Get rid of warnings
This commit is contained in:
parent
c718cbbd9f
commit
71f27ee7d4
@ -220,9 +220,6 @@ env_binary_to_list(Application, Parameter) ->
|
||||
%% in which the options 'include_config_file' were parsed
|
||||
%% and the terms in those files were included.
|
||||
%% @spec(iolist()) -> [term()]
|
||||
get_plain_terms_file(File) ->
|
||||
get_plain_terms_file(File, [{include_files, true}]).
|
||||
|
||||
get_plain_terms_file(File, Opts) when is_binary(File) ->
|
||||
get_plain_terms_file(binary_to_list(File), Opts);
|
||||
get_plain_terms_file(File1, Opts) ->
|
||||
|
@ -186,7 +186,7 @@ delete(LServer, Table, ConvertFun) ->
|
||||
mnesia:write_lock_table(Table),
|
||||
{_N, SQLs} =
|
||||
mnesia:foldl(
|
||||
fun(R, {N, SQLs} = Acc) ->
|
||||
fun(R, Acc) ->
|
||||
case ConvertFun(LServer, R) of
|
||||
[] ->
|
||||
Acc;
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
-export([user_send_packet/4, user_receive_packet/5,
|
||||
iq_handler2/3, iq_handler1/3, remove_connection/4,
|
||||
is_carbon_copy/1, mod_opt_type/1]).
|
||||
is_carbon_copy/1, mod_opt_type/1, depends/2]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
-include("logger.hrl").
|
||||
@ -278,6 +278,9 @@ list(User, Server) ->
|
||||
Mod = gen_mod:db_mod(Server, ?MODULE),
|
||||
Mod:list(User, Server).
|
||||
|
||||
depends(_Host, _Opts) ->
|
||||
[].
|
||||
|
||||
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||
mod_opt_type(_) -> [db_type, iqdisc].
|
||||
|
@ -31,7 +31,7 @@
|
||||
-behavior(gen_mod).
|
||||
|
||||
%% gen_mod callbacks.
|
||||
-export([start/2, stop/1, mod_opt_type/1]).
|
||||
-export([start/2, stop/1, mod_opt_type/1, depends/2]).
|
||||
|
||||
%% ejabberd_hooks callbacks.
|
||||
-export([filter_presence/3, filter_chat_states/3, filter_pep/3, filter_other/3,
|
||||
@ -142,6 +142,11 @@ mod_opt_type(queue_pep) ->
|
||||
fun(B) when is_boolean(B) -> B end;
|
||||
mod_opt_type(_) -> [queue_presence, queue_chat_states, queue_pep].
|
||||
|
||||
-spec depends(binary(), gen_mod:opts()) -> [{module(), hard | soft}].
|
||||
|
||||
depends(_Host, _Opts) ->
|
||||
[].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% ejabberd_hooks callbacks.
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -295,25 +295,3 @@ make_sql_query(User, LServer, Start, End, With, RSM) ->
|
||||
{QueryPage,
|
||||
[<<"SELECT COUNT(*) FROM archive WHERE username='">>,
|
||||
SUser, <<"'">>, WithClause, StartClause, EndClause, <<";">>]}.
|
||||
|
||||
update(LServer, Table, Fields, Vals, Where) ->
|
||||
UPairs = lists:zipwith(fun (A, B) ->
|
||||
<<A/binary, "='", B/binary, "'">>
|
||||
end,
|
||||
Fields, Vals),
|
||||
case ejabberd_sql:sql_query(LServer,
|
||||
[<<"update ">>, Table, <<" set ">>,
|
||||
join(UPairs, <<", ">>), <<" where ">>, Where,
|
||||
<<";">>])
|
||||
of
|
||||
{updated, 1} -> {updated, 1};
|
||||
_ ->
|
||||
ejabberd_sql:sql_query(LServer,
|
||||
[<<"insert into ">>, Table, <<"(">>,
|
||||
join(Fields, <<", ">>), <<") values ('">>,
|
||||
join(Vals, <<"', '">>), <<"');">>])
|
||||
end.
|
||||
|
||||
%% Almost a copy of string:join/2.
|
||||
join([], _Sep) -> [];
|
||||
join([H | T], Sep) -> [H, [[Sep, X] || X <- T]].
|
||||
|
@ -55,7 +55,7 @@
|
||||
handle_cast/2, handle_info/2, code_change/3]).
|
||||
|
||||
-export([iq_ping/3, user_online/3, user_offline/3,
|
||||
user_send/4, mod_opt_type/1]).
|
||||
user_send/4, mod_opt_type/1, depends/2]).
|
||||
|
||||
-record(state,
|
||||
{host = <<"">>,
|
||||
@ -253,6 +253,9 @@ cancel_timer(TRef) ->
|
||||
_ -> ok
|
||||
end.
|
||||
|
||||
depends(_Host, _Opts) ->
|
||||
[].
|
||||
|
||||
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
||||
mod_opt_type(ping_interval) ->
|
||||
fun (I) when is_integer(I), I > 0 -> I end;
|
||||
|
@ -28,7 +28,7 @@
|
||||
-behavior(gen_mod).
|
||||
|
||||
-export([start/2, stop/1, check_packet/6,
|
||||
mod_opt_type/1]).
|
||||
mod_opt_type/1, depends/2]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
-include("logger.hrl").
|
||||
@ -48,6 +48,9 @@ stop(Host) ->
|
||||
?MODULE, check_packet, 25),
|
||||
ok.
|
||||
|
||||
depends(_Host, _Opts) ->
|
||||
[].
|
||||
|
||||
check_packet(_, _User, Server, _PrivacyList,
|
||||
{From, To, #xmlel{name = Name, attrs = Attrs}}, Dir) ->
|
||||
case Name of
|
||||
|
@ -244,31 +244,6 @@ raw_to_record(LServer,
|
||||
askmessage = SAskMessage}
|
||||
end.
|
||||
|
||||
record_to_string(#roster{us = {User, _Server},
|
||||
jid = JID, name = Name, subscription = Subscription,
|
||||
ask = Ask, askmessage = AskMessage}) ->
|
||||
Username = ejabberd_sql:escape(User),
|
||||
SJID =
|
||||
ejabberd_sql:escape(jid:to_string(jid:tolower(JID))),
|
||||
Nick = ejabberd_sql:escape(Name),
|
||||
SSubscription = case Subscription of
|
||||
both -> <<"B">>;
|
||||
to -> <<"T">>;
|
||||
from -> <<"F">>;
|
||||
none -> <<"N">>
|
||||
end,
|
||||
SAsk = case Ask of
|
||||
subscribe -> <<"S">>;
|
||||
unsubscribe -> <<"U">>;
|
||||
both -> <<"B">>;
|
||||
out -> <<"O">>;
|
||||
in -> <<"I">>;
|
||||
none -> <<"N">>
|
||||
end,
|
||||
SAskMessage = ejabberd_sql:escape(AskMessage),
|
||||
[Username, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||
<<"N">>, <<"">>, <<"item">>].
|
||||
|
||||
record_to_row(
|
||||
#roster{us = {LUser, _LServer},
|
||||
jid = JID, name = Name, subscription = Subscription,
|
||||
|
@ -1037,13 +1037,6 @@ encode_subscriptions(Subscriptions) ->
|
||||
|
||||
%%% record getter/setter
|
||||
|
||||
state_to_raw(Nidx, State) ->
|
||||
{JID, _} = State#pubsub_state.stateid,
|
||||
J = ejabberd_sql:escape(encode_jid(JID)),
|
||||
A = encode_affiliation(State#pubsub_state.affiliation),
|
||||
S = encode_subscriptions(State#pubsub_state.subscriptions),
|
||||
[<<"'">>, Nidx, <<"', '">>, J, <<"', '">>, A, <<"', '">>, S, <<"'">>].
|
||||
|
||||
raw_to_item(Nidx, [ItemId, SJID, Creation, Modification, XML]) ->
|
||||
raw_to_item(Nidx, {ItemId, SJID, Creation, Modification, XML});
|
||||
raw_to_item(Nidx, {ItemId, SJID, Creation, Modification, XML}) ->
|
||||
|
Loading…
Reference in New Issue
Block a user