25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

Suppress push notifications for online clients

When a client enabled push notifications during the current session,
notifications should be suppressed as long as the client is online.
Suppressing the notification didn't work for the case where the
notification was triggered by MAM, but this is now fixed.
This commit is contained in:
Holger Weiss 2017-08-18 16:44:32 +02:00
parent 0b02d42836
commit 13ad754ecc
3 changed files with 4 additions and 4 deletions

View File

@ -317,7 +317,8 @@ get_session_sids(User, Server) ->
LUser = jid:nodeprep(User), LUser = jid:nodeprep(User),
LServer = jid:nameprep(Server), LServer = jid:nameprep(Server),
Mod = get_sm_backend(LServer), Mod = get_sm_backend(LServer),
online(get_sessions(Mod, LUser, LServer)). OnlineSs = online(get_sessions(Mod, LUser, LServer)),
[SID || #session{sid = SID} <- OnlineSs].
-spec set_offline_info(sid(), binary(), binary(), binary(), info()) -> ok. -spec set_offline_info(sid(), binary(), binary(), binary(), info()) -> ok.

View File

@ -546,8 +546,9 @@ delete_sessions(LUser, LServer, LookupFun, Mod) ->
-> [push_session()]. -> [push_session()].
drop_online_sessions(LUser, LServer, Clients) -> drop_online_sessions(LUser, LServer, Clients) ->
SessIDs = ejabberd_sm:get_session_sids(LUser, LServer), SessIDs = ejabberd_sm:get_session_sids(LUser, LServer),
?WARNING_MSG("SessIDs: ~p", [SessIDs]),
[Client || {TS, _, _, _} = Client <- Clients, [Client || {TS, _, _, _} = Client <- Clients,
not lists:keyfind(TS, 1, SessIDs)]. lists:keyfind(TS, 1, SessIDs) == false].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Caching. %% Caching.

View File

@ -134,8 +134,6 @@ mam_slave(Config) ->
self_presence(Config, available), self_presence(Config, available),
ct:comment("Receiving message from offline storage"), ct:comment("Receiving message from offline storage"),
recv_test_message(Config), recv_test_message(Config),
ct:comment("Re-enabling push notifications"),
ok = enable_push(Config),
ct:comment("Enabling MAM"), ct:comment("Enabling MAM"),
ok = enable_mam(Config), ok = enable_mam(Config),
ct:comment("Letting the master know that we're ready"), ct:comment("Letting the master know that we're ready"),