Process on_user_offline only from valid sessions

This commit is contained in:
Christophe Romain 2017-08-11 12:05:14 +02:00
parent 35eeaa5869
commit 7a90cda8ff
1 changed files with 3 additions and 2 deletions

View File

@ -593,9 +593,10 @@ on_user_online(C2SState) ->
C2SState.
-spec on_user_offline(ejabberd_c2s:state(), atom()) -> ejabberd_c2s:state().
on_user_offline(C2SState, _Reason) ->
JID = maps:get(jid, C2SState),
on_user_offline(#{jid := JID} = C2SState, _Reason) ->
purge_offline(jid:tolower(JID)),
C2SState;
on_user_offline(C2SState, _Reason) ->
C2SState.
%% -------