24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-10 21:47:01 +02: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:
Andreas Köhler 2010-11-05 18:38:42 +01:00 committed by Badlop
parent 6b46b8f794
commit f4507a088a

View File

@ -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');