From 151668ac10613c7c47d62db6c3d102b536f7a3e4 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Tue, 13 Sep 2016 16:56:34 +0300 Subject: [PATCH] Fix dialyzer warnings for mod_mam --- include/mod_mam.hrl | 2 +- src/mod_mam.erl | 2 +- src/mod_mam_sql.erl | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/mod_mam.hrl b/include/mod_mam.hrl index 463db4cff..a2b92fca5 100644 --- a/include/mod_mam.hrl +++ b/include/mod_mam.hrl @@ -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}). diff --git a/src/mod_mam.erl b/src/mod_mam.erl index ea267c1c0..5e4bebb75 100644 --- a/src/mod_mam.erl +++ b/src/mod_mam.erl @@ -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) -> diff --git a/src/mod_mam_sql.erl b/src/mod_mam_sql.erl index 6e5231989..2a0dcce95 100644 --- a/src/mod_mam_sql.erl +++ b/src/mod_mam_sql.erl @@ -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