aboutsummaryrefslogtreecommitdiff
path: root/src/mod_offline.erl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2019-05-06 19:17:30 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2019-05-06 19:22:18 +0200
commit83b790c7c913e5af4ada5f01f7550a633ecf2d1f (patch)
treecac5fdf880377cefa10658ea3165d5f25dcb6daa /src/mod_offline.erl
parentHandle get_subscribed_rooms call from mod_muc_room pid (diff)
Do not store mucsub wrapped messages with no-store hint in offline storage
We already don't store those messages in mam and we don't store messages that aren't wrapped with that hint in offline, so it make sense to extend it also to mucsub messages.
Diffstat (limited to 'src/mod_offline.erl')
-rw-r--r--src/mod_offline.erl55
1 files changed, 31 insertions, 24 deletions
diff --git a/src/mod_offline.erl b/src/mod_offline.erl
index 0c70ae065..3e240dbfb 100644
--- a/src/mod_offline.erl
+++ b/src/mod_offline.erl
@@ -405,31 +405,38 @@ need_to_store(_LServer, #message{type = error}) -> false;
need_to_store(LServer, #message{type = Type} = Packet) ->
case xmpp:has_subtag(Packet, #offline{}) of
false ->
- case check_store_hint(Packet) of
- store ->
- true;
- no_store ->
- false;
- none ->
- Store = case Type of
- groupchat ->
- gen_mod:get_module_opt(
- LServer, ?MODULE, store_groupchat);
- headline ->
- false;
- _ ->
- true
- end,
- case {Store, gen_mod:get_module_opt(
- LServer, ?MODULE, store_empty_body)} of
- {false, _} ->
- false;
- {_, true} ->
+ case misc:unwrap_mucsub_message(Packet) of
+ #message{type = groupchat} = Msg ->
+ need_to_store(LServer, Msg#message{type = chat});
+ #message{} = Msg ->
+ need_to_store(LServer, Msg);
+ _ ->
+ case check_store_hint(Packet) of
+ store ->
true;
- {_, false} ->
- Packet#message.body /= [];
- {_, unless_chat_state} ->
- not misc:is_standalone_chat_state(Packet)
+ no_store ->
+ false;
+ none ->
+ Store = case Type of
+ groupchat ->
+ gen_mod:get_module_opt(
+ LServer, ?MODULE, store_groupchat);
+ headline ->
+ false;
+ _ ->
+ true
+ end,
+ case {Store, gen_mod:get_module_opt(
+ LServer, ?MODULE, store_empty_body)} of
+ {false, _} ->
+ false;
+ {_, true} ->
+ true;
+ {_, false} ->
+ Packet#message.body /= [];
+ {_, unless_chat_state} ->
+ not misc:is_standalone_chat_state(Packet)
+ end
end
end;
true ->