25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/mod_muc/mod_muc_room.erl: Remove user from room on receiving

of message or presence error from him

SVN Revision: 108
This commit is contained in:
Alexey Shchepin 2003-05-14 19:58:05 +00:00
parent 481cc2d1f4
commit 2d3aa901a9
2 changed files with 81 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2003-05-14 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc_room.erl: Remove user from room on receiving
of message or presence error from him
2003-05-12 Alexey Shchepin <alexey@sevcom.net> 2003-05-12 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_s2s_out.erl: Fixed error replies, added timeouts * src/ejabberd_s2s_out.erl: Fixed error replies, added timeouts

View File

@ -189,7 +189,20 @@ normal_state({route, From, "",
{next_state, normal_state, StateData} {next_state, normal_state, StateData}
end; end;
"error" -> "error" ->
{next_state, normal_state, StateData}; case is_user_online(From, StateData) of
true ->
NewState =
add_user_presence_un(
From,
{xmlelement, "presence",
[{"type", "unavailable"}], []},
StateData),
send_new_presence(From, NewState),
{next_state, normal_state,
remove_online_user(From, NewState)};
_ ->
{next_state, normal_state, StateData}
end;
Type when (Type == "") or (Type == "normal") -> Type when (Type == "") or (Type == "normal") ->
case check_invitation(From, Els, StateData) of case check_invitation(From, Els, StateData) of
error -> error ->
@ -296,8 +309,20 @@ normal_state({route, From, Nick,
_ -> _ ->
StateData StateData
end; end;
"error" -> % TODO "error" ->
StateData; case is_user_online(From, StateData) of
true ->
NewState =
add_user_presence_un(
From,
{xmlelement, "presence",
[{"type", "unavailable"}], []},
StateData),
send_new_presence(From, NewState),
remove_online_user(From, NewState);
_ ->
StateData
end;
"" -> "" ->
case is_user_online(From, StateData) of case is_user_online(From, StateData) of
true -> true ->
@ -388,6 +413,23 @@ normal_state({route, From, Nick,
normal_state({route, From, ToNick, normal_state({route, From, ToNick,
{xmlelement, "message", Attrs, Els} = Packet}, {xmlelement, "message", Attrs, Els} = Packet},
StateData) -> StateData) ->
case xml:get_attr_s("type", Attrs) of
"error" ->
case is_user_online(From, StateData) of
true ->
NewState =
add_user_presence_un(
From,
{xmlelement, "presence",
[{"type", "unavailable"}], []},
StateData),
send_new_presence(From, NewState),
{next_state, normal_state,
remove_online_user(From, NewState)};
_ ->
{next_state, normal_state, StateData}
end;
_ ->
case (StateData#state.config)#config.allow_private_messages case (StateData#state.config)#config.allow_private_messages
andalso is_user_online(From, StateData) of andalso is_user_online(From, StateData) of
true -> true ->
@ -396,23 +438,31 @@ normal_state({route, From, ToNick,
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_JID_NOT_FOUND), Packet, ?ERR_JID_NOT_FOUND),
ejabberd_router:route( ejabberd_router:route(
{StateData#state.room, StateData#state.host, ToNick}, {StateData#state.room,
StateData#state.host,
ToNick},
From, Err); From, Err);
ToJID -> ToJID ->
{ok, #user{nick = FromNick}} = {ok, #user{nick = FromNick}} =
?DICT:find(jlib:jid_tolower(From), ?DICT:find(jlib:jid_tolower(From),
StateData#state.users), StateData#state.users),
ejabberd_router:route( ejabberd_router:route(
{StateData#state.room, StateData#state.host, FromNick}, {StateData#state.room,
StateData#state.host,
FromNick},
ToJID, Packet) ToJID, Packet)
end; end,
{next_state, normal_state, StateData};
_ -> _ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_NOT_ALLOWED), Packet, ?ERR_NOT_ALLOWED),
ejabberd_router:route( ejabberd_router:route(
{StateData#state.room, StateData#state.host, ToNick}, From, Err) {StateData#state.room,
end, StateData#state.host,
{next_state, normal_state, StateData}; ToNick}, From, Err),
{next_state, normal_state, StateData}
end
end;
normal_state({route, From, ToNick, normal_state({route, From, ToNick,
{xmlelement, "iq", Attrs, Els} = Packet}, {xmlelement, "iq", Attrs, Els} = Packet},