From c77358bdc1eebecd8fa51c1d850444e1c55d77c1 Mon Sep 17 00:00:00 2001 From: Maxim Ignatenko Date: Sun, 24 Jul 2011 15:01:04 +0300 Subject: [PATCH] Use exception handling in is_invitation/1 --- src/mod_muc/mod_muc_room.erl | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc/mod_muc_room.erl index 5f9edfd2f..16b8de841 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc/mod_muc_room.erl @@ -3715,20 +3715,19 @@ send_packet_to(Packet, To, StateData) -> % Invitation support is_invitation(Els) -> - case xml:remove_cdata(Els) of - [{xmlelement, "x", _Attrs1, Els1} = XEl] -> - case xml:get_tag_attr_s("xmlns", XEl) of - ?NS_MUC_USER -> - case xml:remove_cdata(Els1) of - [{xmlelement, "invite", _, _}] -> - true; - _ -> - false - end; - _ -> - false - end; - _ -> + try + case xml:remove_cdata(Els) of + [{xmlelement, "x", _Attrs1, Els1} = XEl] -> + case xml:get_tag_attr_s("xmlns", XEl) of + ?NS_MUC_USER -> + case xml:remove_cdata(Els1) of + [{xmlelement, "invite", _, _}] -> + true + end + end + end + catch + error: _ -> false end. -- 2.40.0