25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Handle get_presence(Pid) when session doesn't exist (#2547)

This commit is contained in:
Badlop 2018-08-15 12:16:01 +02:00
parent f3f3b1586e
commit c3361bab95

View File

@ -1003,6 +1003,13 @@ stringize(String) ->
ejabberd_regexp:greplace(String, <<"\n">>, <<"\\n">>). ejabberd_regexp:greplace(String, <<"\n">>, <<"\\n">>).
get_presence(Pid) -> get_presence(Pid) ->
try get_presence2(Pid) of
{_, _, _, _} = Res ->
Res
catch
_:_ -> {<<"">>, <<"">>, <<"offline">>, <<"">>}
end.
get_presence2(Pid) ->
Pres = #presence{from = From} = ejabberd_c2s:get_presence(Pid), Pres = #presence{from = From} = ejabberd_c2s:get_presence(Pid),
Show = case Pres of Show = case Pres of
#presence{type = unavailable} -> <<"unavailable">>; #presence{type = unavailable} -> <<"unavailable">>;