]> granicus.if.org Git - ejabberd/commitdiff
Get rid of warnings
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 7 Jul 2016 09:17:38 +0000 (12:17 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 7 Jul 2016 09:17:38 +0000 (12:17 +0300)
src/ejabberd_config.erl
src/ejd2sql.erl
src/mod_carboncopy.erl
src/mod_client_state.erl
src/mod_mam_sql.erl
src/mod_ping.erl
src/mod_pres_counter.erl
src/mod_roster_sql.erl
src/node_flat_sql.erl

index df9debd6297b6d00c618ea6ee95b0f95fee52b55..87a9187048c11e9735cd9abb1877c8456c159d10 100644 (file)
@@ -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) ->
index 2d19100a9a553c11125eb9bbc68512076800aaf7..7bace05ddcf60559ec8839fb845aab29c80fb1f8 100644 (file)
@@ -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;
index bb20bd2f908068d4c1d22b080f0fcd3db8175e5d..de8d8e1a71f588fb0022da9336ac01b473a991e8 100644 (file)
@@ -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].
index fe66f34e23cdcc7c0e26ea7d8f67d8c96acd2baa..036175cced9997492ea0b389153f1c997500d2af 100644 (file)
@@ -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.
 %%--------------------------------------------------------------------
index bbbe543f51409afb57d5e1ca6a1f1b22c0a9db3d..20ed8d4f155311ada2344ceac4fca8026642fa47 100644 (file)
@@ -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]].
index f1c175a919a54025c48a77157f88fe32f8922401..d1b3f9322fec10a5d75c02bddc7b4475cc117c67 100644 (file)
@@ -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;
index 1118b7bbccbe7072734bbdd44e5cc69ddafa9ce2..e6f2cfbabd61981371d5a356e5ca5e958066f52e 100644 (file)
@@ -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
index 899978091f878430931ba8588da0db9119000774..61f59a99098d475cdd856d81dd41d954ee303705 100644 (file)
@@ -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,
index 7c94c771decfbd10bd3500317634373c6d34e2fc..fa4af4d57723c33ffd6decedffd0e30b1d7f75eb 100644 (file)
@@ -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}) ->