Skip to content

Commit

Permalink
Get rid of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zinid committed Jul 7, 2016
1 parent c718cbb commit 71f27ee
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 62 deletions.
3 changes: 0 additions & 3 deletions src/ejabberd_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
2 changes: 1 addition & 1 deletion src/ejd2sql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/mod_carboncopy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down Expand Up @@ -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].
7 changes: 6 additions & 1 deletion src/mod_client_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
%%--------------------------------------------------------------------
Expand Down
22 changes: 0 additions & 22 deletions src/mod_mam_sql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]].
5 changes: 4 additions & 1 deletion src/mod_ping.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<"">>,
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/mod_pres_counter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand All @@ -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
Expand Down
25 changes: 0 additions & 25 deletions src/mod_roster_sql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 0 additions & 7 deletions src/node_flat_sql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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}) ->
Expand Down

0 comments on commit 71f27ee

Please sign in to comment.