From 4feba7a5e6d0e41301378edf35c1d1ab7dd3fec0 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Tue, 21 Jul 2015 16:05:47 +0200 Subject: [PATCH] mod_mam_mnesia: Also check for hint Check for the and hints in addition to and . XEP-0334 (version 0.1) mentions both variants, and unfortunately, both of them are in use. --- mod_mam_mnesia/src/mod_mam_mnesia.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mod_mam_mnesia/src/mod_mam_mnesia.erl b/mod_mam_mnesia/src/mod_mam_mnesia.erl index 299c345..c415355 100644 --- a/mod_mam_mnesia/src/mod_mam_mnesia.erl +++ b/mod_mam_mnesia/src/mod_mam_mnesia.erl @@ -321,7 +321,7 @@ send_stanza(Stanza, _C2SState, _From, _To) -> Stanza. is_desired(Route, JID, To, Message) -> is_chat_or_normal_message(Message) andalso has_non_empty_body(Message) andalso - not has_no_storage_hint(Message) andalso + not has_no_store_hint(Message) andalso not is_bare_copy(Route, JID, To) andalso not is_resent(Message). @@ -354,11 +354,15 @@ has_non_empty_body(Message) -> xml:get_subtag_cdata(Message, <<"body">>) =/= <<"">> orelse xml:get_subtag(Message, <<"axolotl_message">>) =/= false. --spec has_no_storage_hint(xmlel()) -> boolean(). +-spec has_no_store_hint(xmlel()) -> boolean(). -has_no_storage_hint(Message) -> +has_no_store_hint(Message) -> + xml:get_subtag_with_xmlns(Message, <<"no-store">>, ?NS_HINTS) + =/= false orelse xml:get_subtag_with_xmlns(Message, <<"no-storage">>, ?NS_HINTS) =/= false orelse + xml:get_subtag_with_xmlns(Message, <<"no-permanent-store">>, ?NS_HINTS) + =/= false orelse xml:get_subtag_with_xmlns(Message, <<"no-permanent-storage">>, ?NS_HINTS) =/= false.