mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix set_presence API
This commit is contained in:
parent
db240413ab
commit
e7843bf92b
@ -872,17 +872,26 @@ stringize(String) ->
|
|||||||
%% Replace newline characters with other code
|
%% Replace newline characters with other code
|
||||||
ejabberd_regexp:greplace(String, <<"\n">>, <<"\\n">>).
|
ejabberd_regexp:greplace(String, <<"\n">>, <<"\\n">>).
|
||||||
|
|
||||||
|
set_presence(User, Host, Resource, Type, Show, Status, Priority)
|
||||||
|
when is_integer(Priority) ->
|
||||||
|
BPriority = integer_to_binary(Priority),
|
||||||
|
set_presence(User, Host, Resource, Type, Show, Status, BPriority);
|
||||||
set_presence(User, Host, Resource, Type, Show, Status, Priority) ->
|
set_presence(User, Host, Resource, Type, Show, Status, Priority) ->
|
||||||
Pid = ejabberd_sm:get_session_pid(User, Host, Resource),
|
case ejabberd_sm:get_session_pid(User, Host, Resource) of
|
||||||
USR = jid:to_string(jid:make(User, Host, Resource)),
|
none ->
|
||||||
US = jid:to_string(jid:make(User, Host, <<>>)),
|
error;
|
||||||
Message = {route_xmlstreamelement,
|
Pid ->
|
||||||
{xmlel, <<"presence">>,
|
USR = jid:to_string(jid:make(User, Host, Resource)),
|
||||||
[{<<"from">>, USR}, {<<"to">>, US}, {<<"type">>, Type}],
|
US = jid:to_string(jid:make(User, Host, <<>>)),
|
||||||
[{xmlel, <<"show">>, [], [{xmlcdata, Show}]},
|
Message = {route_xmlstreamelement,
|
||||||
{xmlel, <<"status">>, [], [{xmlcdata, Status}]},
|
{xmlel, <<"presence">>,
|
||||||
{xmlel, <<"priority">>, [], [{xmlcdata, Priority}]}]}},
|
[{<<"from">>, USR}, {<<"to">>, US}, {<<"type">>, Type}],
|
||||||
Pid ! Message.
|
[{xmlel, <<"show">>, [], [{xmlcdata, Show}]},
|
||||||
|
{xmlel, <<"status">>, [], [{xmlcdata, Status}]},
|
||||||
|
{xmlel, <<"priority">>, [], [{xmlcdata, Priority}]}]}},
|
||||||
|
Pid ! Message,
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
user_sessions_info(User, Host) ->
|
user_sessions_info(User, Host) ->
|
||||||
CurrentSec = calendar:datetime_to_gregorian_seconds({date(), time()}),
|
CurrentSec = calendar:datetime_to_gregorian_seconds({date(), time()}),
|
||||||
|
Loading…
Reference in New Issue
Block a user