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

Use new xdata compiler API

This commit is contained in:
Evgeniy Khramtsov 2017-03-20 09:57:11 +03:00
parent 06f42bc749
commit f3ecba0445
5 changed files with 10 additions and 14 deletions

View File

@ -24,7 +24,7 @@
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", "afdd07811e0e6eff444c035ffeb2aa9efb4dbe6d"}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "cfb5c11280fdd82f8370d9322bbcb3255b743c76"}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "50f2d85"}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}},

View File

@ -772,9 +772,7 @@ iq_get_register_info(ServerHost, Host, From, Lang) ->
Title = <<(translate:translate(
Lang, <<"Nickname Registration at ">>))/binary, Host/binary>>,
Inst = translate:translate(Lang, <<"Enter nickname you want to register">>),
Fields = muc_register:encode(
[{roomnick, Nick}],
fun(T) -> translate:translate(Lang, T) end),
Fields = muc_register:encode([{roomnick, Nick}], Lang),
X = #xdata{type = form, title = Title,
instructions = [Inst], fields = Fields},
#register{nick = Nick,

View File

@ -3198,8 +3198,7 @@ get_config(Lang, StateData, From) ->
Fs,
[StateData, From, Lang]),
#xdata{type = form, title = Title,
fields = muc_roomconfig:encode(
Fields, fun(T) -> translate:translate(Lang, T) end)}.
fields = muc_roomconfig:encode(Fields, Lang)}.
-spec set_config(muc_roomconfig:result(), state(), binary()) ->
{error, stanza_error()} | {result, undefined, state()}.
@ -3613,8 +3612,7 @@ iq_disco_info_extras(Lang, StateData) ->
Fs = [{description, (StateData#state.config)#config.description},
{occupants, ?DICT:size(StateData#state.users)}],
#xdata{type = result,
fields = muc_roominfo:encode(
Fs, fun(T) -> translate:translate(Lang, T) end)}.
fields = muc_roominfo:encode(Fs, Lang)}.
-spec process_iq_disco_items(jid(), iq(), state()) ->
{error, stanza_error()} | {result, disco_items()}.
@ -3835,7 +3833,7 @@ prepare_request_form(Requester, Nick, Lang) ->
{jid, Requester},
{roomnick, Nick},
{request_allow, false}],
fun(T) -> translate:translate(Lang, T) end),
Lang),
#message{type = normal,
sub_els = [#xdata{type = form,
title = Title,

View File

@ -319,7 +319,7 @@ get_info(_Acc, #jid{luser = U, lserver = S} = JID,
[#xdata{type = result,
fields = flex_offline:encode(
[{number_of_messages, count_offline_messages(U, S)}],
fun(T) -> translate:translate(Lang, T) end)}];
Lang)}];
get_info(Acc, _From, _To, _Node, _Lang) ->
Acc.

View File

@ -1371,7 +1371,7 @@ adhoc_request(_Host, _ServerHost, _Owner, Other, _Access, _Plugins) ->
-spec send_pending_node_form(binary(), jid(), binary(),
[binary()]) -> adhoc_command() | {error, stanza_error()}.
send_pending_node_form(Host, Owner, _Lang, Plugins) ->
send_pending_node_form(Host, Owner, Lang, Plugins) ->
Filter = fun (Type) ->
lists:member(<<"get-pending">>, plugin_features(Host, Type))
end,
@ -1385,7 +1385,7 @@ send_pending_node_form(Host, Owner, _Lang, Plugins) ->
{ok, Nodes} ->
XForm = #xdata{type = form,
fields = pubsub_get_pending:encode(
[{node, Nodes}])},
[{node, Nodes}], Lang)},
#adhoc_command{status = executing, action = execute,
xdata = XForm};
Err ->
@ -1454,7 +1454,7 @@ send_authorization_request(#pubsub_node{nodeid = {Host, Node},
[{node, Node},
{subscriber_jid, Subscriber},
{allow, false}],
fun(T) -> translate:translate(Lang, T) end),
Lang),
X = #xdata{type = form,
title = translate:translate(
Lang, <<"PubSub subscriber request">>),
@ -3281,7 +3281,7 @@ get_configure_xfields(_Type, Options, Lang, Groups) ->
(Opt) ->
Opt
end, Options),
fun(Txt) -> translate:translate(Lang, Txt) end).
Lang).
%%<p>There are several reasons why the node configuration request might fail:</p>
%%<ul>