Provide meaningful Show when user is online with no Show set (#260)

This commit is contained in:
Badlop 2018-10-19 18:08:10 +02:00
parent a43bc6f794
commit 1fcf7b5cb1
1 changed files with 6 additions and 1 deletions

View File

@ -573,10 +573,15 @@ get_status_weight(Show) ->
session_to_presence(#session{sid = {_, Pid}}) ->
P = ejabberd_c2s:get_presence(Pid),
#presence2{resource = (P#presence.from)#jid.resource,
show = misc:atom_to_binary(P#presence.show),
show = misc:atom_to_binary(humanize_show(P#presence.show)),
priority = P#presence.priority,
status = xmpp:get_text(P#presence.status)}.
humanize_show(undefined) ->
available;
humanize_show(Show) ->
Show.
get_presences({bare, LUser, LServer}) ->
[session_to_presence(Session) ||
Session <- mnesia:dirty_index_read(session, {LUser, LServer}, #session.us)];