From a10493976e395ee4af4d8718e97fc3cb4dcc0191 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 27 Jan 2010 18:53:38 +0000 Subject: [PATCH] exmpp fixes in mod_muc (thanks to Karim Gemayel) SVN Revision: 2931 --- src/mod_muc/mod_muc.erl | 20 +++++++++++++++++--- src/mod_muc/mod_muc_room.erl | 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc/mod_muc.erl index cf329ee8f..d0f7162ae 100644 --- a/src/mod_muc/mod_muc.erl +++ b/src/mod_muc/mod_muc.erl @@ -616,9 +616,23 @@ iq_disco_items(Host, From, Lang, Rsm) -> {item, Desc} -> flush(), {true, - {xmlelement, "item", - [{"jid", jlib:jid_to_string({Name, Host, ""})}, - {"name", Desc}], []}}; + #xmlel{name = 'item', + attrs = [ + #xmlattr{ + name = 'jid', + value = jlib:jid_to_string({Name, Host, ""}) + }, + #xmlattr{ + name = 'name', + value = Desc + } + ] + } + }; + %{xmlelement, "item", + %[{"jid", jlib:jid_to_string({Name, Host, ""})}, + %{"name", Desc}], []}}; + _ -> false end diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc/mod_muc_room.erl index 81791408e..763f28bab 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc/mod_muc_room.erl @@ -1691,7 +1691,9 @@ add_new_user(From, Nick, Packet, StateData) -> case ejabberd_captcha:create_captcha( ID, SID, RoomJID, To, Lang, From) of {ok, CaptchaEls} -> - MsgPkt = {xmlelement, "message", [{"id", ID}], CaptchaEls}, + MsgPkt = #xmlel{name = 'message', + attrs = [#xmlattr{name = 'id', value = ID}], + children = CaptchaEls}, Robots = ?DICT:store(From, {Nick, Packet}, StateData#state.robots), ejabberd_router:route(RoomJID, From, MsgPkt),