25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

* src/ejabberd_local.erl: Bugfix

* src/mod_register.erl: Added support for sending of "welcome"
message
* src/ejabberd.cfg.example: Updated

* src/ejabberd_s2s_out.erl: Replaced "_jabber-server" with
"_xmpp-server"

SVN Revision: 150
This commit is contained in:
Alexey Shchepin 2003-10-14 19:34:17 +00:00
parent 5c0ba6e337
commit 8106d5f9c1
5 changed files with 47 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2003-10-14 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_local.erl: Bugfix
* src/mod_register.erl: Added support for sending of "welcome"
message
* src/ejabberd.cfg.example: Updated
* src/ejabberd_s2s_out.erl: Replaced "_jabber-server" with
"_xmpp-server"
2003-10-12 Alexey Shchepin <alexey@sevcom.net>
* doc/guide.tex: Updated

View File

@ -24,6 +24,15 @@
% Every username can be registered via in-band registration:
{access, register, [{allow, all}]}.
% After successful registration user will get message with following subject
% and body:
{welcome_message,
{"Welcome!",
"Welcome to Jabber Service. "
"For information about Jabber visit http://jabber.org"}}.
% Replace them with 'none' if you don't want to send such message:
%{welcome_message, none}.
% Only non-blocked users can use c2s connections:
{access, c2s, [{deny, blocked},

View File

@ -84,11 +84,15 @@ do_route(State, From, To, Packet) ->
ok
end;
#jid{luser = ""} ->
Err = jlib:make_error_reply(Packet, ?ERR_ITEM_NOT_FOUND),
ejabberd_router ! {route,
jlib:make_jid("", State#state.mydomain, ""),
From,
Err};
{xmlelement, _Name, Attrs, _Els} = Packet,
case xml:get_attr_s("type", Attrs) of
"error" -> ok;
"result" -> ok;
_ ->
Err = jlib:make_error_reply(Packet, ?ERR_ITEM_NOT_FOUND),
ejabberd_router:route(
jlib:make_jid("", State#state.mydomain, ""), From, Err)
end;
_ ->
ejabberd_sm ! {route, From, To, Packet}
end.

View File

@ -443,7 +443,7 @@ is_verify_res(_) ->
-include_lib("kernel/include/inet.hrl").
get_addr_port(Server) ->
Res = case inet_res:getbyname("_jabber-server._tcp." ++ Server, srv) of
Res = case inet_res:getbyname("_xmpp-server._tcp." ++ Server, srv) of
{error, _Reason} ->
inet_res:getbyname("_jabber._tcp." ++ Server, srv);
{ok, _HEnt} = R -> R

View File

@ -116,12 +116,14 @@ try_register(User, Password) ->
false ->
{error, ?ERR_BAD_REQUEST};
_ ->
case acl:match_rule(register, jlib:make_jid(User, ?MYNAME, "")) of
JID = jlib:make_jid(User, ?MYNAME, ""),
case acl:match_rule(register, JID) of
deny ->
{error, ?ERR_CONFLICT};
allow ->
case ejabberd_auth:try_register(User, Password) of
{atomic, ok} ->
send_welcome_message(JID),
ok;
{atomic, exists} ->
{error, ?ERR_CONFLICT};
@ -132,4 +134,18 @@ try_register(User, Password) ->
end.
send_welcome_message(JID) ->
case ejabberd_config:get_local_option(welcome_message) of
{"", ""} ->
ok;
{Subj, Body} ->
ejabberd_router:route(
jlib:make_jid("", ?MYNAME, ""),
JID,
{xmlelement, "message", [{"type", "normal"}],
[{xmlelement, "subject", [], [{xmlcdata, Subj}]},
{xmlelement, "body", [], [{xmlcdata, Body}]}]});
_ ->
ok
end.