25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-15 15:19:20 +02: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:
Alexey Shchepin 2003-09-19 18:22:44 +00:00
parent 3df8ed2cc1
commit aa9f1549f4
5 changed files with 52 additions and 4 deletions

View File

@ -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>
* src/mod_disco.erl: Now only admin can discovery some nodes,

View File

@ -62,8 +62,9 @@ loop() ->
end,
loop();
{open_session, User, Resource, From} ->
replace_and_register_my_connection(User, Resource, From),
replace_alien_connection(User, Resource),
register_connection(User, Resource, From),
%replace_and_register_my_connection(User, Resource, From),
%replace_alien_connection(User, Resource),
loop();
{close_session, User, Resource} ->
remove_connection(User, Resource),
@ -101,6 +102,38 @@ open_session(User, Resource) ->
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) ->
LUser = jlib:tolower(User),
F = fun() ->

View File

@ -109,7 +109,7 @@ process_local_iq_info(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
[{"xmlns", ?NS_DISCO_INFO}],
[{xmlelement, "identity",
[{"category", "service"},
{"type", "jabber"},
{"type", "im"},
{"name", "ejabberd"}], []}] ++
Features
}]};

View File

@ -84,7 +84,7 @@
?OLD_ERROR("401", "Bad password.")).
-define(DBGFSM, true).
%-define(DBGFSM, true).
-ifdef(DBGFSM).
-define(FSMOPTS, [{debug, [trace]}]).

View File

@ -21,6 +21,8 @@ start(Opts) ->
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
gen_iq_handler:add_iq_handler(ejabberd_local, ?NS_REGISTER,
?MODULE, process_iq, IQDisc),
gen_iq_handler:add_iq_handler(ejabberd_sm, ?NS_REGISTER,
?MODULE, process_iq, IQDisc),
ok.
init() ->
@ -68,6 +70,10 @@ process_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
[SubEl, ?ERR_BAD_REQUEST]}
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) ->
User = xml:get_tag_cdata(UTag),
Password = xml:get_tag_cdata(PTag),