From: Evgeniy Khramtsov Date: Mon, 20 Mar 2017 06:57:11 +0000 (+0300) Subject: Use new xdata compiler API X-Git-Tag: 17.03~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3ecba0445f62199de1cf553d543c0cc9a1061f1;p=ejabberd Use new xdata compiler API --- diff --git a/rebar.config b/rebar.config index a80fefe07..d2e459f86 100644 --- a/rebar.config +++ b/rebar.config @@ -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"}}}, diff --git a/src/mod_muc.erl b/src/mod_muc.erl index f9488cf9a..65e61694f 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -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, diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 8ab14a92b..dc30cc898 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -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, diff --git a/src/mod_offline.erl b/src/mod_offline.erl index ba304f821..db2efb040 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -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. diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 4ea840011..a0ac8643e 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -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). %%

There are several reasons why the node configuration request might fail:

%%