From 1fcf7b5cb1ac74d4cb849a0bce0c10769d1f9f42 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 19 Oct 2018 18:08:10 +0200 Subject: [PATCH] Provide meaningful Show when user is online with no Show set (#260) --- mod_webpresence/src/mod_webpresence.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod_webpresence/src/mod_webpresence.erl b/mod_webpresence/src/mod_webpresence.erl index 0251341..7a58013 100644 --- a/mod_webpresence/src/mod_webpresence.erl +++ b/mod_webpresence/src/mod_webpresence.erl @@ -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)];