mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_muc/mod_muc_room.erl: Corrected error messages when
trying to join members-only room (thanks to Badlop) * src/ejabberd_c2s.erl: Added c2s_update_presence hook SVN Revision: 770
This commit is contained in:
parent
897cc13f42
commit
8c326ea928
@ -1,3 +1,10 @@
|
||||
2007-05-16 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_muc/mod_muc_room.erl: Corrected error messages when
|
||||
trying to join members-only room (thanks to Badlop)
|
||||
|
||||
* src/ejabberd_c2s.erl: Added c2s_update_presence hook
|
||||
|
||||
2007-05-14 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/ejd2odbc.erl: Bugfix (thanks to Badlop)
|
||||
|
@ -804,15 +804,22 @@ session_established({xmlstreamelement, El}, StateData) ->
|
||||
_ ->
|
||||
case Name of
|
||||
"presence" ->
|
||||
PresenceEl = ejabberd_hooks:run_fold(
|
||||
c2s_update_presence,
|
||||
Server,
|
||||
NewEl,
|
||||
[User, Server]),
|
||||
case ToJID of
|
||||
#jid{user = User,
|
||||
server = Server,
|
||||
resource = ""} ->
|
||||
?DEBUG("presence_update(~p,~n\t~p,~n\t~p)",
|
||||
[FromJID, NewEl, StateData]),
|
||||
presence_update(FromJID, NewEl, StateData);
|
||||
[FromJID, PresenceEl, StateData]),
|
||||
presence_update(FromJID, PresenceEl,
|
||||
StateData);
|
||||
_ ->
|
||||
presence_track(FromJID, ToJID, NewEl, StateData)
|
||||
presence_track(FromJID, ToJID, PresenceEl,
|
||||
StateData)
|
||||
end;
|
||||
"iq" ->
|
||||
case StateData#state.privacy_list of
|
||||
|
@ -970,29 +970,11 @@ is_nick_change(JID, Nick, StateData) ->
|
||||
|
||||
add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
|
||||
Lang = xml:get_attr_s("xml:lang", Attrs),
|
||||
case {is_nick_exists(Nick, StateData),
|
||||
mod_muc:can_use_nick(StateData#state.host, From, Nick)} of
|
||||
{true, _} ->
|
||||
ErrText = "Nickname is already in use by another occupant",
|
||||
Err = jlib:make_error_reply(Packet, ?ERRT_CONFLICT(Lang, ErrText)),
|
||||
ejabberd_router:route(
|
||||
% TODO: s/Nick/""/
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
From, Err),
|
||||
StateData;
|
||||
{_, false} ->
|
||||
ErrText = "Nickname is registered by another person",
|
||||
Err = jlib:make_error_reply(Packet, ?ERRT_CONFLICT(Lang, ErrText)),
|
||||
ejabberd_router:route(
|
||||
% TODO: s/Nick/""/
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
From, Err),
|
||||
StateData;
|
||||
_ ->
|
||||
Affiliation = get_affiliation(From, StateData),
|
||||
Role = get_default_role(Affiliation, StateData),
|
||||
case Role of
|
||||
none ->
|
||||
case {is_nick_exists(Nick, StateData),
|
||||
mod_muc:can_use_nick(StateData#state.host, From, Nick),
|
||||
get_default_role(Affiliation, StateData)} of
|
||||
{_, _, none} ->
|
||||
Err = jlib:make_error_reply(
|
||||
Packet,
|
||||
case Affiliation of
|
||||
@ -1007,7 +989,23 @@ add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
From, Err),
|
||||
StateData;
|
||||
_ ->
|
||||
{true, _, _} ->
|
||||
ErrText = "Nickname is already in use by another occupant",
|
||||
Err = jlib:make_error_reply(Packet, ?ERRT_CONFLICT(Lang, ErrText)),
|
||||
ejabberd_router:route(
|
||||
% TODO: s/Nick/""/
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
From, Err),
|
||||
StateData;
|
||||
{_, false, _} ->
|
||||
ErrText = "Nickname is registered by another person",
|
||||
Err = jlib:make_error_reply(Packet, ?ERRT_CONFLICT(Lang, ErrText)),
|
||||
ejabberd_router:route(
|
||||
% TODO: s/Nick/""/
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
From, Err),
|
||||
StateData;
|
||||
{_, _, Role} ->
|
||||
case check_password(Affiliation, Els, StateData) of
|
||||
true ->
|
||||
NewState =
|
||||
@ -1062,7 +1060,6 @@ add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
|
||||
From, Err),
|
||||
StateData
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
check_password(owner, _Els, _StateData) ->
|
||||
|
Loading…
Reference in New Issue
Block a user