mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
In mod_last*:get_last_iq/4, check for user resources first to return 0 seconds if there is one
Fixes problem 2 of EJAB-1158.
This commit is contained in:
parent
6b46b8f794
commit
f4507a088a
@ -180,6 +180,16 @@ get_last(LUser, LServer) ->
|
||||
end.
|
||||
|
||||
get_last_iq(IQ_Rec, LUser, LServer) ->
|
||||
case ejabberd_sm:get_user_resources(LUser, LServer) of
|
||||
[] ->
|
||||
get_last_iq_disconnected(IQ_Rec, LUser, LServer);
|
||||
_ ->
|
||||
Sec = 0,
|
||||
#xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
||||
attrs = [?XMLATTR('seconds', Sec)]}
|
||||
end.
|
||||
|
||||
get_last_iq_disconnected(IQ_Rec, LUser, LServer) ->
|
||||
case get_last(LUser, LServer) of
|
||||
{error, _Reason} ->
|
||||
exmpp_iq:error(IQ_Rec, 'internal-server-error');
|
||||
|
Loading…
Reference in New Issue
Block a user