summaryrefslogtreecommitdiff
path: root/src/mod_admin_extra.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2017-07-07 10:55:08 +0200
committerBadlop <badlop@process-one.net>2017-07-07 10:55:08 +0200
commitaaef1a14b4f79c42f5943fd9149ecee3ca48cdb1 (patch)
tree6668afa66ecf581b74758aaf8da8ed14a0382428 /src/mod_admin_extra.erl
parentAdd copyright and fix description for some sources (diff)
Fix set_presence command to work in recent ejabberd
Diffstat (limited to 'src/mod_admin_extra.erl')
-rw-r--r--src/mod_admin_extra.erl24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl
index e5d2892f..f2cb6927 100644
--- a/src/mod_admin_extra.erl
+++ b/src/mod_admin_extra.erl
@@ -1002,20 +1002,16 @@ set_presence(User, Host, Resource, Type, Show, Status, Priority0) ->
Priority = if is_integer(Priority0) -> Priority0;
true -> binary_to_integer(Priority0)
end,
- case ejabberd_sm:get_session_pid(User, Host, Resource) of
- none ->
- error;
- Pid ->
- From = jid:make(User, Host, Resource),
- To = jid:make(User, Host),
- Presence = #presence{from = From, to = To,
- type = misc:binary_to_atom(Type),
- show = misc:binary_to_atom(Show),
- status = xmpp:mk_text(Status),
- priority = Priority},
- Pid ! {route, Presence},
- ok
- end.
+ Pres = #presence{
+ from = jid:make(User, Host, Resource),
+ to = jid:make(User, Host),
+ type = misc:binary_to_atom(Type),
+ status = xmpp:mk_text(Status),
+ 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).
user_sessions_info(User, Host) ->
CurrentSec = calendar:datetime_to_gregorian_seconds({date(), time()}),