mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_muc/mod_muc_room.erl: Debug output switched off
* src/mod_disco.erl: Server identity changed to "service/im" * src/mod_register.erl: Fixed jabber:iq:register handler registration, fixed registration removal processing SVN Revision: 140
This commit is contained in:
parent
3df8ed2cc1
commit
aa9f1549f4
@ -1,3 +1,12 @@
|
|||||||
|
2003-09-19 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/mod_muc/mod_muc_room.erl: Debug output switched off
|
||||||
|
|
||||||
|
* src/mod_disco.erl: Server identity changed to "service/im"
|
||||||
|
|
||||||
|
* src/mod_register.erl: Fixed jabber:iq:register handler
|
||||||
|
registration, fixed registration removal processing
|
||||||
|
|
||||||
2003-09-16 Alexey Shchepin <alexey@sevcom.net>
|
2003-09-16 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/mod_disco.erl: Now only admin can discovery some nodes,
|
* src/mod_disco.erl: Now only admin can discovery some nodes,
|
||||||
|
@ -62,8 +62,9 @@ loop() ->
|
|||||||
end,
|
end,
|
||||||
loop();
|
loop();
|
||||||
{open_session, User, Resource, From} ->
|
{open_session, User, Resource, From} ->
|
||||||
replace_and_register_my_connection(User, Resource, From),
|
register_connection(User, Resource, From),
|
||||||
replace_alien_connection(User, Resource),
|
%replace_and_register_my_connection(User, Resource, From),
|
||||||
|
%replace_alien_connection(User, Resource),
|
||||||
loop();
|
loop();
|
||||||
{close_session, User, Resource} ->
|
{close_session, User, Resource} ->
|
||||||
remove_connection(User, Resource),
|
remove_connection(User, Resource),
|
||||||
@ -101,6 +102,38 @@ open_session(User, Resource) ->
|
|||||||
close_session(User, Resource) ->
|
close_session(User, Resource) ->
|
||||||
ejabberd_sm ! {close_session, User, Resource}.
|
ejabberd_sm ! {close_session, User, Resource}.
|
||||||
|
|
||||||
|
|
||||||
|
register_connection(User, Resource, Pid) ->
|
||||||
|
LUser = jlib:tolower(User),
|
||||||
|
UR = {LUser, Resource},
|
||||||
|
F = fun() ->
|
||||||
|
Ss = mnesia:wread({session, UR}),
|
||||||
|
Ls = mnesia:wread({local_session, UR}),
|
||||||
|
mnesia:write(#session{ur = UR, user = LUser, node = node()}),
|
||||||
|
mnesia:write(#local_session{ur = UR, pid = Pid}),
|
||||||
|
{Ss, Ls}
|
||||||
|
end,
|
||||||
|
case mnesia:transaction(F) of
|
||||||
|
{atomic, {Ss, Ls}} ->
|
||||||
|
lists:foreach(
|
||||||
|
fun(R) ->
|
||||||
|
if R#session.node /= node() ->
|
||||||
|
{ejabberd_sm, R#session.node} !
|
||||||
|
{replace, User, Resource};
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
|
end
|
||||||
|
end, Ss),
|
||||||
|
lists:foreach(
|
||||||
|
fun(R) ->
|
||||||
|
R#local_session.pid ! replaced
|
||||||
|
end, Ls);
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
replace_alien_connection(User, Resource) ->
|
replace_alien_connection(User, Resource) ->
|
||||||
LUser = jlib:tolower(User),
|
LUser = jlib:tolower(User),
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
|
@ -109,7 +109,7 @@ process_local_iq_info(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
[{"xmlns", ?NS_DISCO_INFO}],
|
[{"xmlns", ?NS_DISCO_INFO}],
|
||||||
[{xmlelement, "identity",
|
[{xmlelement, "identity",
|
||||||
[{"category", "service"},
|
[{"category", "service"},
|
||||||
{"type", "jabber"},
|
{"type", "im"},
|
||||||
{"name", "ejabberd"}], []}] ++
|
{"name", "ejabberd"}], []}] ++
|
||||||
Features
|
Features
|
||||||
}]};
|
}]};
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
?OLD_ERROR("401", "Bad password.")).
|
?OLD_ERROR("401", "Bad password.")).
|
||||||
|
|
||||||
|
|
||||||
-define(DBGFSM, true).
|
%-define(DBGFSM, true).
|
||||||
|
|
||||||
-ifdef(DBGFSM).
|
-ifdef(DBGFSM).
|
||||||
-define(FSMOPTS, [{debug, [trace]}]).
|
-define(FSMOPTS, [{debug, [trace]}]).
|
||||||
|
@ -21,6 +21,8 @@ start(Opts) ->
|
|||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, ?NS_REGISTER,
|
gen_iq_handler:add_iq_handler(ejabberd_local, ?NS_REGISTER,
|
||||||
?MODULE, process_iq, IQDisc),
|
?MODULE, process_iq, IQDisc),
|
||||||
|
gen_iq_handler:add_iq_handler(ejabberd_sm, ?NS_REGISTER,
|
||||||
|
?MODULE, process_iq, IQDisc),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init() ->
|
init() ->
|
||||||
@ -68,6 +70,10 @@ process_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
|||||||
[SubEl, ?ERR_BAD_REQUEST]}
|
[SubEl, ?ERR_BAD_REQUEST]}
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
(UTag == false) and (RTag /= false) ->
|
||||||
|
{User, Server, _} = From,
|
||||||
|
ejabberd_auth:remove_user(User),
|
||||||
|
{iq, ID, result, XMLNS, [SubEl]};
|
||||||
(UTag /= false) and (PTag /= false) ->
|
(UTag /= false) and (PTag /= false) ->
|
||||||
User = xml:get_tag_cdata(UTag),
|
User = xml:get_tag_cdata(UTag),
|
||||||
Password = xml:get_tag_cdata(PTag),
|
Password = xml:get_tag_cdata(PTag),
|
||||||
|
Loading…
Reference in New Issue
Block a user