mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
mod_muc_room.erl: Fix bug in MUC invite.
SVN Revision: 1736
This commit is contained in:
parent
69805f36fa
commit
d3ddf10839
@ -1,3 +1,7 @@
|
||||
2008-12-17 Pablo Polvorin <pablo.polvorin@process-one.net>
|
||||
|
||||
* src/mod_muc/mod_muc_room.erl: Fix bug in MUC invite.
|
||||
|
||||
2008-12-17 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||
|
||||
Merge from trunk (r1730 to r1734).
|
||||
|
@ -261,7 +261,7 @@ normal_state({route, From, undefined,
|
||||
StateData#state.jid,
|
||||
From, exmpp_stanza:reply_with_error(Packet, Err)),
|
||||
{next_state, normal_state, StateData};
|
||||
normal ->
|
||||
Type when (Type == 'normal') orelse (Type == 'undefined') ->
|
||||
case catch check_invitation(From,
|
||||
exmpp_xml:get_child_elements(Packet),
|
||||
Lang,
|
||||
@ -884,7 +884,7 @@ process_presence(From, Nick, #xmlel{name = 'presence'} = Packet,
|
||||
_ ->
|
||||
StateData
|
||||
end;
|
||||
available ->
|
||||
'available' ->
|
||||
case is_user_online(From, StateData) of
|
||||
true ->
|
||||
case is_nick_change(From, Nick, StateData) of
|
||||
@ -3236,23 +3236,24 @@ check_invitation(From, Els, Lang, StateData) ->
|
||||
InviteEl,
|
||||
[{element, 'reason'}, cdata]),
|
||||
ContinueEl =
|
||||
case xml:get_path(
|
||||
case exmpp_xml:get_path(
|
||||
InviteEl,
|
||||
[{element, 'continue'}]) of
|
||||
[] -> [];
|
||||
'undefined' -> [];
|
||||
Continue1 -> [Continue1]
|
||||
end,
|
||||
IEl =
|
||||
[#xmlel{name = 'invite',
|
||||
[#xmlel{ns = ?NS_MUC_USER,
|
||||
name = 'invite',
|
||||
attrs = [#xmlattr{name = 'from',
|
||||
value = exmpp_jid:jid_to_list(From)}],
|
||||
children = [#xmlel{name = 'reason',
|
||||
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
|
||||
children = [#xmlcdata{cdata = Reason} ]}]
|
||||
++ ContinueEl}],
|
||||
PasswdEl =
|
||||
case (StateData#state.config)#config.password_protected of
|
||||
true ->
|
||||
[#xmlel{name = 'password',
|
||||
[#xmlel{ns = ?NS_MUC_USER, name = 'password',
|
||||
children = [#xmlcdata{cdata =
|
||||
(StateData#state.config)#config.password}]}];
|
||||
_ ->
|
||||
@ -3261,7 +3262,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
||||
Body =
|
||||
#xmlel{name = 'body',
|
||||
children = [#xmlcdata{cdata =
|
||||
lists:flatten(
|
||||
list_to_binary([
|
||||
io_lib:format(
|
||||
translate:translate(Lang,
|
||||
"~s invites you to the room ~s"),
|
||||
@ -3269,7 +3270,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
||||
exmpp_jid:jid_to_list(StateData#state.room,
|
||||
StateData#state.host,
|
||||
"")
|
||||
])) ++
|
||||
]),
|
||||
case (StateData#state.config)#config.password_protected of
|
||||
true ->
|
||||
", " ++
|
||||
@ -3278,14 +3279,15 @@ check_invitation(From, Els, Lang, StateData) ->
|
||||
(StateData#state.config)#config.password ++ "'";
|
||||
_ ->
|
||||
""
|
||||
end ++
|
||||
end,
|
||||
case Reason of
|
||||
"" -> "";
|
||||
_ -> " (" ++ Reason ++ ") "
|
||||
<<>> -> "";
|
||||
_ -> [" (", Reason, ") "]
|
||||
end
|
||||
}]},
|
||||
])}]},
|
||||
%%TODO: always NS_JABER_CLIENT?
|
||||
Msg =
|
||||
#xmlel{name = 'message',
|
||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'message',
|
||||
attrs = [#xmlattr{name = 'type', value = "normal"}],
|
||||
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||
children = IEl ++ PasswdEl},
|
||||
|
Loading…
Reference in New Issue
Block a user