mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
* src/mod_irc/mod_irc.erl: Now uses "ejabber:config" namespace (thanks to Sergei Golovan) * src/mod_disco.erl: Fixed disco category and type (thanks to Sergei Golovan) * src/mod_pubsub/mod_pubsub.erl: Likewise * src/jlib.hrl: Added "ejabber:config" namespace (thanks to Sergei Golovan) SVN Revision: 202
This commit is contained in:
parent
976e185a4a
commit
b0b4b9a903
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2004-02-10 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
|
||||||
|
|
||||||
|
* src/mod_irc/mod_irc.erl: Now uses "ejabber:config" namespace
|
||||||
|
(thanks to Sergei Golovan)
|
||||||
|
|
||||||
|
* src/mod_disco.erl: Fixed disco category and type (thanks to
|
||||||
|
Sergei Golovan)
|
||||||
|
* src/mod_pubsub/mod_pubsub.erl: Likewise
|
||||||
|
|
||||||
|
* src/jlib.hrl: Added "ejabber:config" namespace (thanks to Sergei
|
||||||
|
Golovan)
|
||||||
|
|
||||||
2004-01-27 Alexey Shchepin <alexey@sevcom.net>
|
2004-01-27 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/ejabberd_ctl.erl: Added command for log reopening
|
* src/ejabberd_ctl.erl: Added command for log reopening
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
-define(NS_PUBSUB_OWNER, "http://jabber.org/protocol/pubsub#owner").
|
-define(NS_PUBSUB_OWNER, "http://jabber.org/protocol/pubsub#owner").
|
||||||
-define(NS_PUBSUB_NMI, "http://jabber.org/protocol/pubsub#node-meta-info").
|
-define(NS_PUBSUB_NMI, "http://jabber.org/protocol/pubsub#node-meta-info").
|
||||||
|
|
||||||
|
-define(NS_EJABBERD_CONFIG, "ejabberd:config").
|
||||||
|
|
||||||
-define(NS_STREAM, "http://etherx.jabber.org/streams").
|
-define(NS_STREAM, "http://etherx.jabber.org/streams").
|
||||||
|
|
||||||
-define(NS_STANZAS, "urn:ietf:params:xml:ns:xmpp-stanzas").
|
-define(NS_STANZAS, "urn:ietf:params:xml:ns:xmpp-stanzas").
|
||||||
|
@ -124,7 +124,7 @@ process_local_iq_info(From, _To, #iq{type = Type, xmlns = XMLNS,
|
|||||||
"query",
|
"query",
|
||||||
[{"xmlns", ?NS_DISCO_INFO}],
|
[{"xmlns", ?NS_DISCO_INFO}],
|
||||||
[{xmlelement, "identity",
|
[{xmlelement, "identity",
|
||||||
[{"category", "service"},
|
[{"category", "server"},
|
||||||
{"type", "im"},
|
{"type", "im"},
|
||||||
{"name", "ejabberd"}], []}] ++
|
{"name", "ejabberd"}], []}] ++
|
||||||
Features
|
Features
|
||||||
|
@ -72,9 +72,9 @@ 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_IQDATA,
|
#iq{type = Type, xmlns = ?NS_EJABBERD_CONFIG,
|
||||||
sub_el = SubEl} = IQ ->
|
sub_el = SubEl} = IQ ->
|
||||||
iq_data(From, To, IQ);
|
ejabberd_config(From, To, IQ);
|
||||||
#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 +155,12 @@ iq_disco() ->
|
|||||||
{xmlelement, "feature",
|
{xmlelement, "feature",
|
||||||
[{"var", ?NS_MUC}], []},
|
[{"var", ?NS_MUC}], []},
|
||||||
{xmlelement, "feature",
|
{xmlelement, "feature",
|
||||||
[{"var", ?NS_IQDATA}], []}].
|
[{"var", ?NS_EJABBERD_CONFIG}], []}].
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iq_data(From, To, #iq{type = Type} = IQ) ->
|
ejabberd_config(From, To, #iq{type = Type} = IQ) ->
|
||||||
case catch process_iq_data(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 ->
|
||||||
@ -173,42 +173,64 @@ iq_data(From, To, #iq{type = Type} = IQ) ->
|
|||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
find_xdata_el({xmlelement, _Name, _Attrs, SubEls}) ->
|
||||||
|
find_xdata_el1(SubEls).
|
||||||
|
|
||||||
process_iq_data(From, To,
|
find_xdata_el1([]) ->
|
||||||
|
false;
|
||||||
|
|
||||||
|
find_xdata_el1([{xmlelement, Name, Attrs, SubEls} | Els]) ->
|
||||||
|
case xml:get_attr_s("xmlns", Attrs) of
|
||||||
|
?NS_XDATA ->
|
||||||
|
{xmlelement, Name, Attrs, SubEls};
|
||||||
|
_ ->
|
||||||
|
find_xdata_el1(Els)
|
||||||
|
end;
|
||||||
|
|
||||||
|
find_xdata_el1([_ | Els]) ->
|
||||||
|
find_xdata_el1(Els).
|
||||||
|
|
||||||
|
process_ejabberd_config(From, To,
|
||||||
#iq{type = Type, xmlns = XMLNS, sub_el = SubEl} = IQ) ->
|
#iq{type = Type, xmlns = XMLNS, sub_el = SubEl} = IQ) ->
|
||||||
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
Lang = xml:get_tag_attr_s("xml:lang", SubEl),
|
||||||
case Type of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
case xml:get_tag_attr_s("type", SubEl) of
|
XDataEl = find_xdata_el(SubEl),
|
||||||
"cancel" ->
|
case XDataEl of
|
||||||
IQ#iq{type = result,
|
false ->
|
||||||
sub_el = [{xmlelement, "query",
|
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ACCEPTABLE]};
|
||||||
[{"xmlns", XMLNS}], []}]};
|
{xmlelement, _Name, Attrs, SubEls} ->
|
||||||
"submit" ->
|
case xml:get_attr_s("type", Attrs) of
|
||||||
XData = jlib:parse_xdata_submit(SubEl),
|
"cancel" ->
|
||||||
case XData of
|
IQ#iq{type = result,
|
||||||
invalid ->
|
sub_el = [{xmlelement, "query",
|
||||||
IQ#iq{type = error,
|
[{"xmlns", XMLNS}], []}]};
|
||||||
sub_el = [SubEl, ?ERR_BAD_REQUEST]};
|
"submit" ->
|
||||||
_ ->
|
XData = jlib:parse_xdata_submit(XDataEl),
|
||||||
Node =
|
case XData of
|
||||||
string:tokens(
|
invalid ->
|
||||||
xml:get_tag_attr_s("node", SubEl),
|
|
||||||
"/"),
|
|
||||||
case set_form(From, Node, Lang, XData) of
|
|
||||||
{result, Res} ->
|
|
||||||
IQ#iq{type = result,
|
|
||||||
sub_el = [{xmlelement, "query",
|
|
||||||
[{"xmlns", XMLNS}],
|
|
||||||
Res
|
|
||||||
}]};
|
|
||||||
{error, Error} ->
|
|
||||||
IQ#iq{type = error,
|
IQ#iq{type = error,
|
||||||
sub_el = [SubEl, Error]}
|
sub_el = [SubEl, ?ERR_BAD_REQUEST]};
|
||||||
end
|
_ ->
|
||||||
end;
|
Node = string:tokens(
|
||||||
_ ->
|
xml:get_tag_attr_s("node", SubEl),
|
||||||
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
|
"/"),
|
||||||
|
case set_form(From, Node, Lang, XData) of
|
||||||
|
{result, Res} ->
|
||||||
|
IQ#iq{type = result,
|
||||||
|
sub_el = [{xmlelement, "query",
|
||||||
|
[{"xmlns", XMLNS}],
|
||||||
|
Res
|
||||||
|
}]};
|
||||||
|
{error, Error} ->
|
||||||
|
IQ#iq{type = error,
|
||||||
|
sub_el = [SubEl, Error]}
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
IQ#iq{type = error,
|
||||||
|
sub_el = [SubEl, ?ERR_BAD_REQUEST]}
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
get ->
|
get ->
|
||||||
Node =
|
Node =
|
||||||
@ -246,54 +268,61 @@ get_form(From, [], Lang) ->
|
|||||||
Customs;
|
Customs;
|
||||||
{Username, Encodings} ->
|
{Username, Encodings} ->
|
||||||
{result,
|
{result,
|
||||||
[{xmlelement, "title", [],
|
[{xmlelement, "instructions", [],
|
||||||
[{xmlcdata,
|
[{xmlcdata,
|
||||||
User ++ "@" ++ Server ++ " " ++
|
translate:translate(
|
||||||
translate:translate(Lang, "Configuration")}]},
|
Lang,
|
||||||
|
"You need an x:data capable client "
|
||||||
|
"to configure mod_irc settings")}]},
|
||||||
|
{xmlelement, "x", [{"xmlns", ?NS_XDATA}],
|
||||||
|
[{xmlelement, "title", [],
|
||||||
|
[{xmlcdata,
|
||||||
|
translate:translate(Lang, "mod_irc configuration for") ++
|
||||||
|
" " ++ User ++ "@" ++ Server}]},
|
||||||
%{xmlelement, "instructions", [],
|
%{xmlelement, "instructions", [],
|
||||||
% [{xmlcdata,
|
% [{xmlcdata,
|
||||||
% translate:translate(
|
% translate:translate(
|
||||||
% Lang, "")}]},
|
% Lang, "")}]},
|
||||||
{xmlelement, "field", [{"type", "text-single"},
|
{xmlelement, "field", [{"type", "text-single"},
|
||||||
{"label",
|
{"label",
|
||||||
translate:translate(
|
translate:translate(
|
||||||
Lang, "IRC Username")},
|
Lang, "IRC Username")},
|
||||||
{"var", "username"}],
|
{"var", "username"}],
|
||||||
[{xmlelement, "value", [], [{xmlcdata, Username}]}]},
|
[{xmlelement, "value", [], [{xmlcdata, Username}]}]},
|
||||||
{xmlelement, "field", [{"type", "fixed"}],
|
{xmlelement, "field", [{"type", "fixed"}],
|
||||||
[{xmlelement, "value", [],
|
[{xmlelement, "value", [],
|
||||||
[{xmlcdata,
|
[{xmlcdata,
|
||||||
lists:flatten(
|
lists:flatten(
|
||||||
io_lib:format(
|
io_lib:format(
|
||||||
translate:translate(
|
translate:translate(
|
||||||
Lang,
|
Lang,
|
||||||
"If you want to specify different encodings "
|
"If you want to specify different encodings "
|
||||||
"for IRC servers, fill this list with values "
|
"for IRC servers, fill this list with values "
|
||||||
"in format '{\"irc server\", \"encoding\"}'. "
|
"in format '{\"irc server\", \"encoding\"}'. "
|
||||||
"By default this service use \"~s\" encoding."),
|
"By default this service use \"~s\" encoding."),
|
||||||
[?DEFAULT_IRC_ENCODING]))}]}]},
|
[?DEFAULT_IRC_ENCODING]))}]}]},
|
||||||
{xmlelement, "field", [{"type", "fixed"}],
|
{xmlelement, "field", [{"type", "fixed"}],
|
||||||
[{xmlelement, "value", [],
|
[{xmlelement, "value", [],
|
||||||
[{xmlcdata,
|
[{xmlcdata,
|
||||||
translate:translate(
|
translate:translate(
|
||||||
Lang,
|
Lang,
|
||||||
"Example: [{\"irc.lucky.net\", \"koi8-r\"}, "
|
"Example: [{\"irc.lucky.net\", \"koi8-r\"}, "
|
||||||
"{\"vendetta.fef.net\", \"iso8859-1\"}]."
|
"{\"vendetta.fef.net\", \"iso8859-1\"}]."
|
||||||
)}]}]},
|
)}]}]},
|
||||||
{xmlelement, "field", [{"type", "text-multi"},
|
{xmlelement, "field", [{"type", "text-multi"},
|
||||||
{"label",
|
{"label",
|
||||||
translate:translate(Lang, "Encodings")},
|
translate:translate(Lang, "Encodings")},
|
||||||
{"var", "encodings"}],
|
{"var", "encodings"}],
|
||||||
lists:map(
|
lists:map(
|
||||||
fun(S) ->
|
fun(S) ->
|
||||||
{xmlelement, "value", [], [{xmlcdata, S}]}
|
{xmlelement, "value", [], [{xmlcdata, S}]}
|
||||||
end,
|
end,
|
||||||
string:tokens(
|
string:tokens(
|
||||||
lists:flatten(
|
lists:flatten(
|
||||||
io_lib:format("~p.", [Encodings])),
|
io_lib:format("~p.", [Encodings])),
|
||||||
"\n"))
|
"\n"))
|
||||||
}
|
}
|
||||||
]}
|
]}]}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ iq_disco_info(SNode) ->
|
|||||||
case Node of
|
case Node of
|
||||||
[] ->
|
[] ->
|
||||||
[{xmlelement, "identity",
|
[{xmlelement, "identity",
|
||||||
[{"category", "service"},
|
[{"category", "pubsub"},
|
||||||
{"type", "pubsub"},
|
{"type", "generic"},
|
||||||
{"name", "ejabberd/mod_pubsub"}], []},
|
{"name", "ejabberd/mod_pubsub"}], []},
|
||||||
%{xmlelement, "feature", [{"var", ?NS_REGISTER}], []},
|
%{xmlelement, "feature", [{"var", ?NS_REGISTER}], []},
|
||||||
{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []},
|
{xmlelement, "feature", [{"var", ?NS_PUBSUB}], []},
|
||||||
|
@ -90,7 +90,14 @@
|
|||||||
{"Make room anonymous?", "Сделать комнату анонимной?"}.
|
{"Make room anonymous?", "Сделать комнату анонимной?"}.
|
||||||
{"Enable logging?", "Включить журналирование?"}.
|
{"Enable logging?", "Включить журналирование?"}.
|
||||||
|
|
||||||
|
% mod_irc/mod_irc.erl
|
||||||
|
{"You need an x:data capable client to configure mod_irc settings",
|
||||||
|
"Чтобы настроить параметры mod_irc, нужен x:data-совместимый клиент"}.
|
||||||
|
{"mod_irc configuration for", "Конфигурация mod_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\"."}.
|
||||||
|
{"Example: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}].", "Примеры: [{\"irc.lucky.net\", \"koi8-r\"}, {\"vendetta.fef.net\", \"iso8859-1\"}]."}.
|
||||||
|
{"Encodings", "Кодировки"}.
|
||||||
|
|
||||||
% Local Variables:
|
% Local Variables:
|
||||||
% mode: erlang
|
% mode: erlang
|
||||||
|
Loading…
Reference in New Issue
Block a user