Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ejabberd_captcha.erl7
-rw-r--r--src/mod_http_upload.erl3
-rw-r--r--src/mod_irc.erl8
-rw-r--r--src/mod_muc_room.erl9
-rw-r--r--src/mod_register.erl9
-rw-r--r--src/pubsub_subscription.erl20
-rw-r--r--src/pubsub_subscription_sql.erl20
7 files changed, 29 insertions, 47 deletions
diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl
index f959d7f30..85d7595a2 100644
--- a/src/ejabberd_captcha.erl
+++ b/src/ejabberd_captcha.erl
@@ -100,11 +100,8 @@ create_captcha(SID, From, To, Lang, Limiter, Args) ->
mk_ocr_field(Lang, CID, Type)],
X = #xdata{type = form, fields = Fs},
Captcha = #xcaptcha{xdata = X},
- BodyString1 = translate:translate(Lang,
- <<"Your messages to ~s are being blocked. "
- "To unblock them, visit ~s">>),
- BodyString = (str:format(BodyString1,
- [JID, get_url(Id)])),
+ BodyString = {<<"Your messages to ~s are being blocked. "
+ "To unblock them, visit ~s">>, [JID, get_url(Id)]},
Body = xmpp:mk_text(BodyString, Lang),
OOB = #oob_x{url = get_url(Id)},
Tref = erlang:send_after(?CAPTCHA_LIFETIME, ?MODULE,
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl
index 1abde4f5b..37eaad27a 100644
--- a/src/mod_http_upload.erl
+++ b/src/mod_http_upload.erl
@@ -579,8 +579,7 @@ process_iq(_From, #iq{}, _State) ->
create_slot(#state{service_url = undefined, max_size = MaxSize},
JID, File, Size, _ContentType, Lang) when MaxSize /= infinity,
Size > MaxSize ->
- Text = <<"File larger than ", (integer_to_binary(MaxSize))/binary,
- " Bytes.">>,
+ Text = {<<"File larger than ~w bytes">>, [MaxSize]},
?INFO_MSG("Rejecting file ~s from ~s (too large: ~B bytes)",
[File, jid:to_string(JID), Size]),
{error, xmpp:err_not_acceptable(Text, Lang)};
diff --git a/src/mod_irc.erl b/src/mod_irc.erl
index 77bf34801..f43a6653d 100644
--- a/src/mod_irc.erl
+++ b/src/mod_irc.erl
@@ -655,12 +655,10 @@ adhoc_join(From, To, #adhoc_command{lang = Lang, xdata = X} = Request) ->
RoomJID = jid:make(<<Channel/binary, "%", Server/binary>>,
To#jid.server),
Reason = translate:translate(Lang, <<"Join the IRC channel here.">>),
- Body = str:format(
- translate:translate(
- Lang, <<"Join the IRC channel in this Jabber ID: ~s">>),
- [jid:to_string(RoomJID)]),
+ BodyTxt = {<<"Join the IRC channel in this Jabber ID: ~s">>,
+ [jid:to_string(RoomJID)]},
Invite = #message{
- body = xmpp:mk_text(Body, Lang),
+ body = xmpp:mk_text(BodyTxt, Lang),
sub_els = [#muc_user{
invites = [#muc_invite{from = From,
reason = Reason}]},
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index 2d21365d5..957220540 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -2723,11 +2723,8 @@ find_changed_items(UJID, UAffiliation, URole,
Nick /= <<"">> ->
case find_jids_by_nick(Nick, StateData) of
[] ->
- ErrText = str:format(
- translate:translate(
- Lang,
- <<"Nickname ~s does not exist in the room">>),
- [Nick]),
+ ErrText = {<<"Nickname ~s does not exist in the room">>,
+ [Nick]},
throw({error, xmpp:err_not_acceptable(ErrText, Lang)});
JIDList ->
JIDList
@@ -3299,7 +3296,7 @@ set_config(Opts, Config, ServerHost, Lang) ->
{0, undefined} ->
?ERROR_MSG("set_room_option hook failed for "
"option '~s' with value ~p", [O, V]),
- Txt = <<"Failed to process option '", O/binary, "'">>,
+ Txt = {<<"Failed to process option '~s'">>, [O]},
{error, xmpp:err_internal_server_error(Txt, Lang)};
{Pos, Val} ->
setelement(Pos, C, Val)
diff --git a/src/mod_register.erl b/src/mod_register.erl
index 3cec0660b..ba261e0f3 100644
--- a/src/mod_register.erl
+++ b/src/mod_register.erl
@@ -202,13 +202,13 @@ process_iq(#iq{type = get, from = From, to = To, id = ID, lang = Lang} = IQ,
_ ->
{false, <<"">>}
end,
+ Instr = translate:translate(
+ Lang, <<"Choose a username and password to register "
+ "with this server">>),
if IsCaptchaEnabled and not IsRegistered ->
TopInstr = translate:translate(
Lang, <<"You need a client that supports x:data "
"and CAPTCHA to register">>),
- Instr = translate:translate(
- Lang, <<"Choose a username and password to register "
- "with this server">>),
UField = #xdata_field{type = 'text-single',
label = translate:translate(Lang, <<"User">>),
var = <<"username">>,
@@ -234,10 +234,9 @@ process_iq(#iq{type = get, from = From, to = To, id = ID, lang = Lang} = IQ,
IQ, xmpp:err_internal_server_error(ErrText, Lang))
end;
true ->
- Instr = <<"Choose a username and password to register with this server">>,
xmpp:make_iq_result(
IQ,
- #register{instructions = translate:translate(Lang, Instr),
+ #register{instructions = Instr,
username = Username,
password = <<"">>,
registered = IsRegistered})
diff --git a/src/pubsub_subscription.erl b/src/pubsub_subscription.erl
index b6986b69d..077ac5ba9 100644
--- a/src/pubsub_subscription.erl
+++ b/src/pubsub_subscription.erl
@@ -206,16 +206,14 @@ val_xfield(digest_frequency = Opt, [Val]) ->
case catch binary_to_integer(Val) of
N when is_integer(N) -> N;
_ ->
- Txt = <<"Value of '~s' should be integer">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be integer">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end;
val_xfield(expire = Opt, [Val]) ->
try xmpp_util:decode_timestamp(Val)
catch _:{bad_timestamp, _} ->
- Txt = <<"Value of '~s' should be datetime string">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be datetime string">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end;
val_xfield(include_body = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(show_values, Vals) -> Vals;
@@ -226,9 +224,8 @@ val_xfield(subscription_depth = Opt, [Depth]) ->
case catch binary_to_integer(Depth) of
N when is_integer(N) -> N;
_ ->
- Txt = <<"Value of '~s' should be integer">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be integer">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end.
%% Convert XForm booleans to Erlang booleans.
@@ -237,9 +234,8 @@ xopt_to_bool(_, <<"1">>) -> true;
xopt_to_bool(_, <<"false">>) -> false;
xopt_to_bool(_, <<"true">>) -> true;
xopt_to_bool(Option, _) ->
- Txt = <<"Value of '~s' should be boolean">>,
- ErrTxt = (str:format(Txt, [Option])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}.
+ Txt = {<<"Value of '~s' should be boolean">>, [Option]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}.
%% Return a field for an XForm for Key, with data filled in, if
%% applicable, from Options.
diff --git a/src/pubsub_subscription_sql.erl b/src/pubsub_subscription_sql.erl
index da72cc96e..fddfe881e 100644
--- a/src/pubsub_subscription_sql.erl
+++ b/src/pubsub_subscription_sql.erl
@@ -171,16 +171,14 @@ val_xfield(digest_frequency = Opt, [Val]) ->
case catch binary_to_integer(Val) of
N when is_integer(N) -> N;
_ ->
- Txt = <<"Value of '~s' should be integer">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be integer">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end;
val_xfield(expire = Opt, [Val]) ->
try xmpp_util:decode_timestamp(Val)
catch _:{bad_timestamp, _} ->
- Txt = <<"Value of '~s' should be datetime string">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be datetime string">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end;
val_xfield(include_body = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(show_values, Vals) -> Vals;
@@ -191,9 +189,8 @@ val_xfield(subscription_depth = Opt, [Depth]) ->
case catch binary_to_integer(Depth) of
N when is_integer(N) -> N;
_ ->
- Txt = <<"Value of '~s' should be integer">>,
- ErrTxt = (str:format(Txt, [Opt])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}
+ Txt = {<<"Value of '~s' should be integer">>, [Opt]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}
end.
%% Convert XForm booleans to Erlang booleans.
@@ -202,9 +199,8 @@ xopt_to_bool(_, <<"1">>) -> true;
xopt_to_bool(_, <<"false">>) -> false;
xopt_to_bool(_, <<"true">>) -> true;
xopt_to_bool(Option, _) ->
- Txt = <<"Value of '~s' should be boolean">>,
- ErrTxt = (str:format(Txt, [Option])),
- {error, xmpp:err_not_acceptable(ErrTxt, ?MYLANG)}.
+ Txt = {<<"Value of '~s' should be boolean">>, [Option]},
+ {error, xmpp:err_not_acceptable(Txt, ?MYLANG)}.
%% Return a field for an XForm for Key, with data filled in, if
%% applicable, from Options.