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

Make set_presence command return error when session not found

Should fix issue #4274
This commit is contained in:
Paweł Chmielowski 2024-09-02 12:01:56 +02:00
parent 5f47860ee1
commit 017b2feac1

View File

@ -1425,8 +1425,10 @@ set_presence(User, Host, Resource, Type, Show, Status, Priority) ->
show = misc:binary_to_atom(Show), show = misc:binary_to_atom(Show),
priority = Priority, priority = Priority,
sub_els = []}, sub_els = []},
Ref = ejabberd_sm:get_session_pid(User, Host, Resource), case ejabberd_sm:get_session_pid(User, Host, Resource) of
ejabberd_c2s:set_presence(Ref, Pres). none -> throw({error, "User session not found"});
Ref -> ejabberd_c2s:set_presence(Ref, Pres)
end.
user_sessions_info(User, Host) -> user_sessions_info(User, Host) ->
lists:filtermap(fun(Resource) -> lists:filtermap(fun(Resource) ->