Skip to content

Commit

Permalink
Make set_presence command return error when session not found
Browse files Browse the repository at this point in the history
Should fix issue #4274
  • Loading branch information
prefiks committed Sep 2, 2024
1 parent 5f47860 commit 017b2fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mod_admin_extra.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,10 @@ set_presence(User, Host, Resource, Type, Show, Status, Priority) ->
show = misc:binary_to_atom(Show),
priority = Priority,
sub_els = []},
Ref = ejabberd_sm:get_session_pid(User, Host, Resource),
ejabberd_c2s:set_presence(Ref, Pres).
case ejabberd_sm:get_session_pid(User, Host, Resource) of
none -> throw({error, "User session not found"});
Ref -> ejabberd_c2s:set_presence(Ref, Pres)
end.

user_sessions_info(User, Host) ->
lists:filtermap(fun(Resource) ->
Expand Down

0 comments on commit 017b2fe

Please sign in to comment.