diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-11-25 08:58:22 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-11-26 08:35:49 +0100 |
commit | 44f5e411c52c89b7d544eefa7ced637a56e9648d (patch) | |
tree | b4f0b76676a009e3bc7a99ba7bc1ea9657e07c02 /src/mod_offline.erl | |
parent | Always use occupant JID as 'from' for room subject (diff) |
mod_offline: Support discarding chat states
XEP-0160 says that standalone chat state notifications should not be
stored offline. By default, mod_offline discards them now.
Closes #842.
Diffstat (limited to 'src/mod_offline.erl')
-rw-r--r-- | src/mod_offline.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mod_offline.erl b/src/mod_offline.erl index a9f82370..c41770d3 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -286,10 +286,14 @@ need_to_store(LServer, Packet) -> and (Type /= <<"headline">>) -> case gen_mod:get_module_opt( LServer, ?MODULE, store_empty_body, - fun(V) when is_boolean(V) -> V end, - true) of + fun(V) when is_boolean(V) -> V; + (unless_chat_state) -> unless_chat_state + end, + unless_chat_state) of false -> xml:get_subtag(Packet, <<"body">>) /= false; + unless_chat_state -> + not jlib:is_standalone_chat_state(Packet); true -> true end; @@ -1129,6 +1133,8 @@ mod_opt_type(access_max_user_messages) -> fun (A) -> A end; mod_opt_type(db_type) -> fun gen_mod:v_db/1; mod_opt_type(store_empty_body) -> - fun (V) when is_boolean(V) -> V end; + fun (V) when is_boolean(V) -> V; + (unless_chat_state) -> unless_chat_state + end; mod_opt_type(_) -> [access_max_user_messages, db_type, store_empty_body]. |