aboutsummaryrefslogtreecommitdiff
path: root/src/mod_offline.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_offline.erl')
-rw-r--r--src/mod_offline.erl35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/mod_offline.erl b/src/mod_offline.erl
index 9e8af2c16..84187eb70 100644
--- a/src/mod_offline.erl
+++ b/src/mod_offline.erl
@@ -365,7 +365,6 @@ remove_msg_by_node(To, Seq) ->
-spec need_to_store(binary(), message()) -> boolean().
need_to_store(_LServer, #message{type = error}) -> false;
-need_to_store(_LServer, #message{type = groupchat}) -> false;
need_to_store(LServer, #message{type = Type} = Packet) ->
case xmpp:has_subtag(Packet, #offline{}) of
false ->
@@ -374,17 +373,26 @@ need_to_store(LServer, #message{type = Type} = Packet) ->
true;
no_store ->
false;
- none when Type == headline ->
- false;
none ->
- case gen_mod:get_module_opt(
- LServer, ?MODULE, store_empty_body) of
- true ->
+ 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 ->
+ {_, false} ->
Packet#message.body /= [];
- unless_chat_state ->
- not xmpp_util:is_standalone_chat_state(Packet)
+ {_, unless_chat_state} ->
+ not misc:is_standalone_chat_state(Packet)
end
end;
true ->
@@ -795,8 +803,8 @@ add_delay_info(Packet, LServer, TS) ->
_ -> TS
end,
Packet1 = xmpp:put_meta(Packet, from_offline, true),
- xmpp_util:add_delay_info(Packet1, jid:make(LServer), NewTS,
- <<"Offline storage">>).
+ misc:add_delay_info(Packet1, jid:make(LServer), NewTS,
+ <<"Offline storage">>).
-spec get_priority_from_presence(presence()) -> integer().
get_priority_from_presence(#presence{priority = Prio}) ->
@@ -837,6 +845,8 @@ import(LServer, {sql, _}, DBType, <<"spool">>,
mod_opt_type(access_max_user_messages) ->
fun acl:shaper_rules_validator/1;
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
+mod_opt_type(store_groupchat) ->
+ fun(V) when is_boolean(V) -> V end;
mod_opt_type(store_empty_body) ->
fun (V) when is_boolean(V) -> V;
(unless_chat_state) -> unless_chat_state
@@ -845,4 +855,5 @@ mod_opt_type(store_empty_body) ->
mod_options(Host) ->
[{db_type, ejabberd_config:default_db(Host, ?MODULE)},
{access_max_user_messages, max_user_offline_messages},
- {store_empty_body, unless_chat_state}].
+ {store_empty_body, unless_chat_state},
+ {store_groupchat, false}].