25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)

* src/mod_muc/mod_muc_room.erl: Updated error codes, removed
trailing "-" in history. updated subject sending, added <title/>
in configuration form (thanks to Sergei Golovan)

* src/mod_irc/mod_irc.erl: Added vCard, ejabberd:configure
replaced with jabber:iq:register (thanks to Sergei Golovan)

* src/mod_configure.erl: Updated "xml:lang" usage, updated some
messages (thanks to Sergei Golovan)
* src/mod_configure2.erl: Likewise
* src/mod_disco.erl: Likewise
* src/mod_register.erl: Likewise
* src/mod_vcard.erl: Likewise
* src/mod_irc/mod_irc.erl: Likewise
* src/mod_muc/mod_muc.erl: Likewise
* src/mod_muc/mod_muc_room.erl: Likewise
* src/mod_pubsub/mod_pubsub.erl: Likewise

* src/jlib.hrl: Added "lang" field in "iq" record (thanks to
Sergei Golovan)
* src/jlib.erl: Likewise

* src/ejabberd_c2s.erl: Updated to latest JEP-0078 (thanks to
Sergei Golovan)

* src/ejabberd_sm.erl: Bugfix

SVN Revision: 205
This commit is contained in:
Alexey Shchepin 2004-02-26 22:00:04 +00:00
parent fdf25720e0
commit 21c4b65610
15 changed files with 302 additions and 166 deletions

View File

@ -1,3 +1,36 @@
2004-02-26 Alexey Shchepin <alexey@sevcom.net>
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
* src/mod_muc/mod_muc_room.erl: Updated error codes, removed
trailing "-" in history. updated subject sending, added <title/>
in configuration form (thanks to Sergei Golovan)
* src/mod_irc/mod_irc.erl: Added vCard, ejabberd:configure
replaced with jabber:iq:register (thanks to Sergei Golovan)
* src/mod_configure.erl: Updated "xml:lang" usage, updated some
messages (thanks to Sergei Golovan)
* src/mod_configure2.erl: Likewise
* src/mod_disco.erl: Likewise
* src/mod_register.erl: Likewise
* src/mod_vcard.erl: Likewise
* src/mod_irc/mod_irc.erl: Likewise
* src/mod_muc/mod_muc.erl: Likewise
* src/mod_muc/mod_muc_room.erl: Likewise
* src/mod_pubsub/mod_pubsub.erl: Likewise
* src/jlib.hrl: Added "lang" field in "iq" record (thanks to
Sergei Golovan)
* src/jlib.erl: Likewise
* src/ejabberd_c2s.erl: Updated to latest JEP-0078 (thanks to
Sergei Golovan)
2004-02-18 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_sm.erl: Bugfix
2004-02-15 Alexey Shchepin <alexey@sevcom.net> 2004-02-15 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc_room.erl: Support for history management * src/mod_muc/mod_muc_room.erl: Support for history management

View File

@ -221,7 +221,8 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
{xmlelement, Name, Attrs, {xmlelement, Name, Attrs,
[{xmlelement, "query", [{"xmlns", ?NS_AUTH}], [{xmlelement, "query", [{"xmlns", ?NS_AUTH}],
[{xmlelement, "username", [], [{xmlcdata, U}]}, [{xmlelement, "username", [], [{xmlcdata, U}]},
{xmlelement, "password", [], []} {xmlelement, "password", [], []},
{xmlelement, "resource", [], []}
]}]} ]}]}
end, end,
send_element(StateData, Res), send_element(StateData, Res),

View File

@ -196,8 +196,15 @@ do_route(From, To, Packet) ->
true -> true ->
if if
Subsc -> Subsc ->
case ejabberd_auth:is_user_exists(LUser) of
true ->
catch mod_offline:store_packet( catch mod_offline:store_packet(
From, To, Packet); From, To, Packet);
_ ->
Err = jlib:make_error_reply(
Packet, ?ERR_SERVICE_UNAVAILABLE),
ejabberd_router:route(To, From, Err)
end;
true -> true ->
ok ok
end end

View File

@ -329,6 +329,7 @@ get_iq_namespace(_) ->
iq_query_info({xmlelement, Name, Attrs, Els}) when Name == "iq" -> iq_query_info({xmlelement, Name, Attrs, Els}) when Name == "iq" ->
ID = xml:get_attr_s("id", Attrs), ID = xml:get_attr_s("id", Attrs),
Type = xml:get_attr_s("type", Attrs), Type = xml:get_attr_s("type", Attrs),
Lang = xml:get_attr_s("xml:lang", Attrs),
Type1 = case Type of Type1 = case Type of
"set" -> set; "set" -> set;
"get" -> get; "get" -> get;
@ -343,7 +344,10 @@ iq_query_info({xmlelement, Name, Attrs, Els}) when Name == "iq" ->
XMLNS = xml:get_attr_s("xmlns", Attrs2), XMLNS = xml:get_attr_s("xmlns", Attrs2),
if if
XMLNS /= "" -> XMLNS /= "" ->
#iq{id = ID, type = Type1, xmlns = XMLNS, #iq{id = ID,
type = Type1,
xmlns = XMLNS,
lang = Lang,
sub_el = {xmlelement, Name2, Attrs2, Els2}}; sub_el = {xmlelement, Name2, Attrs2, Els2}};
true -> true ->
invalid invalid

View File

@ -44,6 +44,8 @@
-define(NS_SESSION, "urn:ietf:params:xml:ns:xmpp-session"). -define(NS_SESSION, "urn:ietf:params:xml:ns:xmpp-session").
-define(NS_BIND, "urn:ietf:params:xml:ns:xmpp-bind"). -define(NS_BIND, "urn:ietf:params:xml:ns:xmpp-bind").
-define(NS_FEATURE_IQAUTH, "http://jabber.org/features/iq-auth").
% TODO: remove "code" attribute (currently it used for backward-compatibility) % TODO: remove "code" attribute (currently it used for backward-compatibility)
-define(STANZA_ERROR(Code, Type, Condition), -define(STANZA_ERROR(Code, Type, Condition),
{xmlelement, "error", {xmlelement, "error",
@ -174,5 +176,6 @@
-record(iq, {id = "", -record(iq, {id = "",
type, type,
xmlns = "", xmlns = "",
lang = "",
sub_el}). sub_el}).

View File

@ -34,13 +34,12 @@ stop() ->
gen_iq_handler:remove_iq_handler(ejabberd_sm, ?NS_EJABBERD_CONFIG). gen_iq_handler:remove_iq_handler(ejabberd_sm, ?NS_EJABBERD_CONFIG).
process_local_iq(From, _To, #iq{id = ID, type = Type, process_local_iq(From, _To, #iq{id = ID, type = Type, xmlns = XMLNS,
xmlns = XMLNS, sub_el = SubEl} = IQ) -> lang = Lang, sub_el = SubEl} = IQ) ->
case acl:match_rule(configure, From) of case acl:match_rule(configure, From) of
deny -> deny ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
allow -> allow ->
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
XDataEl = find_xdata_el(SubEl), XDataEl = find_xdata_el(SubEl),
@ -147,7 +146,8 @@ get_form(["running nodes", ENode, "DB"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "DB Tables Configuration")}]}, Lang, "DB Tables Configuration at ") ++
ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -182,7 +182,7 @@ get_form(["running nodes", ENode, "modules", "stop"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Stop Modules")}]}, Lang, "Stop Modules at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -200,7 +200,7 @@ get_form(["running nodes", ENode, "modules", "start"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Start Modules")}]}, Lang, "Start Modules at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -219,7 +219,7 @@ get_form(["running nodes", ENode, "backup", "backup"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Backup to File")}]}, Lang, "Backup to File at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -238,7 +238,7 @@ get_form(["running nodes", ENode, "backup", "restore"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Restore Backup from File")}]}, Lang, "Restore Backup from File at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -257,7 +257,7 @@ get_form(["running nodes", ENode, "backup", "textfile"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Dump Backup to Text File")}]}, Lang, "Dump Backup to Text File at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -276,7 +276,7 @@ get_form(["running nodes", ENode, "import", "file"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Import User from File")}]}, Lang, "Import User from File at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -295,7 +295,7 @@ get_form(["running nodes", ENode, "import", "dir"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Import User from Dir")}]}, Lang, "Import Users from Dir at ") ++ ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
@ -321,7 +321,8 @@ get_form(["config", "hostname"], Lang) ->
Lang, "Choose host name")}]}, Lang, "Choose host name")}]},
{xmlelement, "field", [{"type", "text-single"}, {xmlelement, "field", [{"type", "text-single"},
{"label", {"label",
translate:translate(Lang, "Host name")}, translate:translate(Lang,
"Host name")},
{"var", "hostname"}], {"var", "hostname"}],
[{xmlelement, "value", [], [{xmlcdata, ?MYNAME}]}]} [{xmlelement, "value", [], [{xmlcdata, ?MYNAME}]}]}
]}]}; ]}]};
@ -331,14 +332,15 @@ get_form(["config", "acls"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "ACLs Configuration")}]}, Lang, "Access Control List Configuration")}]},
%{xmlelement, "instructions", [], %{xmlelement, "instructions", [],
% [{xmlcdata, % [{xmlcdata,
% translate:translate( % translate:translate(
% Lang, "")}]}, % Lang, "")}]},
{xmlelement, "field", [{"type", "text-multi"}, {xmlelement, "field", [{"type", "text-multi"},
{"label", {"label",
translate:translate(Lang, "ACLs")}, translate:translate(
Lang, "Access control lists")},
{"var", "acls"}], {"var", "acls"}],
lists:map(fun(S) -> lists:map(fun(S) ->
{xmlelement, "value", [], [{xmlcdata, S}]} {xmlelement, "value", [], [{xmlcdata, S}]}
@ -363,7 +365,7 @@ get_form(["config", "access"], Lang) ->
{xmlelement, "field", [{"type", "text-multi"}, {xmlelement, "field", [{"type", "text-multi"},
{"label", {"label",
translate:translate( translate:translate(
Lang, "Access Rules")}, Lang, "Access rules")},
{"var", "access"}], {"var", "access"}],
lists:map(fun(S) -> lists:map(fun(S) ->
{xmlelement, "value", [], [{xmlcdata, S}]} {xmlelement, "value", [], [{xmlcdata, S}]}
@ -721,13 +723,12 @@ search_running_node(SNode, [Node | Nodes]) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
process_sm_iq(From, To, process_sm_iq(From, To,
#iq{type = Type, xmlns = XMLNS, sub_el = SubEl} = IQ) -> #iq{type = Type, xmlns = XMLNS, lang = Lang, sub_el = SubEl} = IQ) ->
case acl:match_rule(configure, From) of case acl:match_rule(configure, From) of
deny -> deny ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
allow -> allow ->
#jid{user = User} = To, #jid{user = User} = To,
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
XDataEl = find_xdata_el(SubEl), XDataEl = find_xdata_el(SubEl),
@ -792,7 +793,7 @@ get_sm_form(User, [], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Administration of " ++ User)}]}, Lang, "Administration of ") ++ User}]},
%{xmlelement, "instructions", [], %{xmlelement, "instructions", [],
% [{xmlcdata, % [{xmlcdata,
% translate:translate( % translate:translate(

View File

@ -32,26 +32,26 @@ stop() ->
gen_iq_handler:remove_iq_handler(ejabberd_sm, ?NS_IQDATA). gen_iq_handler:remove_iq_handler(ejabberd_sm, ?NS_IQDATA).
process_local_iq(From, _To, #iq{type = Type, sub_el = SubEl} = IQ) -> process_local_iq(From, _To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) ->
case acl:match_rule(configure, From) of case acl:match_rule(configure, From) of
deny -> deny ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
allow -> allow ->
%Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
IQ#iq{type = error, IQ#iq{type = error,
sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]}; sub_el = [SubEl, ?ERR_FEATURE_NOT_IMPLEMENTED]};
%case xml:get_tag_attr_s("type", SubEl) of %case xml:get_tag_attr_s("type", SubEl) of
% "cancel" -> % "cancel" ->
% {iq, ID, result, XMLNS, % IQ#iq{type = result,
% [{xmlelement, "query", [{"xmlns", XMLNS}], []}]}; % sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], []}]};
% "submit" -> % "submit" ->
% XData = jlib:parse_xdata_submit(SubEl), % XData = jlib:parse_xdata_submit(SubEl),
% case XData of % case XData of
% invalid -> % invalid ->
% {iq, ID, error, XMLNS, % IQ#iq{type = error,
% [SubEl, ?ERR_BAD_REQUEST]}; % sub_el = [SubEl, ?ERR_BAD_REQUEST]};
% _ -> % _ ->
% Node = % Node =
% string:tokens( % string:tokens(
@ -59,19 +59,19 @@ process_local_iq(From, _To, #iq{type = Type, sub_el = SubEl} = IQ) ->
% "/"), % "/"),
% case set_form(Node, Lang, XData) of % case set_form(Node, Lang, XData) of
% {result, Res} -> % {result, Res} ->
% {iq, ID, result, XMLNS, % IQ#iq{type = result,
% [{xmlelement, "query", % sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], % [{"xmlns", XMLNS}],
% Res % Res
% }]}; % }]};
% {error, Error} -> % {error, Error} ->
% {iq, ID, error, XMLNS, % IQ#iq{type = error,
% [SubEl, Error]} % sub_el = [SubEl, Error]}
% end % end
% end; % end;
% _ -> % _ ->
% {iq, ID, error, XMLNS, % IQ#iq{type = error,
% [SubEl, ?ERR_NOT_ALLOWED]} % sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
%end; %end;
get -> get ->
case process_get(SubEl) of case process_get(SubEl) of

View File

@ -73,8 +73,7 @@ unregister_extra_domain(Domain) ->
catch ets:new(disco_extra_domains, [named_table, ordered_set, public]), catch ets:new(disco_extra_domains, [named_table, ordered_set, public]),
ets:delete(disco_extra_domains, Domain). ets:delete(disco_extra_domains, Domain).
process_local_iq_items(From, To, #iq{type = Type, sub_el = SubEl} = IQ) -> process_local_iq_items(From, To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) ->
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
@ -232,7 +231,7 @@ get_local_items([], Server, Lang) ->
get_local_items(["config"], Server, Lang) -> get_local_items(["config"], Server, Lang) ->
{result, {result,
[?NODE("Host Name", "config/hostname"), [?NODE("Host Name", "config/hostname"),
?NODE("ACLs", "config/acls"), ?NODE("Access Control Lists", "config/acls"),
?NODE("Access Rules", "config/access"), ?NODE("Access Rules", "config/access"),
?NODE("Remove Users", "config/remusers") ?NODE("Remove Users", "config/remusers")
]}; ]};

View File

@ -58,6 +58,7 @@ loop(Host) ->
do_route(Host, From, To, Packet) -> do_route(Host, From, To, Packet) ->
#jid{user = ChanServ, resource = Resource} = To, #jid{user = ChanServ, resource = Resource} = To,
{xmlelement, _Name, Attrs, _Els} = Packet,
case ChanServ of case ChanServ of
"" -> "" ->
case Resource of case Resource of
@ -72,9 +73,18 @@ do_route(Host, From, To, Packet) ->
ejabberd_router:route(To, ejabberd_router:route(To,
From, From,
jlib:iq_to_xml(Res)); jlib:iq_to_xml(Res));
#iq{type = Type, xmlns = ?NS_EJABBERD_CONFIG, #iq{xmlns = ?NS_REGISTER} = IQ ->
sub_el = SubEl} = IQ -> process_register(From, To, IQ);
ejabberd_config(From, To, IQ); #iq{type = get, xmlns = ?NS_VCARD = XMLNS,
lang = Lang} = IQ ->
Res = IQ#iq{type = result,
sub_el =
[{xmlelement, "query",
[{"xmlns", XMLNS}],
iq_get_vcard(Lang)}]},
ejabberd_router:route(To,
From,
jlib:iq_to_xml(Res));
#iq{} = IQ -> #iq{} = IQ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_FEATURE_NOT_IMPLEMENTED), Packet, ?ERR_FEATURE_NOT_IMPLEMENTED),
@ -155,12 +165,22 @@ iq_disco() ->
{xmlelement, "feature", {xmlelement, "feature",
[{"var", ?NS_MUC}], []}, [{"var", ?NS_MUC}], []},
{xmlelement, "feature", {xmlelement, "feature",
[{"var", ?NS_EJABBERD_CONFIG}], []}]. [{"var", ?NS_REGISTER}], []},
{xmlelement, "feature",
[{"var", ?NS_VCARD}], []}].
iq_get_vcard(Lang) ->
[{xmlelement, "FN", [],
[{xmlcdata, "ejabberd/mod_irc"}]},
{xmlelement, "URL", [],
[{xmlcdata,
"http://ejabberd.jabberstudio.org/"}]},
{xmlelement, "DESC", [],
[{xmlcdata, translate:translate(Lang, "ejabberd IRC module\n"
"Copyright (c) 2003-2004 Alexey Shchepin")}]}].
process_register(From, To, #iq{} = IQ) ->
ejabberd_config(From, To, #iq{type = Type} = IQ) -> case catch process_irc_register(From, To, IQ) of
case catch process_ejabberd_config(From, To, IQ) of
{'EXIT', Reason} -> {'EXIT', Reason} ->
?ERROR_MSG("~p", [Reason]); ?ERROR_MSG("~p", [Reason]);
ResIQ -> ResIQ ->
@ -190,9 +210,9 @@ find_xdata_el1([{xmlelement, Name, Attrs, SubEls} | Els]) ->
find_xdata_el1([_ | Els]) -> find_xdata_el1([_ | Els]) ->
find_xdata_el1(Els). find_xdata_el1(Els).
process_ejabberd_config(From, To, process_irc_register(From, To,
#iq{type = Type, xmlns = XMLNS, sub_el = SubEl} = IQ) -> #iq{type = Type, xmlns = XMLNS,
Lang = xml:get_tag_attr_s("xml:lang", SubEl), lang = Lang, sub_el = SubEl} = IQ) ->
case Type of case Type of
set -> set ->
XDataEl = find_xdata_el(SubEl), XDataEl = find_xdata_el(SubEl),
@ -277,12 +297,15 @@ get_form(From, [], Lang) ->
{xmlelement, "x", [{"xmlns", ?NS_XDATA}], {xmlelement, "x", [{"xmlns", ?NS_XDATA}],
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate(Lang, "mod_irc configuration for") ++ translate:translate(
" " ++ User ++ "@" ++ Server}]}, Lang,
%{xmlelement, "instructions", [], "Registration in mod_irc for ") ++ User ++ "@" ++ Server}]},
% [{xmlcdata, {xmlelement, "instructions", [],
% translate:translate( [{xmlcdata,
% Lang, "")}]}, translate:translate(
Lang,
"Enter username and encodings you wish to use for "
"connecting to IRC servers")}]},
{xmlelement, "field", [{"type", "text-single"}, {xmlelement, "field", [{"type", "text-single"},
{"label", {"label",
translate:translate( translate:translate(

View File

@ -100,15 +100,14 @@ do_route(Host, From, To, Packet) ->
[Host, From, To, IQ]); [Host, From, To, IQ]);
#iq{type = get, #iq{type = get,
xmlns = ?NS_REGISTER = XMLNS, xmlns = ?NS_REGISTER = XMLNS,
lang = Lang,
sub_el = SubEl} = IQ -> sub_el = SubEl} = IQ ->
Lang = xml:get_tag_attr_s(
"xml:lang", SubEl),
Res = IQ#iq{type = result, Res = IQ#iq{type = result,
sub_el = sub_el =
[{xmlelement, "query", [{xmlelement, "query",
[{"xmlns", XMLNS}], [{"xmlns", XMLNS}],
iq_get_register_info( iq_get_register_info(
From, Lang)}]}, From, Host, Lang)}]},
ejabberd_router:route(To, ejabberd_router:route(To,
From, From,
jlib:iq_to_xml(Res)); jlib:iq_to_xml(Res));
@ -132,9 +131,8 @@ do_route(Host, From, To, Packet) ->
end; end;
#iq{type = get, #iq{type = get,
xmlns = ?NS_VCARD = XMLNS, xmlns = ?NS_VCARD = XMLNS,
lang = Lang,
sub_el = SubEl} = IQ -> sub_el = SubEl} = IQ ->
Lang = xml:get_tag_attr_s(
"xml:lang", SubEl),
Res = IQ#iq{type = result, Res = IQ#iq{type = result,
sub_el = sub_el =
[{xmlelement, "query", [{xmlelement, "query",
@ -306,7 +304,7 @@ iq_disco_items(Host, From) ->
{"var", Var}], {"var", Var}],
[{xmlelement, "value", [], [{xmlcdata, Val}]}]}). [{xmlelement, "value", [], [{xmlcdata, Val}]}]}).
iq_get_register_info(From, Lang) -> iq_get_register_info(From, Host, Lang) ->
{LUser, LServer, _} = jlib:jid_tolower(From), {LUser, LServer, _} = jlib:jid_tolower(From),
LUS = {LUser, LServer}, LUS = {LUser, LServer},
{Nick, Registered} = case catch mnesia:dirty_read(muc_registered, LUS) of {Nick, Registered} = case catch mnesia:dirty_read(muc_registered, LUS) of
@ -321,17 +319,17 @@ iq_get_register_info(From, Lang) ->
[{xmlelement, "instructions", [], [{xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "You need a x:data capable client to register.")}]}, Lang, "You need an x:data capable client to register nickname")}]},
{xmlelement, "x", {xmlelement, "x",
[{"xmlns", ?NS_XDATA}], [{"xmlns", ?NS_XDATA}],
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Nickname Registration")}]}, Lang, "Nickname Registration at ") ++ Host}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "Enter nickname you want to register.")}]}, Lang, "Enter nickname you want to register")}]},
?XFIELD("text-single", "Nickname", "nick", Nick)]}]. ?XFIELD("text-single", "Nickname", "nick", Nick)]}].
iq_set_register_info(From, XData) -> iq_set_register_info(From, XData) ->
@ -408,7 +406,7 @@ iq_get_vcard(Lang) ->
"http://ejabberd.jabberstudio.org/"}]}, "http://ejabberd.jabberstudio.org/"}]},
{xmlelement, "DESC", [], {xmlelement, "DESC", [],
[{xmlcdata, translate:translate(Lang, "ejabberd MUC module\n" [{xmlcdata, translate:translate(Lang, "ejabberd MUC module\n"
"Copyright (c) 2003 Alexey Shchepin")}]}]. "Copyright (c) 2003-2004 Alexey Shchepin")}]}].
broadcast_service_message(Msg) -> broadcast_service_message(Msg) ->

View File

@ -173,7 +173,7 @@ normal_state({route, From, "",
{next_state, normal_state, NewStateData2}; {next_state, normal_state, NewStateData2};
_ -> _ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_NOT_ALLOWED), Packet, ?ERR_FORBIDDEN),
ejabberd_router:route( ejabberd_router:route(
StateData#state.jid, StateData#state.jid,
From, Err), From, Err),
@ -181,7 +181,7 @@ normal_state({route, From, "",
end; end;
true -> true ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_NOT_ALLOWED), Packet, ?ERR_FORBIDDEN),
ejabberd_router:route( ejabberd_router:route(
StateData#state.jid, StateData#state.jid,
From, Err), From, Err),
@ -244,7 +244,7 @@ normal_state({route, From, "",
ok; ok;
_ -> _ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
Packet, ?ERR_NOT_ALLOWED), Packet, ?ERR_NOT_ACCEPTABLE),
ejabberd_router:route(StateData#state.jid, From, Err) ejabberd_router:route(StateData#state.jid, From, Err)
end, end,
{next_state, normal_state, StateData} {next_state, normal_state, StateData}
@ -254,20 +254,20 @@ normal_state({route, From, "",
{xmlelement, "iq", Attrs, Els} = Packet}, {xmlelement, "iq", Attrs, Els} = Packet},
StateData) -> StateData) ->
case jlib:iq_query_info(Packet) of case jlib:iq_query_info(Packet) of
#iq{type = Type, xmlns = XMLNS, sub_el = SubEl} = IQ when #iq{type = Type, xmlns = XMLNS, lang = Lang, sub_el = SubEl} = IQ when
(XMLNS == ?NS_MUC_ADMIN) or (XMLNS == ?NS_MUC_ADMIN) or
(XMLNS == ?NS_MUC_OWNER) or (XMLNS == ?NS_MUC_OWNER) or
(XMLNS == ?NS_DISCO_INFO) or (XMLNS == ?NS_DISCO_INFO) or
(XMLNS == ?NS_DISCO_ITEMS) -> (XMLNS == ?NS_DISCO_ITEMS) ->
Res1 = case XMLNS of Res1 = case XMLNS of
?NS_MUC_ADMIN -> ?NS_MUC_ADMIN ->
process_iq_admin(From, Type, SubEl, StateData); process_iq_admin(From, Type, Lang, SubEl, StateData);
?NS_MUC_OWNER -> ?NS_MUC_OWNER ->
process_iq_owner(From, Type, SubEl, StateData); process_iq_owner(From, Type, Lang, SubEl, StateData);
?NS_DISCO_INFO -> ?NS_DISCO_INFO ->
process_iq_disco_info(From, Type, StateData); process_iq_disco_info(From, Type, Lang, StateData);
?NS_DISCO_ITEMS -> ?NS_DISCO_ITEMS ->
process_iq_disco_items(From, Type, StateData) process_iq_disco_items(From, Type, Lang, StateData)
end, end,
{IQRes, NewStateData} = {IQRes, NewStateData} =
case Res1 of case Res1 of
@ -836,9 +836,9 @@ add_new_user(From, Nick, {xmlelement, _, Attrs, Els} = Packet, StateData) ->
true -> true ->
ok; ok;
_ -> _ ->
send_subject(From, StateData) Lang = xml:get_attr_s("xml:lang", Attrs),
send_subject(From, Lang, StateData)
end, end,
send_join_messages_end(From, StateData),
NewState; NewState;
_ -> _ ->
Err = jlib:make_error_reply( Err = jlib:make_error_reply(
@ -1364,7 +1364,7 @@ send_history(JID, Shift, StateData) ->
end, false, lists:nthtail(Shift, lqueue_to_list(StateData#state.history))). end, false, lists:nthtail(Shift, lqueue_to_list(StateData#state.history))).
send_subject(JID, StateData) -> send_subject(JID, Lang, StateData) ->
case StateData#state.subject_author of case StateData#state.subject_author of
"" -> "" ->
ok; ok;
@ -1374,7 +1374,10 @@ send_subject(JID, StateData) ->
[{xmlelement, "subject", [], [{xmlcdata, Subject}]}, [{xmlelement, "subject", [], [{xmlcdata, Subject}]},
{xmlelement, "body", [], {xmlelement, "body", [],
[{xmlcdata, [{xmlcdata,
Nick ++ " has set the topic to: " ++ Subject}]}]}, Nick ++
translate:translate(Lang,
" has set the subject to: ") ++
Subject}]}]},
ejabberd_router:route( ejabberd_router:route(
StateData#state.jid, StateData#state.jid,
JID, JID,
@ -1389,15 +1392,6 @@ check_subject(Packet) ->
xml:get_tag_cdata(SubjEl) xml:get_tag_cdata(SubjEl)
end. end.
send_join_messages_end(JID, StateData) ->
Packet = {xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [],
[{xmlcdata, "-"}]}]},
ejabberd_router:route(
StateData#state.jid,
JID,
Packet).
can_change_subject(Role, StateData) -> can_change_subject(Role, StateData) ->
case (StateData#state.config)#config.allow_change_subj of case (StateData#state.config)#config.allow_change_subj of
true -> true ->
@ -1409,11 +1403,11 @@ can_change_subject(Role, StateData) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Admin stuff % Admin stuff
process_iq_admin(From, set, SubEl, StateData) -> process_iq_admin(From, set, Lang, SubEl, StateData) ->
{xmlelement, _, _, Items} = SubEl, {xmlelement, _, _, Items} = SubEl,
process_admin_items_set(From, Items, StateData); process_admin_items_set(From, Items, StateData);
process_iq_admin(From, get, SubEl, StateData) -> process_iq_admin(From, get, Lang, SubEl, StateData) ->
case xml:get_subtag(SubEl, "item") of case xml:get_subtag(SubEl, "item") of
false -> false ->
{error, ?ERR_BAD_REQUEST}; {error, ?ERR_BAD_REQUEST};
@ -1838,12 +1832,11 @@ send_kickban_presence1(UJID, Reason, Code, StateData) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Owner stuff % Owner stuff
process_iq_owner(From, set, SubEl, StateData) -> process_iq_owner(From, set, Lang, SubEl, StateData) ->
FAffiliation = get_affiliation(From, StateData), FAffiliation = get_affiliation(From, StateData),
case FAffiliation of case FAffiliation of
owner -> owner ->
{xmlelement, Name, Attrs, Els} = SubEl, {xmlelement, Name, Attrs, Els} = SubEl,
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case xml:remove_cdata(Els) of case xml:remove_cdata(Els) of
[{xmlelement, "x", Attrs1, Els1} = XEl] -> [{xmlelement, "x", Attrs1, Els1} = XEl] ->
case {xml:get_tag_attr_s("xmlns", XEl), case {xml:get_tag_attr_s("xmlns", XEl),
@ -1864,12 +1857,11 @@ process_iq_owner(From, set, SubEl, StateData) ->
{error, ?ERR_FORBIDDEN} {error, ?ERR_FORBIDDEN}
end; end;
process_iq_owner(From, get, SubEl, StateData) -> process_iq_owner(From, get, Lang, SubEl, StateData) ->
FAffiliation = get_affiliation(From, StateData), FAffiliation = get_affiliation(From, StateData),
case FAffiliation of case FAffiliation of
owner -> owner ->
{xmlelement, Name, Attrs, Els} = SubEl, {xmlelement, Name, Attrs, Els} = SubEl,
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case xml:remove_cdata(Els) of case xml:remove_cdata(Els) of
[] -> [] ->
get_config(Lang, StateData); get_config(Lang, StateData);
@ -1919,7 +1911,10 @@ process_iq_owner(From, get, SubEl, StateData) ->
get_config(Lang, StateData) -> get_config(Lang, StateData) ->
Config = StateData#state.config, Config = StateData#state.config,
Res = Res =
[?STRINGXFIELD("Room title", [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Configuration for ") ++
jlib:jid_to_string(StateData#state.jid)}]},
?STRINGXFIELD("Room title",
"title", "title",
Config#config.title), Config#config.title),
?BOOLXFIELD("Allow users to change subject?", ?BOOLXFIELD("Allow users to change subject?",
@ -1968,7 +1963,11 @@ get_config(Lang, StateData) ->
"logging", "logging",
Config#config.logging) Config#config.logging)
], ],
{result, [{xmlelement, "x", [{"xmlns", ?NS_XDATA}], Res}], StateData}. {result, [{xmlelement, "instructions", [],
[{xmlcdata,
translate:translate(
Lang, "You need an x:data capable client to configure room")}]},
{xmlelement, "x", [{"xmlns", ?NS_XDATA}], Res}], StateData}.
@ -2141,10 +2140,10 @@ destroy_room(DEls, StateData) ->
?FEATURE(Fiffalse) ?FEATURE(Fiffalse)
end). end).
process_iq_disco_info(From, set, StateData) -> process_iq_disco_info(From, set, Lang, StateData) ->
{error, ?ERR_NOT_ALLOWED}; {error, ?ERR_NOT_ALLOWED};
process_iq_disco_info(From, get, StateData) -> process_iq_disco_info(From, get, Lang, StateData) ->
Config = StateData#state.config, Config = StateData#state.config,
{result, [{xmlelement, "identity", {result, [{xmlelement, "identity",
[{"category", "conference"}, [{"category", "conference"},
@ -2167,10 +2166,10 @@ process_iq_disco_info(From, get, StateData) ->
], StateData}. ], StateData}.
process_iq_disco_items(From, set, StateData) -> process_iq_disco_items(From, set, Lang, StateData) ->
{error, ?ERR_NOT_ALLOWED}; {error, ?ERR_NOT_ALLOWED};
process_iq_disco_items(From, get, StateData) -> process_iq_disco_items(From, get, Lang, StateData) ->
FAffiliation = get_affiliation(From, StateData), FAffiliation = get_affiliation(From, StateData),
FRole = get_role(From, StateData), FRole = get_role(From, StateData),
case ((StateData#state.config)#config.public_list == true) orelse case ((StateData#state.config)#config.public_list == true) orelse

View File

@ -120,22 +120,22 @@ do_route(Host, From, To, Packet) ->
Packet, Error) Packet, Error)
end, end,
ejabberd_router:route(To, From, Res); ejabberd_router:route(To, From, Res);
%{iq, ID, get, ?NS_REGISTER = XMLNS, SubEl} -> %#iq{type = get, xmlns = ?NS_REGISTER = XMLNS,
% Lang = xml:get_tag_attr_s( % lang = Lang, sub_el = SubEl} = IQ ->
% "xml:lang", SubEl), % Res = IQ#iq{type = result,
% Res = {iq, ID, result, XMLNS, % sub_el = [{xmlelement, "query",
% [{xmlelement, "query",
% [{"xmlns", XMLNS}], % [{"xmlns", XMLNS}],
% iq_get_register_info( % iq_get_register_info(
% From, Lang)}]}, % From, Lang)}]},
% ejabberd_router:route(To, % ejabberd_router:route(To,
% From, % From,
% jlib:iq_to_xml(Res)); % jlib:iq_to_xml(Res));
%{iq, ID, set, ?NS_REGISTER = XMLNS, SubEl} -> %#iq{type = set, xmlns = ?NS_REGISTER = XMLNS,
% sub_el = SubEl} = IQ ->
% case process_iq_register_set(From, SubEl) of % case process_iq_register_set(From, SubEl) of
% {result, IQRes} -> % {result, IQRes} ->
% Res = {iq, ID, result, XMLNS, % Res = IQ#iq{type = result,
% [{xmlelement, "query", % sub_el = [{xmlelement, "query",
% [{"xmlns", XMLNS}], % [{"xmlns", XMLNS}],
% IQRes}]}, % IQRes}]},
% ejabberd_router:route( % ejabberd_router:route(
@ -160,9 +160,7 @@ do_route(Host, From, To, Packet) ->
end, end,
ejabberd_router:route(To, From, Res); ejabberd_router:route(To, From, Res);
#iq{type = get, xmlns = ?NS_VCARD = XMLNS, #iq{type = get, xmlns = ?NS_VCARD = XMLNS,
sub_el = SubEl} = IQ -> lang = Lang, sub_el = SubEl} = IQ ->
Lang = xml:get_tag_attr_s(
"xml:lang", SubEl),
Res = IQ#iq{type = result, Res = IQ#iq{type = result,
sub_el = [{xmlelement, "query", sub_el = [{xmlelement, "query",
[{"xmlns", XMLNS}], [{"xmlns", XMLNS}],
@ -389,8 +387,10 @@ iq_get_vcard(Lang) ->
[{xmlcdata, [{xmlcdata,
"http://ejabberd.jabberstudio.org/"}]}, "http://ejabberd.jabberstudio.org/"}]},
{xmlelement, "DESC", [], {xmlelement, "DESC", [],
[{xmlcdata, "ejabberd pub/sub module\n" [{xmlcdata, translate:translate(
"Copyright (c) 2003 Alexey Shchepin"}]}]. Lang,
"ejabberd pub/sub module\n"
"Copyright (c) 2003-2004 Alexey Shchepin")}]}].
iq_pubsub(Host, From, Type, SubEl) -> iq_pubsub(Host, From, Type, SubEl) ->

View File

@ -28,7 +28,7 @@ start(Opts) ->
init() -> init() ->
ok. ok.
process_iq(From, _To, #iq{type = Type, sub_el = SubEl} = IQ) -> process_iq(From, _To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) ->
case Type of case Type of
set -> set ->
UTag = xml:get_subtag(SubEl, "username"), UTag = xml:get_subtag(SubEl, "username"),
@ -100,7 +100,6 @@ process_iq(From, _To, #iq{type = Type, sub_el = SubEl} = IQ) ->
sub_el = [SubEl, ?ERR_BAD_REQUEST]} sub_el = [SubEl, ?ERR_BAD_REQUEST]}
end; end;
get -> get ->
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
IQ#iq{type = result, IQ#iq{type = result,
sub_el = [{xmlelement, sub_el = [{xmlelement,
"query", "query",
@ -110,7 +109,7 @@ process_iq(From, _To, #iq{type = Type, sub_el = SubEl} = IQ) ->
translate:translate( translate:translate(
Lang, Lang,
"Choose a username and password " "Choose a username and password "
"to register with this server.")}]}, "to register with this server")}]},
{xmlelement, "username", [], []}, {xmlelement, "username", [], []},
{xmlelement, "password", [], []}]}]} {xmlelement, "password", [], []}]}]}
end. end.

View File

@ -86,7 +86,7 @@ loop() ->
end. end.
process_local_iq(_From, _To, #iq{type = Type, sub_el = SubEl} = IQ) -> process_local_iq(_From, _To, #iq{type = Type, lang = Lang, sub_el = SubEl} = IQ) ->
case Type of case Type of
set -> set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
@ -100,8 +100,11 @@ process_local_iq(_From, _To, #iq{type = Type, sub_el = SubEl} = IQ) ->
[{xmlcdata, [{xmlcdata,
"http://ejabberd.jabberstudio.org/"}]}, "http://ejabberd.jabberstudio.org/"}]},
{xmlelement, "DESC", [], {xmlelement, "DESC", [],
[{xmlcdata, "Erlang Jabber Server\n" [{xmlcdata,
"Copyright (c) 2002-2004 Alexey Shchepin"}]}, translate:translate(
Lang,
"Erlang Jabber Server\n"
"Copyright (c) 2002-2004 Alexey Shchepin")}]},
{xmlelement, "BDAY", [], {xmlelement, "BDAY", [],
[{xmlcdata, "2002-11-16"}]} [{xmlcdata, "2002-11-16"}]}
]}]} ]}]}
@ -202,12 +205,13 @@ set_vcard(User, VCARD) ->
{"var", Var}], []}). {"var", Var}], []}).
-define(FORM, -define(FORM(JID),
[{xmlelement, "instructions", [], [{xmlelement, "instructions", [],
[{xmlcdata, translate:translate(Lang, "You need a x:data capable client to search")}]}, [{xmlcdata, translate:translate(Lang, "You need an x:data capable client to search")}]},
{xmlelement, "x", [{"xmlns", ?NS_XDATA}, {"type", "form"}], {xmlelement, "x", [{"xmlns", ?NS_XDATA}, {"type", "form"}],
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Users Search")}]}, [{xmlcdata, translate:translate(Lang, "Search users in ") ++
jlib:jid_to_string(JID)}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, translate:translate(Lang, "Fill in fields to search " [{xmlcdata, translate:translate(Lang, "Fill in fields to search "
"for any matching Jabber User")}]}, "for any matching Jabber User")}]},
@ -237,8 +241,7 @@ do_route(From, To, Packet) ->
true -> true ->
IQ = jlib:iq_query_info(Packet), IQ = jlib:iq_query_info(Packet),
case IQ of case IQ of
#iq{type = Type, xmlns = ?NS_SEARCH, sub_el = SubEl} -> #iq{type = Type, xmlns = ?NS_SEARCH, lang = Lang, sub_el = SubEl} ->
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
case Type of case Type of
set -> set ->
XDataEl = find_xdata_el(SubEl), XDataEl = find_xdata_el(SubEl),
@ -267,7 +270,7 @@ do_route(From, To, Packet) ->
[{xmlelement, "x", [{xmlelement, "x",
[{"xmlns", ?NS_XDATA}, [{"xmlns", ?NS_XDATA},
{"type", "result"}], {"type", "result"}],
search_result(Lang, XData) search_result(Lang, To, XData)
}]}]}, }]}]},
ejabberd_router:route( ejabberd_router:route(
To, From, jlib:iq_to_xml(ResIQ)) To, From, jlib:iq_to_xml(ResIQ))
@ -278,7 +281,7 @@ do_route(From, To, Packet) ->
sub_el = [{xmlelement, sub_el = [{xmlelement,
"query", "query",
[{"xmlns", ?NS_SEARCH}], [{"xmlns", ?NS_SEARCH}],
?FORM ?FORM(To)
}]}, }]},
ejabberd_router:route(To, ejabberd_router:route(To,
From, From,
@ -303,7 +306,9 @@ do_route(From, To, Packet) ->
"vCard User Search"}], "vCard User Search"}],
[]}, []},
{xmlelement, "feature", {xmlelement, "feature",
[{"var", ?NS_SEARCH}], []} [{"var", ?NS_SEARCH}], []},
{xmlelement, "feature",
[{"var", ?NS_VCARD}], []}
] ]
}]}, }]},
ejabberd_router:route(To, ejabberd_router:route(To,
@ -327,6 +332,16 @@ do_route(From, To, Packet) ->
From, From,
jlib:iq_to_xml(ResIQ)) jlib:iq_to_xml(ResIQ))
end; end;
#iq{type = get, xmlns = ?NS_VCARD, lang = Lang} ->
ResIQ =
IQ#iq{type = result,
sub_el = [{xmlelement,
"query",
[{"xmlns", ?NS_VCARD}],
iq_get_vcard(Lang)}]},
ejabberd_router:route(To,
From,
jlib:iq_to_xml(ResIQ));
_ -> _ ->
Err = jlib:make_error_reply(Packet, Err = jlib:make_error_reply(Packet,
?ERR_SERVICE_UNAVAILABLE), ?ERR_SERVICE_UNAVAILABLE),
@ -334,6 +349,16 @@ do_route(From, To, Packet) ->
end end
end. end.
iq_get_vcard(Lang) ->
[{xmlelement, "FN", [],
[{xmlcdata, "ejabberd/mod_vcard"}]},
{xmlelement, "URL", [],
[{xmlcdata,
"http://ejabberd.jabberstudio.org/"}]},
{xmlelement, "DESC", [],
[{xmlcdata, translate:translate(Lang, "ejabberd vCard module\n"
"Copyright (c) 2003-2004 Alexey Shchepin")}]}].
find_xdata_el({xmlelement, _Name, _Attrs, SubEls}) -> find_xdata_el({xmlelement, _Name, _Attrs, SubEls}) ->
find_xdata_el1(SubEls). find_xdata_el1(SubEls).
@ -353,9 +378,10 @@ find_xdata_el1([_ | Els]) ->
{xmlelement, "field", [{"label", translate:translate(Lang, Label)}, {xmlelement, "field", [{"label", translate:translate(Lang, Label)},
{"var", Var}], []}). {"var", Var}], []}).
search_result(Lang, Data) -> search_result(Lang, JID, Data) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Users Search Results")}]}, [{xmlcdata, translate:translate(Lang, "Results of search in ") ++
jlib:jid_to_string(JID)}]},
{xmlelement, "reported", [], {xmlelement, "reported", [],
[?LFIELD("JID", "jid"), [?LFIELD("JID", "jid"),
?LFIELD("Full Name", "fn"), ?LFIELD("Full Name", "fn"),

View File

@ -1,24 +1,41 @@
% $Id$ % $Id$
% mod_configure.erl % mod_configure.erl
{"DB Tables Configuration", "Конфигурация таблиц БД"}. {"DB Tables Configuration at ", "Конфигурация таблиц БД на "}.
{"Choose storage type of tables", "Выберите тип хранения таблиц"}. {"Choose storage type of tables", "Выберите тип хранения таблиц"}.
{"", ""}. {"RAM copy", "ОЗУ"}.
{"", ""}. {"RAM and disc copy", "ОЗУ и диск"}.
{"", ""}. {"Disc only copy", "только диск"}.
{"", ""}. {"Remote copy", "не хранится локально"}.
{"", ""}. {"Stop Modules at ", "Остановка модулей на "}.
{"", ""}. {"Choose modules to stop", "Выберите модули, которые следует остановить"}.
{"", ""}. {"Start Modules at ", "Запуск модулей на "}.
{"", ""}. {"Enter list of {Module, [Options]}", "Введите список вида {Module, [Options]}"}.
{"", ""}. {"List of modules to start", "Список запускаемых модулей"}.
{"", ""}. {"Backup to File at ", "Резервное копирование в файл на "}.
{"", ""}. {"Enter path to backup file", "Введите путь к резервному файлу"}.
{"", ""}. {"Path to File", "Путь к файлу"}.
{"", ""}. {"Restore Backup from File at ", "Восстановление из резервной копии на "}.
{"", ""}. {"Dump Backup to Text File at ", "Копирование в текстовый файл на "}.
{"", ""}. {"Enter path to text file", "Введите путь к текстовому файлу"}.
{"", ""}. {"Import User from File at ", "Импорт пользователя из файла на "}.
{"Enter path to jabberd1.4 spool file", "Введите путь к файлу из спула jabberd1.4"}.
{"Import Users from Dir at ", "Импорт пользователей из директории на "}.
{"Enter path to jabberd1.4 spool dir", "Введите путь к директории спула jabberd1.4"}.
{"Path to Dir", "Путь к директории"}.
{"Hostname Configuration", "Конфигурация имени хоста"}.
{"Choose host name", "Выберите имя хоста"}.
{"Host name", "Имя хоста"}.
{"Access Control List Configuration", "Конфигурация списков управления доступом"}.
{"Access control lists", "Списки управления доступом"}.
{"Access Configuration", "Конфигурация доступа"}.
{"Access rules", "Правила доступа"}.
{"Remove Users", "Удаление пользователей"}.
{"Choose users to remove", "Выберите пользователей, которых следует удалить"}.
{"Administration of ", "Администрирование "}.
{"Action on user", "Действие над пользователем"}.
{"Edit Properties", "Изменить параметры"}.
{"Remove User", "Удалить пользователя"}.
% mod_disco.erl % mod_disco.erl
{"Configuration", "Конфигурация"}. {"Configuration", "Конфигурация"}.
@ -30,25 +47,36 @@
{"Running Nodes", "Работающие узлы"}. {"Running Nodes", "Работающие узлы"}.
{"Stopped Nodes", "Остановленные узлы"}. {"Stopped Nodes", "Остановленные узлы"}.
{"Host Name", "Имя хоста"}. {"Host Name", "Имя хоста"}.
{"ACLs", "ACLs"}. {"Access Control Lists", "Списки управления доступом"}.
{"Access Rules", "Правила доступа"}. {"Access Rules", "Правила доступа"}.
{"Remove Users", "Удаление пользователей"}. {"Remove Users", "Удаление пользователей"}.
{"DB", "БД"}. {"DB", "БД"}.
{"Modules", "Модули"}. {"Modules", "Модули"}.
{"Start Modules", "Запуск модулей"}. {"Start Modules", "Запуск модулей"}.
{"Stop Modules", "Остановка модулей"}. {"Stop Modules", "Остановка модулей"}.
{"Backup Management", "Управление резервным копированием"}.
{"Import users from jabberd1.4 spool files", "Импорт пользователей из спула jabberd1.4"}.
{"Backup", "Резервное копирование"}.
{"Restore", "Восстановление из резервной копии"}.
{"Dump to Text File", "Копирование в текстовый файл"}.
{"Import File", "Импорт из файла"}.
{"Import Directory", "Импорт из директории"}.
% mod_register.erl % mod_register.erl
{"Choose a username and password to register with this server.", {"Choose a username and password to register with this server",
"Выберите идентификатор пользователя и пароль для регистрации на этом сервере."}. "Выберите имя пользователя и пароль для регистрации на этом сервере"}.
% mod_vcard.erl % mod_vcard.erl
{"You need a x:data capable client to search", {"Erlang Jabber Server\nCopyright (c) 2002-2004 Alexey Shchepin",
"Чтобы воспользоваться поиском, Вам нужен x:data-совместимый клиент"}. "Erlang Jabber Server\nCopyright (c) 2002-2004 Алексей Щепин"}.
{"Users Search", "Поиск пользователей"}. {"ejabberd vCard module\nCopyright (c) 2003-2004 Alexey Shchepin",
"ejabberd vCard модуль\nCopyright (c) 2003-2004 Алексей Щепин"}.
{"You need an x:data capable client to search",
"Чтобы воспользоваться поиском, требуется x:data-совместимый клиент"}.
{"Search users in ", "Поиск пользователей в "}.
{"Fill in fields to search for any matching Jabber User", {"Fill in fields to search for any matching Jabber User",
"Заполните поля для поиска пользователя Jabber"}. "Заполните поля для поиска пользователя Jabber"}.
{"Users Search Results", "Результат поиска пользователей"}. {"Results of search in ", "Результаты поиска в "}.
{"User", "Пользователь"}. {"User", "Пользователь"}.
{"Full Name", "Полное имя"}. {"Full Name", "Полное имя"}.
@ -63,13 +91,23 @@
{"Organization Name", "Название организации"}. {"Organization Name", "Название организации"}.
{"Organization Unit", "Отдел организации"}. {"Organization Unit", "Отдел организации"}.
% mod_pubsub/mod_pubsub.erl
{"ejabberd pub/sub module\nCopyright (c) 2003-2004 Alexey Shchepin",
"ejabberd pub/sub модуль\nCopyright (c) 2003-2004 Алексей Щепин"}.
% mod_muc/mod_muc.erl % mod_muc/mod_muc.erl
{"Nickname Registration", "Регистрация псевдонима"}. {"You need an x:data capable client to register nickname",
{"Enter nickname you want to register.", "Введите псевдоним, который вы хотели бы зарегистрировать"}. "Чтобы зарегистрировать псевдоним, требуется x:data-совместимый клиент"}.
{"ejabberd MUC module\nCopyright (c) 2003 Alexey Shchepin", {"Nickname Registration at ", "Регистрация псевдонима на "}.
"ejabberd MUC модуль\nCopyright (c) 2003 Алексей Щепин"}. {"Enter nickname you want to register", "Введите псевдоним, который Вы хотели бы зарегистрировать"}.
{"ejabberd MUC module\nCopyright (c) 2003-2004 Alexey Shchepin",
"ejabberd MUC модуль\nCopyright (c) 2003-2004 Алексей Щепин"}.
% mod_muc/mod_muc_room.erl % mod_muc/mod_muc_room.erl
{" has set the subject to: ", " установил(а) тему: "}.
{"You need an x:data capable client to configure room",
"Чтобы сконфигурировать комнату, требуется x:data-совместимый клиент"}.
{"Configuration for ", "Конфигурация "}.
{"Room title", "Название комнаты"}. {"Room title", "Название комнаты"}.
{"Allow users to change subject?", "Разрешить пользователям изменять тему?"}. {"Allow users to change subject?", "Разрешить пользователям изменять тему?"}.
{"Allow users to query other users?", {"Allow users to query other users?",
@ -87,13 +125,18 @@
{"Allow users to send invites?", {"Allow users to send invites?",
"Разрешить пользователям посылать приглашения?"}. "Разрешить пользователям посылать приглашения?"}.
{"Make room password protected?", "Сделать комнату защищённой паролем?"}. {"Make room password protected?", "Сделать комнату защищённой паролем?"}.
{"Password", "Пароль"}.
{"Make room anonymous?", "Сделать комнату анонимной?"}. {"Make room anonymous?", "Сделать комнату анонимной?"}.
{"Enable logging?", "Включить журналирование?"}. {"Enable logging?", "Включить журналирование?"}.
% mod_irc/mod_irc.erl % mod_irc/mod_irc.erl
{"ejabberd IRC module\nCopyright (c) 2003-2004 Alexey Shchepin",
"ejabberd IRC модуль\nCopyright (c) 2003-2004 Алексей Щепин"}.
{"You need an x:data capable client to configure mod_irc settings", {"You need an x:data capable client to configure mod_irc settings",
"Чтобы настроить параметры mod_irc, нужен x:data-совместимый клиент"}. "Чтобы настроить параметры mod_irc, требуется x:data-совместимый клиент"}.
{"mod_irc configuration for", "Конфигурация mod_irc для"}. {"Registration in mod_irc for ", "Регистрация в mod_irc для "}.
{"Enter username and encodings you wish to use for connecting to IRC servers",
"Введите имя пользователя и кодировки, которые будут использоваться при подключении к IRC-серверам"}.
{"IRC Username", "Имя пользователя IRC"}. {"IRC Username", "Имя пользователя IRC"}.
{"If you want to specify different encodings for IRC servers, fill this list with values in format '{\"irc server\", \"encoding\"}'. By default this service use \"~s\" encoding.", "Чтобы указать различные кодировки для разных серверов IRC, заполните список значениями в формате '{\"irc server\", \"encoding\"}'. По умолчанию эта служба использует кодировку \"~s\"."}. {"If you want to specify different encodings for IRC servers, fill this list with values in format '{\"irc server\", \"encoding\"}'. By default this service use \"~s\" encoding.", "Чтобы указать различные кодировки для разных серверов IRC, заполните список значениями в формате '{\"irc server\", \"encoding\"}'. По умолчанию эта служба использует кодировку \"~s\"."}.
{"Example: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}].", "Примеры: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}]."}. {"Example: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}].", "Примеры: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}]."}.