mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Fix compilation on OTP < 21 and remove dialyzer warning
This commit is contained in:
parent
b88fda9494
commit
4247501dc6
@ -644,7 +644,7 @@ normal_state({route, ToNick,
|
|||||||
normal_state(hibernate, StateData) ->
|
normal_state(hibernate, StateData) ->
|
||||||
case maps:size(StateData#state.users) of
|
case maps:size(StateData#state.users) of
|
||||||
0 ->
|
0 ->
|
||||||
store_room_no_checks(StateData, [], erlang:system_time(microsecond)),
|
store_room_no_checks(StateData, [], true),
|
||||||
?INFO_MSG("Hibernating room ~ts@~ts", [StateData#state.room, StateData#state.host]),
|
?INFO_MSG("Hibernating room ~ts@~ts", [StateData#state.room, StateData#state.host]),
|
||||||
{stop, normal, StateData#state{hibernate_timer = hibernating}};
|
{stop, normal, StateData#state{hibernate_timer = hibernating}};
|
||||||
_ ->
|
_ ->
|
||||||
@ -3997,8 +3997,8 @@ set_vcard_xupdate(State) ->
|
|||||||
-define(MAKE_CONFIG_OPT(Opt),
|
-define(MAKE_CONFIG_OPT(Opt),
|
||||||
{get_config_opt_name(Opt), element(Opt, Config)}).
|
{get_config_opt_name(Opt), element(Opt, Config)}).
|
||||||
|
|
||||||
-spec make_opts(state(), integer | undefined) -> [{atom(), any()}].
|
-spec make_opts(state(), boolean()) -> [{atom(), any()}].
|
||||||
make_opts(StateData, HibernationTime) ->
|
make_opts(StateData, Hibernation) ->
|
||||||
Config = StateData#state.config,
|
Config = StateData#state.config,
|
||||||
Subscribers = muc_subscribers_fold(
|
Subscribers = muc_subscribers_fold(
|
||||||
fun(_LJID, Sub, Acc) ->
|
fun(_LJID, Sub, Acc) ->
|
||||||
@ -4042,7 +4042,7 @@ make_opts(StateData, HibernationTime) ->
|
|||||||
{hats_users,
|
{hats_users,
|
||||||
lists:map(fun({U, H}) -> {U, maps:to_list(H)} end,
|
lists:map(fun({U, H}) -> {U, maps:to_list(H)} end,
|
||||||
maps:to_list(StateData#state.hats_users))},
|
maps:to_list(StateData#state.hats_users))},
|
||||||
{hibernation_time, HibernationTime},
|
{hibernation_time, if Hibernation -> erlang:system_time(microsecond); true -> undefined end},
|
||||||
{subscribers, Subscribers}].
|
{subscribers, Subscribers}].
|
||||||
|
|
||||||
expand_opts(CompactOpts) ->
|
expand_opts(CompactOpts) ->
|
||||||
@ -5004,13 +5004,13 @@ add_to_log(Type, Data, StateData)
|
|||||||
when Type == roomconfig_change_disabledlogging ->
|
when Type == roomconfig_change_disabledlogging ->
|
||||||
mod_muc_log:add_to_log(StateData#state.server_host,
|
mod_muc_log:add_to_log(StateData#state.server_host,
|
||||||
roomconfig_change, Data, StateData#state.jid,
|
roomconfig_change, Data, StateData#state.jid,
|
||||||
make_opts(StateData, undefined));
|
make_opts(StateData, false));
|
||||||
add_to_log(Type, Data, StateData) ->
|
add_to_log(Type, Data, StateData) ->
|
||||||
case (StateData#state.config)#config.logging of
|
case (StateData#state.config)#config.logging of
|
||||||
true ->
|
true ->
|
||||||
mod_muc_log:add_to_log(StateData#state.server_host,
|
mod_muc_log:add_to_log(StateData#state.server_host,
|
||||||
Type, Data, StateData#state.jid,
|
Type, Data, StateData#state.jid,
|
||||||
make_opts(StateData, undefined));
|
make_opts(StateData, false));
|
||||||
false -> ok
|
false -> ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -5075,16 +5075,18 @@ store_room(StateData, ChangesHints) ->
|
|||||||
StateData#state.host, StateData#state.room,
|
StateData#state.host, StateData#state.room,
|
||||||
ChangesHints);
|
ChangesHints);
|
||||||
_ ->
|
_ ->
|
||||||
store_room_no_checks(StateData, ChangesHints, undefined)
|
store_room_no_checks(StateData, ChangesHints, false),
|
||||||
|
ok
|
||||||
end;
|
end;
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
store_room_no_checks(StateData, ChangesHints, HibernationTime) ->
|
-spec store_room_no_checks(state(), list(), boolean()) -> {atomic, any()}.
|
||||||
|
store_room_no_checks(StateData, ChangesHints, Hibernation) ->
|
||||||
mod_muc:store_room(StateData#state.server_host,
|
mod_muc:store_room(StateData#state.server_host,
|
||||||
StateData#state.host, StateData#state.room,
|
StateData#state.host, StateData#state.room,
|
||||||
make_opts(StateData, HibernationTime),
|
make_opts(StateData, Hibernation),
|
||||||
ChangesHints).
|
ChangesHints).
|
||||||
|
|
||||||
-spec send_subscriptions_change_notifications(jid(), binary(), subscribe|unsubscribe, state()) -> ok.
|
-spec send_subscriptions_change_notifications(jid(), binary(), subscribe|unsubscribe, state()) -> ok.
|
||||||
|
@ -523,7 +523,8 @@ clean_tables(ServerHost) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
usec_to_sql_timestamp(Timestamp) ->
|
usec_to_sql_timestamp(Timestamp) ->
|
||||||
case calendar:system_time_to_universal_time(Timestamp, microsecond) of
|
TS = misc:usec_to_now(Timestamp),
|
||||||
|
case calendar:now_to_universal_time(TS) of
|
||||||
{{Year, Month, Day}, {Hour, Minute, Second}} ->
|
{{Year, Month, Day}, {Hour, Minute, Second}} ->
|
||||||
list_to_binary(io_lib:format("~4..0B-~2..0B-~2..0B "
|
list_to_binary(io_lib:format("~4..0B-~2..0B-~2..0B "
|
||||||
"~2..0B:~2..0B:~2..0B",
|
"~2..0B:~2..0B:~2..0B",
|
||||||
|
Loading…
Reference in New Issue
Block a user