Add option to mod_offline that would allow storing group chat messages
This commit is contained in:
parent
788d829823
commit
69a986a09e
|
@ -374,16 +374,25 @@ need_to_store(LServer, #message{type = Type} = Packet) ->
|
||||||
true;
|
true;
|
||||||
no_store ->
|
no_store ->
|
||||||
false;
|
false;
|
||||||
none when Type == headline ->
|
|
||||||
false;
|
|
||||||
none ->
|
none ->
|
||||||
case gen_mod:get_module_opt(
|
Store = case Type of
|
||||||
LServer, ?MODULE, store_empty_body) of
|
groupchat ->
|
||||||
true ->
|
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;
|
true;
|
||||||
false ->
|
{_, false} ->
|
||||||
Packet#message.body /= [];
|
Packet#message.body /= [];
|
||||||
unless_chat_state ->
|
{_, unless_chat_state} ->
|
||||||
not misc:is_standalone_chat_state(Packet)
|
not misc:is_standalone_chat_state(Packet)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
@ -837,6 +846,8 @@ import(LServer, {sql, _}, DBType, <<"spool">>,
|
||||||
mod_opt_type(access_max_user_messages) ->
|
mod_opt_type(access_max_user_messages) ->
|
||||||
fun acl:shaper_rules_validator/1;
|
fun acl:shaper_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
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) ->
|
mod_opt_type(store_empty_body) ->
|
||||||
fun (V) when is_boolean(V) -> V;
|
fun (V) when is_boolean(V) -> V;
|
||||||
(unless_chat_state) -> unless_chat_state
|
(unless_chat_state) -> unless_chat_state
|
||||||
|
@ -845,4 +856,5 @@ mod_opt_type(store_empty_body) ->
|
||||||
mod_options(Host) ->
|
mod_options(Host) ->
|
||||||
[{db_type, ejabberd_config:default_db(Host, ?MODULE)},
|
[{db_type, ejabberd_config:default_db(Host, ?MODULE)},
|
||||||
{access_max_user_messages, max_user_offline_messages},
|
{access_max_user_messages, max_user_offline_messages},
|
||||||
{store_empty_body, unless_chat_state}].
|
{store_empty_body, unless_chat_state},
|
||||||
|
{store_groupchat, false}].
|
||||||
|
|
Loading…
Reference in New Issue