25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

* src/mod_muc/mod_muc_room.erl: Bugfix: local message stanza may

not have an attribute From (EJAB-515)

SVN Revision: 1180
This commit is contained in:
Badlop 2008-02-11 12:15:34 +00:00
parent 116966ce44
commit 8104eac23a
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-02-11 Badlop <badlop@process-one.net>
* src/mod_muc/mod_muc_room.erl: Bugfix: local message stanza may
not have an attribute From (EJAB-515)
2008-02-08 Badlop <badlop@process-one.net> 2008-02-08 Badlop <badlop@process-one.net>
* src/mod_muc/mod_muc_room.erl: Include the error condition in the * src/mod_muc/mod_muc_room.erl: Include the error condition in the

View File

@ -1037,7 +1037,7 @@ get_error_condition(Packet) ->
case catch get_error_condition2(Packet) of case catch get_error_condition2(Packet) of
{condition, ErrorCondition} -> {condition, ErrorCondition} ->
ErrorCondition; ErrorCondition;
{'EXIT', Error} -> {'EXIT', _} ->
"badformed error stanza" "badformed error stanza"
end. end.
get_error_condition2(Packet) -> get_error_condition2(Packet) ->
@ -3104,7 +3104,7 @@ check_invitation(From, Els, Lang, StateData) ->
handle_roommessage_from_nonparticipant(Packet, Lang, StateData, From) -> handle_roommessage_from_nonparticipant(Packet, Lang, StateData, From) ->
case catch check_decline_invitation(Packet) of case catch check_decline_invitation(Packet) of
{true, Decline_data} -> {true, Decline_data} ->
send_decline_invitation(Decline_data, StateData#state.jid); send_decline_invitation(Decline_data, StateData#state.jid, From);
_ -> _ ->
send_error_only_occupants(Packet, Lang, StateData#state.jid, From) send_error_only_occupants(Packet, Lang, StateData#state.jid, From)
end. end.
@ -3114,18 +3114,18 @@ handle_roommessage_from_nonparticipant(Packet, Lang, StateData, From) ->
%% This function must be catched, %% This function must be catched,
%% because it crashes when the packet is not a decline message. %% because it crashes when the packet is not a decline message.
check_decline_invitation(Packet) -> check_decline_invitation(Packet) ->
{xmlelement, "message", PAttrs, _} = Packet, {xmlelement, "message", _, _} = Packet,
XEl = xml:get_subtag(Packet, "x"), XEl = xml:get_subtag(Packet, "x"),
?NS_MUC_USER = xml:get_tag_attr_s("xmlns", XEl), ?NS_MUC_USER = xml:get_tag_attr_s("xmlns", XEl),
DEl = xml:get_subtag(XEl, "decline"), DEl = xml:get_subtag(XEl, "decline"),
{value, FromString} = xml:get_attr("from", PAttrs),
ToString = xml:get_tag_attr_s("to", DEl), ToString = xml:get_tag_attr_s("to", DEl),
ToJID = jlib:string_to_jid(ToString), ToJID = jlib:string_to_jid(ToString),
{true, {Packet, XEl, DEl, FromString, ToJID}}. {true, {Packet, XEl, DEl, ToJID}}.
%% Send the decline to the inviter user. %% Send the decline to the inviter user.
%% The original stanza must be slightly modified. %% The original stanza must be slightly modified.
send_decline_invitation({Packet, XEl, DEl, FromString, ToJID}, RoomJID) -> send_decline_invitation({Packet, XEl, DEl, ToJID}, RoomJID, FromJID) ->
FromString = jlib:jid_to_string(FromJID),
{xmlelement, "decline", DAttrs, DEls} = DEl, {xmlelement, "decline", DAttrs, DEls} = DEl,
DAttrs2 = lists:keydelete("to", 1, DAttrs), DAttrs2 = lists:keydelete("to", 1, DAttrs),
DAttrs3 = [{"from", FromString} | DAttrs2], DAttrs3 = [{"from", FromString} | DAttrs2],