mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +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>
|
2007-05-14 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/ejd2odbc.erl: Bugfix (thanks to Badlop)
|
* src/ejd2odbc.erl: Bugfix (thanks to Badlop)
|
||||||
|
@ -804,15 +804,22 @@ session_established({xmlstreamelement, El}, StateData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
case Name of
|
case Name of
|
||||||
"presence" ->
|
"presence" ->
|
||||||
|
PresenceEl = ejabberd_hooks:run_fold(
|
||||||
|
c2s_update_presence,
|
||||||
|
Server,
|
||||||
|
NewEl,
|
||||||
|
[User, Server]),
|
||||||
case ToJID of
|
case ToJID of
|
||||||
#jid{user = User,
|
#jid{user = User,
|
||||||
server = Server,
|
server = Server,
|
||||||
resource = ""} ->
|
resource = ""} ->
|
||||||
?DEBUG("presence_update(~p,~n\t~p,~n\t~p)",
|
?DEBUG("presence_update(~p,~n\t~p,~n\t~p)",
|
||||||
[FromJID, NewEl, StateData]),
|
[FromJID, PresenceEl, StateData]),
|
||||||
presence_update(FromJID, NewEl, StateData);
|
presence_update(FromJID, PresenceEl,
|
||||||
|
StateData);
|
||||||
_ ->
|
_ ->
|
||||||
presence_track(FromJID, ToJID, NewEl, StateData)
|
presence_track(FromJID, ToJID, PresenceEl,
|
||||||
|
StateData)
|
||||||
end;
|
end;
|
||||||
"iq" ->
|
"iq" ->
|
||||||
case StateData#state.privacy_list of
|
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) ->
|
add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
|
||||||
Lang = xml:get_attr_s("xml:lang", Attrs),
|
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),
|
Affiliation = get_affiliation(From, StateData),
|
||||||
Role = get_default_role(Affiliation, StateData),
|
case {is_nick_exists(Nick, StateData),
|
||||||
case Role of
|
mod_muc:can_use_nick(StateData#state.host, From, Nick),
|
||||||
none ->
|
get_default_role(Affiliation, StateData)} of
|
||||||
|
{_, _, none} ->
|
||||||
Err = jlib:make_error_reply(
|
Err = jlib:make_error_reply(
|
||||||
Packet,
|
Packet,
|
||||||
case Affiliation of
|
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),
|
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||||
From, Err),
|
From, Err),
|
||||||
StateData;
|
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
|
case check_password(Affiliation, Els, StateData) of
|
||||||
true ->
|
true ->
|
||||||
NewState =
|
NewState =
|
||||||
@ -1062,7 +1060,6 @@ add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
|
|||||||
From, Err),
|
From, Err),
|
||||||
StateData
|
StateData
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
check_password(owner, _Els, _StateData) ->
|
check_password(owner, _Els, _StateData) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user