From 18be432fdf95be77a2aca40b486a9744ca437f91 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 7 Nov 2018 13:00:33 +0100 Subject: [PATCH] Fix crash using Conversations requesting xml/ (#261) Conversations doesn't set Priority, in that case assume it's zero: If no priority is provided, the processing server or client MUST consider the priority to be zero ("0"). https://tools.ietf.org/html/rfc6121#section-4.7.2.3 --- mod_webpresence/src/mod_webpresence.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod_webpresence/src/mod_webpresence.erl b/mod_webpresence/src/mod_webpresence.erl index 7a58013..abd366a 100644 --- a/mod_webpresence/src/mod_webpresence.erl +++ b/mod_webpresence/src/mod_webpresence.erl @@ -614,7 +614,7 @@ get_presences({xml, LUser, LServer, Show_us}) -> attrs = [ {<<"name">>, Presence#presence2.resource}, {<<"show">>, Presence#presence2.show}, - {<<"priority">>, iolist_to_binary(integer_to_list(Presence#presence2.priority))} + {<<"priority">>, intund2string(Presence#presence2.priority)} ], children = [{xmlcdata, Presence#presence2.status}] } @@ -711,7 +711,7 @@ long_show(<<"xa">>, Lang) -> ?T(<<"extended away">>); long_show(<<"dnd">>, Lang) -> ?T(<<"do not disturb">>); long_show(_, Lang) -> ?T(<<"unavailable">>). -intund2string(undefined) -> <<"undefined">>; +intund2string(undefined) -> intund2string(0); intund2string(Int) when is_integer(Int) -> list_to_binary(integer_to_list(Int)). escape(S1) ->