diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index df9debd62..87a918704 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -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) -> diff --git a/src/ejd2sql.erl b/src/ejd2sql.erl index 2d19100a9..7bace05dd 100644 --- a/src/ejd2sql.erl +++ b/src/ejd2sql.erl @@ -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; diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index bb20bd2f9..de8d8e1a7 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -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]. diff --git a/src/mod_client_state.erl b/src/mod_client_state.erl index fe66f34e2..036175cce 100644 --- a/src/mod_client_state.erl +++ b/src/mod_client_state.erl @@ -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. %%-------------------------------------------------------------------- diff --git a/src/mod_mam_sql.erl b/src/mod_mam_sql.erl index bbbe543f5..20ed8d4f1 100644 --- a/src/mod_mam_sql.erl +++ b/src/mod_mam_sql.erl @@ -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) -> - <> - 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]]. diff --git a/src/mod_ping.erl b/src/mod_ping.erl index f1c175a91..d1b3f9322 100644 --- a/src/mod_ping.erl +++ b/src/mod_ping.erl @@ -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; diff --git a/src/mod_pres_counter.erl b/src/mod_pres_counter.erl index 1118b7bbc..e6f2cfbab 100644 --- a/src/mod_pres_counter.erl +++ b/src/mod_pres_counter.erl @@ -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 diff --git a/src/mod_roster_sql.erl b/src/mod_roster_sql.erl index 899978091..61f59a990 100644 --- a/src/mod_roster_sql.erl +++ b/src/mod_roster_sql.erl @@ -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, diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl index 7c94c771d..fa4af4d57 100644 --- a/src/node_flat_sql.erl +++ b/src/node_flat_sql.erl @@ -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}) ->