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,
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)};
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}]},
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
{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)
_ ->
{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">>,
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})
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;
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.
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.
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;
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.
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.