]> granicus.if.org Git - ejabberd/commitdiff
Fix dialyzer warnings for mod_mam
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Tue, 13 Sep 2016 13:56:34 +0000 (16:56 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Tue, 13 Sep 2016 13:56:34 +0000 (16:56 +0300)
include/mod_mam.hrl
src/mod_mam.erl
src/mod_mam_sql.erl

index 463db4cff04905c4bb97b18bec5dd4a688fac8ba..a2b92fca50021397493b9362512294c80ebdb618 100644 (file)
@@ -4,7 +4,7 @@
         timestamp = p1_time_compat:timestamp() :: erlang:timestamp() | '_' | '$1',
         peer = {<<"">>, <<"">>, <<"">>}      :: ljid() | '_' | '$3' | undefined,
         bare_peer = {<<"">>, <<"">>, <<"">>} :: ljid() | '_' | '$3',
-        packet = #xmlel{}                    :: xmlel() | '_',
+        packet = #xmlel{}                    :: xmlel() | message() | '_',
         nick = <<"">>                        :: binary(),
         type = chat                          :: chat | groupchat}).
 
index ea267c1c06fe31bec7e562eddf4ac7c870af861b..5e4bebb755ec149a31af4e41cef256b46fd4f613 100644 (file)
@@ -945,7 +945,7 @@ filter_by_max(Msgs, Len) when is_integer(Len), Len >= 0 ->
 filter_by_max(_Msgs, _Junk) ->
     {[], true}.
 
--spec limit_max(rsm_set(), binary()) -> rsm_set().
+-spec limit_max(rsm_set(), binary()) -> rsm_set() | undefined.
 limit_max(RSM, ?NS_MAM_TMP) ->
     RSM; % XEP-0313 v0.2 doesn't require clients to support RSM.
 limit_max(#rsm_set{max = Max} = RSM, _NS) when not is_integer(Max) ->
index 6e523198983d80c253761e43be9542fcf1cd304d..2a0dcce9545c80dba3746092000678ff73bed523 100644 (file)
@@ -217,13 +217,10 @@ make_sql_query(User, LServer,
                     true ->
                          []
                  end,
-    WithTextClause = case WithText of
-                        {text, <<>>} ->
-                            [];
-                        {text, Txt} ->
+    WithTextClause = if is_binary(WithText), WithText /= <<>> ->
                             [<<" and match (txt) against ('">>,
-                             Escape(Txt), <<"')">>];
-                        undefined ->
+                             Escape(WithText), <<"')">>];
+                       true ->
                             []
                     end,
     WithClause = case catch jid:tolower(With) of