25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Correctly handle unicode in log messages

This commit is contained in:
Evgeny Khramtsov 2019-09-23 15:17:20 +03:00
parent 2e1e128833
commit 5770946f03
124 changed files with 759 additions and 765 deletions

View File

@ -90,7 +90,7 @@ format_error({bad_module, Mod}, Ctx)
when Ctx == [listen, module]; when Ctx == [listen, module];
Ctx == [listen, request_handlers] -> Ctx == [listen, request_handlers] ->
Mods = ejabberd_config:beams(all), Mods = ejabberd_config:beams(all),
format("~s: unknown ~s: ~s. Did you mean ~s?", format("~ts: unknown ~ts: ~ts. Did you mean ~ts?",
[yconf:format_ctx(Ctx), [yconf:format_ctx(Ctx),
format_module_type(Ctx), format_module_type(Ctx),
format_module(Mod), format_module(Mod),
@ -105,7 +105,7 @@ format_error({bad_module, Mod}, Ctx)
_ -> false _ -> false
end end
end, ejabberd_config:beams(all)), end, ejabberd_config:beams(all)),
format("~s: unknown ~s: ~s. Did you mean ~s?", format("~ts: unknown ~ts: ~ts. Did you mean ~ts?",
[yconf:format_ctx(Ctx), [yconf:format_ctx(Ctx),
format_module_type(Ctx), format_module_type(Ctx),
format_module(Mod), format_module(Mod),
@ -118,30 +118,30 @@ format_error({bad_export, {F, A}, Mod}, Ctx)
Slogan = yconf:format_ctx(Ctx), Slogan = yconf:format_ctx(Ctx),
case lists:member(Mod, ejabberd_config:beams(local)) of case lists:member(Mod, ejabberd_config:beams(local)) of
true -> true ->
format("~s: '~s' is not a ~s", format("~ts: '~ts' is not a ~ts",
[Slogan, format_module(Mod), Type]); [Slogan, format_module(Mod), Type]);
false -> false ->
case lists:member(Mod, ejabberd_config:beams(external)) of case lists:member(Mod, ejabberd_config:beams(external)) of
true -> true ->
format("~s: third-party ~s '~s' doesn't export " format("~ts: third-party ~ts '~ts' doesn't export "
"function ~s/~B. If it's really a ~s, " "function ~ts/~B. If it's really a ~ts, "
"consider to upgrade it", "consider to upgrade it",
[Slogan, Type, format_module(Mod),F, A, Type]); [Slogan, Type, format_module(Mod),F, A, Type]);
false -> false ->
format("~s: '~s' doesn't match any known ~s", format("~ts: '~ts' doesn't match any known ~ts",
[Slogan, format_module(Mod), Type]) [Slogan, format_module(Mod), Type])
end end
end; end;
format_error({unknown_option, [], _} = Why, Ctx) -> format_error({unknown_option, [], _} = Why, Ctx) ->
format("~s. There are no available options", format("~ts. There are no available options",
[yconf:format_error(Why, Ctx)]); [yconf:format_error(Why, Ctx)]);
format_error({unknown_option, Known, Opt} = Why, Ctx) -> format_error({unknown_option, Known, Opt} = Why, Ctx) ->
format("~s. Did you mean ~s? ~s", format("~ts. Did you mean ~ts? ~ts",
[yconf:format_error(Why, Ctx), [yconf:format_error(Why, Ctx),
misc:best_match(Opt, Known), misc:best_match(Opt, Known),
format_known("Available options", Known)]); format_known("Available options", Known)]);
format_error({bad_enum, Known, Bad} = Why, Ctx) -> format_error({bad_enum, Known, Bad} = Why, Ctx) ->
format("~s. Did you mean ~s? ~s", format("~ts. Did you mean ~ts? ~ts",
[yconf:format_error(Why, Ctx), [yconf:format_error(Why, Ctx),
misc:best_match(Bad, Known), misc:best_match(Bad, Known),
format_known("Possible values", Known)]); format_known("Possible values", Known)]);
@ -152,43 +152,43 @@ format_error(Reason, Ctx) ->
yconf:format_ctx(Ctx) ++ ": " ++ [string:to_lower(H)|T]. yconf:format_ctx(Ctx) ++ ": " ++ [string:to_lower(H)|T].
format_error({bad_db_type, _, Atom}) -> format_error({bad_db_type, _, Atom}) ->
format("unsupported database: ~s", [Atom]); format("unsupported database: ~ts", [Atom]);
format_error({bad_lang, Lang}) -> format_error({bad_lang, Lang}) ->
format("Invalid language tag: ~s", [Lang]); format("Invalid language tag: ~ts", [Lang]);
format_error({bad_pem, Why, Path}) -> format_error({bad_pem, Why, Path}) ->
format("Failed to read PEM file '~s': ~s", format("Failed to read PEM file '~ts': ~ts",
[Path, pkix:format_error(Why)]); [Path, pkix:format_error(Why)]);
format_error({bad_cert, Why, Path}) -> format_error({bad_cert, Why, Path}) ->
format_error({bad_pem, Why, Path}); format_error({bad_pem, Why, Path});
format_error({bad_jwt_key, Path}) -> format_error({bad_jwt_key, Path}) ->
format("No valid JWT key found in file: ~s", [Path]); format("No valid JWT key found in file: ~ts", [Path]);
format_error({bad_jid, Bad}) -> format_error({bad_jid, Bad}) ->
format("Invalid XMPP address: ~s", [Bad]); format("Invalid XMPP address: ~ts", [Bad]);
format_error({bad_user, Bad}) -> format_error({bad_user, Bad}) ->
format("Invalid user part: ~s", [Bad]); format("Invalid user part: ~ts", [Bad]);
format_error({bad_domain, Bad}) -> format_error({bad_domain, Bad}) ->
format("Invalid domain: ~s", [Bad]); format("Invalid domain: ~ts", [Bad]);
format_error({bad_resource, Bad}) -> format_error({bad_resource, Bad}) ->
format("Invalid resource part: ~s", [Bad]); format("Invalid resource part: ~ts", [Bad]);
format_error({bad_ldap_filter, Bad}) -> format_error({bad_ldap_filter, Bad}) ->
format("Invalid LDAP filter: ~s", [Bad]); format("Invalid LDAP filter: ~ts", [Bad]);
format_error({bad_sip_uri, Bad}) -> format_error({bad_sip_uri, Bad}) ->
format("Invalid SIP URI: ~s", [Bad]); format("Invalid SIP URI: ~ts", [Bad]);
format_error({route_conflict, R}) -> format_error({route_conflict, R}) ->
format("Failed to reuse route '~s' because it's " format("Failed to reuse route '~ts' because it's "
"already registered on a virtual host", "already registered on a virtual host",
[R]); [R]);
format_error({listener_dup, AddrPort}) -> format_error({listener_dup, AddrPort}) ->
format("Overlapping listeners found at ~s", format("Overlapping listeners found at ~ts",
[format_addr_port(AddrPort)]); [format_addr_port(AddrPort)]);
format_error({listener_conflict, AddrPort1, AddrPort2}) -> format_error({listener_conflict, AddrPort1, AddrPort2}) ->
format("Overlapping listeners found at ~s and ~s", format("Overlapping listeners found at ~ts and ~ts",
[format_addr_port(AddrPort1), [format_addr_port(AddrPort1),
format_addr_port(AddrPort2)]); format_addr_port(AddrPort2)]);
format_error({invalid_syntax, Reason}) -> format_error({invalid_syntax, Reason}) ->
format("~s", [Reason]); format("~ts", [Reason]);
format_error({missing_module_dep, Mod, DepMod}) -> format_error({missing_module_dep, Mod, DepMod}) ->
format("module ~s depends on module ~s, " format("module ~ts depends on module ~ts, "
"which is not found in the config", "which is not found in the config",
[Mod, DepMod]); [Mod, DepMod]);
format_error(eimp_error) -> format_error(eimp_error) ->

View File

@ -87,8 +87,8 @@ start_app([App|Apps], Type, StartFlag) ->
case lists:member(DepApp, [App|Apps]) of case lists:member(DepApp, [App|Apps]) of
true -> true ->
Reason = io_lib:format( Reason = io_lib:format(
"Failed to start Erlang application '~s': " "Failed to start Erlang application '~ts': "
"circular dependency with '~s' detected", "circular dependency with '~ts' detected",
[App, DepApp]), [App, DepApp]),
exit_or_halt(Reason, StartFlag); exit_or_halt(Reason, StartFlag);
false -> false ->
@ -96,7 +96,7 @@ start_app([App|Apps], Type, StartFlag) ->
end; end;
{error, Why} -> {error, Why} ->
Reason = io_lib:format( Reason = io_lib:format(
"Failed to start Erlang application '~s': ~s. ~s", "Failed to start Erlang application '~ts': ~ts. ~ts",
[App, format_error(Why), hint()]), [App, format_error(Why), hint()]),
exit_or_halt(Reason, StartFlag) exit_or_halt(Reason, StartFlag)
end; end;
@ -112,8 +112,8 @@ check_app_modules(App, StartFlag) ->
non_existing -> non_existing ->
File = get_module_file(App, Mod), File = get_module_file(App, Mod),
Reason = io_lib:format( Reason = io_lib:format(
"Couldn't find file ~s needed " "Couldn't find file ~ts needed "
"for Erlang application '~s'. ~s", "for Erlang application '~ts'. ~ts",
[File, App, hint()]), [File, App, hint()]),
exit_or_halt(Reason, StartFlag); exit_or_halt(Reason, StartFlag);
_ -> _ ->
@ -131,7 +131,7 @@ check_apps() ->
Apps = [ejabberd | Apps = [ejabberd |
[App || {App, _, _} <- application:which_applications(), [App || {App, _, _} <- application:which_applications(),
App /= ejabberd]], App /= ejabberd]],
?DEBUG("Checking consistency of applications: ~s", ?DEBUG("Checking consistency of applications: ~ts",
[misc:join_atoms(Apps, <<", ">>)]), [misc:join_atoms(Apps, <<", ">>)]),
misc:peach( misc:peach(
fun(App) -> fun(App) ->

View File

@ -106,7 +106,7 @@ handle_call({can_access, Cmd, CallerInfo}, _From, State) ->
case matches_definition(Def, Cmd, CallerModule, Tag, Host, CallerInfo) of case matches_definition(Def, Cmd, CallerModule, Tag, Host, CallerInfo) of
true -> true ->
?DEBUG("Command '~p' execution allowed by rule " ?DEBUG("Command '~p' execution allowed by rule "
"'~s' (CallerInfo=~p)", [Cmd, Name, CallerInfo]), "'~ts' (CallerInfo=~p)", [Cmd, Name, CallerInfo]),
allow; allow;
_ -> _ ->
none none

View File

@ -63,7 +63,7 @@ register_certfiles() ->
-spec process([binary()], _) -> {integer(), [{binary(), binary()}], binary()}. -spec process([binary()], _) -> {integer(), [{binary(), binary()}], binary()}.
process([Token], _) -> process([Token], _) ->
?DEBUG("Received ACME challenge request for token: ~s", [Token]), ?DEBUG("Received ACME challenge request for token: ~ts", [Token]),
try ets:lookup_element(acme_challenge, Token, 2) of try ets:lookup_element(acme_challenge, Token, 2) of
Key -> {200, [{<<"Content-Type">>, Key -> {200, [{<<"Content-Type">>,
<<"application/octet-stream">>}], <<"application/octet-stream">>}],
@ -112,7 +112,7 @@ init([]) ->
{ok, #state{}}. {ok, #state{}}.
handle_call({request, [_|_] = Domains}, _From, State) -> handle_call({request, [_|_] = Domains}, _From, State) ->
?INFO_MSG("Requesting new certificate for ~ts from ~s", ?INFO_MSG("Requesting new certificate for ~ts from ~ts",
[misc:format_hosts_list(Domains), directory_url()]), [misc:format_hosts_list(Domains), directory_url()]),
{Ret, State1} = issue_request(State, Domains), {Ret, State1} = issue_request(State, Domains),
{reply, Ret, State1}; {reply, Ret, State1};
@ -127,7 +127,7 @@ handle_call(Request, From, State) ->
handle_cast(ejabberd_started, State) -> handle_cast(ejabberd_started, State) ->
case request_on_start() of case request_on_start() of
{true, Domains} -> {true, Domains} ->
?INFO_MSG("Requesting new certificate for ~ts from ~s", ?INFO_MSG("Requesting new certificate for ~ts from ~ts",
[misc:format_hosts_list(Domains), directory_url()]), [misc:format_hosts_list(Domains), directory_url()]),
{_, State1} = issue_request(State, Domains), {_, State1} = issue_request(State, Domains),
{noreply, State1}; {noreply, State1};
@ -135,7 +135,7 @@ handle_cast(ejabberd_started, State) ->
{noreply, State} {noreply, State}
end; end;
handle_cast({request, [_|_] = Domains}, State) -> handle_cast({request, [_|_] = Domains}, State) ->
?INFO_MSG("Requesting renewal of certificate for ~ts from ~s", ?INFO_MSG("Requesting renewal of certificate for ~ts from ~ts",
[misc:format_hosts_list(Domains), directory_url()]), [misc:format_hosts_list(Domains), directory_url()]),
{_, State1} = issue_request(State, Domains), {_, State1} = issue_request(State, Domains),
{noreply, State1}; {noreply, State1};
@ -321,12 +321,12 @@ read_account_key() ->
{error, enoent} -> {error, enoent} ->
create_account_key(); create_account_key();
{error, {bad_cert, _, _} = Reason} -> {error, {bad_cert, _, _} = Reason} ->
?WARNING_MSG("ACME account key from '~ts' is corrupted: ~s. " ?WARNING_MSG("ACME account key from '~ts' is corrupted: ~ts. "
"Trying to create a new one...", "Trying to create a new one...",
[Path, pkix:format_error(Reason)]), [Path, pkix:format_error(Reason)]),
create_account_key(); create_account_key();
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Failed to read ACME account from ~ts: ~s. " ?ERROR_MSG("Failed to read ACME account from ~ts: ~ts. "
"Try to fix permissions or delete the file completely", "Try to fix permissions or delete the file completely",
[Path, pkix:format_error(Reason)]), [Path, pkix:format_error(Reason)]),
{error, {file, Reason}} {error, {file, Reason}}
@ -399,11 +399,11 @@ write_file(Path, Data) ->
case file:change_mode(Path, 8#600) of case file:change_mode(Path, 8#600) of
ok -> ok; ok -> ok;
{error, Why} -> {error, Why} ->
?WARNING_MSG("Failed to change permissions of ~ts: ~s", ?WARNING_MSG("Failed to change permissions of ~ts: ~ts",
[Path, file:format_error(Why)]) [Path, file:format_error(Why)])
end; end;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("Failed to write file ~ts: ~s", ?ERROR_MSG("Failed to write file ~ts: ~ts",
[Path, file:format_error(Why)]), [Path, file:format_error(Why)]),
Err Err
end; end;
@ -416,7 +416,7 @@ delete_file(Path) ->
case file:delete(Path) of case file:delete(Path) of
ok -> ok; ok -> ok;
{error, Why} = Err -> {error, Why} = Err ->
?WARNING_MSG("Failed to delete file ~ts: ~s", ?WARNING_MSG("Failed to delete file ~ts: ~ts",
[Path, file:format_error(Why)]), [Path, file:format_error(Why)]),
Err Err
end. end.
@ -426,7 +426,7 @@ ensure_dir(Path) ->
case filelib:ensure_dir(Path) of case filelib:ensure_dir(Path) of
ok -> ok; ok -> ok;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("Failed to create directory ~ts: ~s", ?ERROR_MSG("Failed to create directory ~ts: ~ts",
[filename:dirname(Path), [filename:dirname(Path),
file:format_error(Why)]), file:format_error(Why)]),
Err Err

View File

@ -405,7 +405,7 @@ status() ->
false -> false ->
{ejabberd_not_running, "ejabberd is not running in that node."}; {ejabberd_not_running, "ejabberd is not running in that node."};
{value, {_, _, Version}} -> {value, {_, _, Version}} ->
{ok, io_lib:format("ejabberd ~s is running in that node", [Version])} {ok, io_lib:format("ejabberd ~ts is running in that node", [Version])}
end, end,
{Is_running, String1 ++ String2}. {Is_running, String1 ++ String2}.
@ -449,7 +449,7 @@ stop_kindly(DelaySeconds, AnnouncementTextString) ->
SecondsDiff = SecondsDiff =
calendar:datetime_to_gregorian_seconds({date(), time()}) calendar:datetime_to_gregorian_seconds({date(), time()})
- TimestampStart, - TimestampStart,
io:format("[~p/~p ~ps] ~s... ", io:format("[~p/~p ~ps] ~ts... ",
[NumberThis, NumberLast, SecondsDiff, Desc]), [NumberThis, NumberLast, SecondsDiff, Desc]),
Result = (catch apply(Mod, Func, Args)), Result = (catch apply(Mod, Func, Args)),
io:format("~p~n", [Result]), io:format("~p~n", [Result]),
@ -460,7 +460,7 @@ stop_kindly(DelaySeconds, AnnouncementTextString) ->
ok. ok.
send_service_message_all_mucs(Subject, AnnouncementText) -> send_service_message_all_mucs(Subject, AnnouncementText) ->
Message = str:format("~s~n~s", [Subject, AnnouncementText]), Message = str:format("~ts~n~ts", [Subject, AnnouncementText]),
lists:foreach( lists:foreach(
fun(ServerHost) -> fun(ServerHost) ->
MUCHosts = gen_mod:get_module_opt_hosts(ServerHost, mod_muc), MUCHosts = gen_mod:get_module_opt_hosts(ServerHost, mod_muc),
@ -504,12 +504,12 @@ register(User, Host, Password) ->
true -> true ->
case ejabberd_auth:try_register(User, Host, Password) of case ejabberd_auth:try_register(User, Host, Password) of
ok -> ok ->
{ok, io_lib:format("User ~s@~s successfully registered", [User, Host])}; {ok, io_lib:format("User ~ts@~ts successfully registered", [User, Host])};
{error, exists} -> {error, exists} ->
Msg = io_lib:format("User ~s@~s already registered", [User, Host]), Msg = io_lib:format("User ~ts@~ts already registered", [User, Host]),
{error, conflict, 10090, Msg}; {error, conflict, 10090, Msg};
{error, Reason} -> {error, Reason} ->
String = io_lib:format("Can't register user ~s@~s at node ~p: ~s", String = io_lib:format("Can't register user ~ts@~ts at node ~p: ~ts",
[User, Host, node(), [User, Host, node(),
mod_register:format_error(Reason)]), mod_register:format_error(Reason)]),
{error, cannot_register, 10001, String} {error, cannot_register, 10001, String}

View File

@ -59,7 +59,7 @@ start(normal, _Args) ->
ejabberd_hooks:run(ejabberd_started, []), ejabberd_hooks:run(ejabberd_started, []),
ejabberd:check_apps(), ejabberd:check_apps(),
{T2, _} = statistics(wall_clock), {T2, _} = statistics(wall_clock),
?INFO_MSG("ejabberd ~s is started in the node ~p in ~.2fs", ?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs",
[ejabberd_option:version(), [ejabberd_option:version(),
node(), (T2-T1)/1000]), node(), (T2-T1)/1000]),
{ok, SupPid}; {ok, SupPid};
@ -68,7 +68,7 @@ start(normal, _Args) ->
ejabberd:halt() ejabberd:halt()
end; end;
Err -> Err ->
?CRITICAL_MSG("Failed to start ejabberd application: ~s", ?CRITICAL_MSG("Failed to start ejabberd application: ~ts",
[ejabberd_config:format_error(Err)]), [ejabberd_config:format_error(Err)]),
ejabberd:halt() ejabberd:halt()
end end
@ -106,7 +106,7 @@ prep_stop(State) ->
%% All the processes were killed when this function is called %% All the processes were killed when this function is called
stop(_State) -> stop(_State) ->
?INFO_MSG("ejabberd ~s is stopped in the node ~p", ?INFO_MSG("ejabberd ~ts is stopped in the node ~p",
[ejabberd_option:version(), node()]), [ejabberd_option:version(), node()]),
delete_pid_file(). delete_pid_file().
@ -139,11 +139,11 @@ write_pid_file() ->
end. end.
write_pid_file(Pid, PidFilename) -> write_pid_file(Pid, PidFilename) ->
case file:write_file(PidFilename, io_lib:format("~s~n", [Pid])) of case file:write_file(PidFilename, io_lib:format("~ts~n", [Pid])) of
ok -> ok ->
ok; ok;
{error, Reason} = Err -> {error, Reason} = Err ->
?CRITICAL_MSG("Cannot write PID file ~s: ~s", ?CRITICAL_MSG("Cannot write PID file ~ts: ~ts",
[PidFilename, file:format_error(Reason)]), [PidFilename, file:format_error(Reason)]),
throw({?MODULE, Err}) throw({?MODULE, Err})
end. end.

View File

@ -101,5 +101,5 @@ check_password_extauth(User, _AuthzId, Server, Password) ->
-spec failure(binary(), binary(), atom(), any()) -> {nocache, {error, db_failure}}. -spec failure(binary(), binary(), atom(), any()) -> {nocache, {error, db_failure}}.
failure(User, Server, Fun, Reason) -> failure(User, Server, Fun, Reason) ->
?ERROR_MSG("External authentication program failed when calling " ?ERROR_MSG("External authentication program failed when calling "
"'~s' for ~s@~s: ~p", [Fun, User, Server, Reason]), "'~ts' for ~ts@~ts: ~p", [Fun, User, Server, Reason]),
{nocache, {error, db_failure}}. {nocache, {error, db_failure}}.

View File

@ -43,7 +43,7 @@
start(Host) -> start(Host) ->
case ejabberd_option:jwt_key(Host) of case ejabberd_option:jwt_key(Host) of
undefined -> undefined ->
?ERROR_MSG("Option jwt_key is not configured for ~s: " ?ERROR_MSG("Option jwt_key is not configured for ~ts: "
"JWT authentication won't work", [Host]); "JWT authentication won't work", [Host]);
_ -> _ ->
ok ok

View File

@ -251,7 +251,7 @@ transform(#passwd{us = {U, S}, password = Password} = P)
scram -> scram ->
case jid:resourceprep(Password) of case jid:resourceprep(Password) of
error -> error ->
?ERROR_MSG("SASLprep failed for password of user ~s@~s", ?ERROR_MSG("SASLprep failed for password of user ~ts@~ts",
[U, S]), [U, S]),
P; P;
_ -> _ ->

View File

@ -293,7 +293,7 @@ convert_to_scram(Server) ->
error -> error ->
?ERROR_MSG( ?ERROR_MSG(
"SASLprep failed for " "SASLprep failed for "
"password of user ~s@~s", "password of user ~ts@~ts",
[LUser, LServer]); [LUser, LServer]);
_ -> _ ->
Scram = ejabberd_auth:password_to_scram(Password), Scram = ejabberd_auth:password_to_scram(Password),

View File

@ -518,7 +518,7 @@ handle_event({change_shaper, Shaper}, StateName,
State) -> State) ->
{next_state, StateName, State#state{shaper_state = Shaper}}; {next_state, StateName, State#state{shaper_state = Shaper}};
handle_event(_Event, StateName, State) -> handle_event(_Event, StateName, State) ->
?ERROR_MSG("Unexpected event in '~s': ~p", ?ERROR_MSG("Unexpected event in '~ts': ~p",
[StateName, _Event]), [StateName, _Event]),
{next_state, StateName, State}. {next_state, StateName, State}.
@ -558,7 +558,7 @@ handle_sync_event(deactivate_socket, _From, StateName,
{reply, ok, StateName, {reply, ok, StateName,
StateData#state{c2s_pid = undefined}}; StateData#state{c2s_pid = undefined}};
handle_sync_event(_Event, _From, StateName, State) -> handle_sync_event(_Event, _From, StateName, State) ->
?ERROR_MSG("Unexpected sync event in '~s': ~p", ?ERROR_MSG("Unexpected sync event in '~ts': ~p",
[StateName, _Event]), [StateName, _Event]),
{reply, {error, badarg}, StateName, State}. {reply, {error, badarg}, StateName, State}.

View File

@ -268,7 +268,7 @@ reject_unauthenticated_packet(State, _Pkt) ->
process_auth_result(#{sasl_mech := Mech, auth_module := AuthModule, process_auth_result(#{sasl_mech := Mech, auth_module := AuthModule,
socket := Socket, ip := IP, lserver := LServer} = State, socket := Socket, ip := IP, lserver := LServer} = State,
true, User) -> true, User) ->
?INFO_MSG("(~s) Accepted c2s ~s authentication for ~s@~s by ~s backend from ~s", ?INFO_MSG("(~ts) Accepted c2s ~ts authentication for ~ts@~ts by ~ts backend from ~ts",
[xmpp_socket:pp(Socket), Mech, User, LServer, [xmpp_socket:pp(Socket), Mech, User, LServer,
ejabberd_auth:backend_type(AuthModule), ejabberd_auth:backend_type(AuthModule),
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
@ -276,7 +276,7 @@ process_auth_result(#{sasl_mech := Mech, auth_module := AuthModule,
process_auth_result(#{sasl_mech := Mech, process_auth_result(#{sasl_mech := Mech,
socket := Socket, ip := IP, lserver := LServer} = State, socket := Socket, ip := IP, lserver := LServer} = State,
{false, Reason}, User) -> {false, Reason}, User) ->
?WARNING_MSG("(~s) Failed c2s ~s authentication ~sfrom ~s: ~s", ?WARNING_MSG("(~ts) Failed c2s ~ts authentication ~tsfrom ~ts: ~ts",
[xmpp_socket:pp(Socket), Mech, [xmpp_socket:pp(Socket), Mech,
if User /= <<"">> -> ["for ", User, "@", LServer, " "]; if User /= <<"">> -> ["for ", User, "@", LServer, " "];
true -> "" true -> ""
@ -291,7 +291,7 @@ process_terminated(#{sid := SID, socket := Socket,
jid := JID, user := U, server := S, resource := R} = State, jid := JID, user := U, server := S, resource := R} = State,
Reason) -> Reason) ->
Status = format_reason(State, Reason), Status = format_reason(State, Reason),
?INFO_MSG("(~s) Closing c2s session for ~s: ~s", ?INFO_MSG("(~ts) Closing c2s session for ~ts: ~ts",
[xmpp_socket:pp(Socket), jid:encode(JID), Status]), [xmpp_socket:pp(Socket), jid:encode(JID), Status]),
State1 = case maps:is_key(pres_last, State) of State1 = case maps:is_key(pres_last, State) of
true -> true ->
@ -309,7 +309,7 @@ process_terminated(#{sid := SID, socket := Socket,
State1; State1;
process_terminated(#{socket := Socket, process_terminated(#{socket := Socket,
stop_reason := {tls, _}} = State, Reason) -> stop_reason := {tls, _}} = State, Reason) ->
?WARNING_MSG("(~s) Failed to secure c2s connection: ~s", ?WARNING_MSG("(~ts) Failed to secure c2s connection: ~ts",
[xmpp_socket:pp(Socket), format_reason(State, Reason)]), [xmpp_socket:pp(Socket), format_reason(State, Reason)]),
State; State;
process_terminated(State, _Reason) -> process_terminated(State, _Reason) ->
@ -431,12 +431,12 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
sid => ejabberd_sm:make_sid()}), sid => ejabberd_sm:make_sid()}),
State2 = ejabberd_hooks:run_fold( State2 = ejabberd_hooks:run_fold(
c2s_session_opened, LServer, State1, []), c2s_session_opened, LServer, State1, []),
?INFO_MSG("(~s) Opened c2s session for ~s", ?INFO_MSG("(~ts) Opened c2s session for ~ts",
[xmpp_socket:pp(Socket), jid:encode(JID)]), [xmpp_socket:pp(Socket), jid:encode(JID)]),
{ok, State2}; {ok, State2};
deny -> deny ->
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]), ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
?WARNING_MSG("(~s) Forbidden c2s session for ~s", ?WARNING_MSG("(~ts) Forbidden c2s session for ~ts",
[xmpp_socket:pp(Socket), jid:encode(JID)]), [xmpp_socket:pp(Socket), jid:encode(JID)]),
Txt = ?T("Access denied by service policy"), Txt = ?T("Access denied by service policy"),
{error, xmpp:err_not_allowed(Txt, Lang), State} {error, xmpp:err_not_allowed(Txt, Lang), State}
@ -894,7 +894,7 @@ bounce_message_queue({_, Pid} = SID, JID) ->
SIDs = ejabberd_sm:get_session_sids(U, S, R), SIDs = ejabberd_sm:get_session_sids(U, S, R),
case lists:member(SID, SIDs) of case lists:member(SID, SIDs) of
true -> true ->
?WARNING_MSG("The session for ~s@~s/~s is supposed to " ?WARNING_MSG("The session for ~ts@~ts/~ts is supposed to "
"be unregistered, but session identifier ~p " "be unregistered, but session identifier ~p "
"still presents in the 'session' table", "still presents in the 'session' table",
[U, S, R, Pid]); [U, S, R, Pid]);

View File

@ -94,8 +94,8 @@ create_captcha(SID, From, To, Lang, Limiter, Args) ->
Lang, [challenge]), Lang, [challenge]),
X = #xdata{type = form, fields = Fs}, X = #xdata{type = form, fields = Fs},
Captcha = #xcaptcha{xdata = X}, Captcha = #xcaptcha{xdata = X},
BodyString = {?T("Your subscription request and/or messages to ~s have been blocked. " BodyString = {?T("Your subscription request and/or messages to ~ts have been blocked. "
"To unblock your subscription request, visit ~s"), [JID, get_url(Id)]}, "To unblock your subscription request, visit ~ts"), [JID, get_url(Id)]},
Body = xmpp:mk_text(BodyString, Lang), Body = xmpp:mk_text(BodyString, Lang),
OOB = #oob_x{url = get_url(Id)}, OOB = #oob_x{url = get_url(Id)},
Hint = #hint{type = 'no-store'}, Hint = #hint{type = 'no-store'},
@ -197,7 +197,7 @@ process_reply(#xdata{} = X) ->
captcha_not_found -> {error, not_found} captcha_not_found -> {error, not_found}
end end
catch _:{captcha_form, Why} -> catch _:{captcha_form, Why} ->
?WARNING_MSG("Malformed CAPTCHA form: ~s", ?WARNING_MSG("Malformed CAPTCHA form: ~ts",
[captcha_form:format_error(Why)]), [captcha_form:format_error(Why)]),
{error, malformed} {error, malformed}
end; end;
@ -392,7 +392,7 @@ create_image(Limiter, Key) ->
{error, image_error()}. {error, image_error()}.
do_create_image(Key) -> do_create_image(Key) ->
FileName = get_prog_name(), FileName = get_prog_name(),
Cmd = lists:flatten(io_lib:format("~s ~s", [FileName, Key])), Cmd = lists:flatten(io_lib:format("~ts ~ts", [FileName, Key])),
case cmd(Cmd) of case cmd(Cmd) of
{ok, {ok,
<<137, $P, $N, $G, $\r, $\n, 26, $\n, _/binary>> = <<137, $P, $N, $G, $\r, $\n, 26, $\n, _/binary>> =
@ -404,18 +404,18 @@ do_create_image(Key) ->
when X == $7; X == $9 -> when X == $7; X == $9 ->
{ok, <<"image/gif">>, Key, Img}; {ok, <<"image/gif">>, Key, Img};
{error, enodata = Reason} -> {error, enodata = Reason} ->
?ERROR_MSG("Failed to process output from \"~s\". " ?ERROR_MSG("Failed to process output from \"~ts\". "
"Maybe ImageMagick's Convert program " "Maybe ImageMagick's Convert program "
"is not installed.", "is not installed.",
[Cmd]), [Cmd]),
{error, Reason}; {error, Reason};
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Failed to process an output from \"~s\": ~p", ?ERROR_MSG("Failed to process an output from \"~ts\": ~p",
[Cmd, Reason]), [Cmd, Reason]),
{error, Reason}; {error, Reason};
_ -> _ ->
Reason = malformed_image, Reason = malformed_image,
?ERROR_MSG("Failed to process an output from \"~s\": ~p", ?ERROR_MSG("Failed to process an output from \"~ts\": ~p",
[Cmd, Reason]), [Cmd, Reason]),
{error, Reason} {error, Reason}
end. end.

View File

@ -201,10 +201,10 @@ handle_cast(Msg, State) ->
{noreply, State}. {noreply, State}.
handle_info({node_up, Node}, State) -> handle_info({node_up, Node}, State) ->
?INFO_MSG("Node ~s has joined", [Node]), ?INFO_MSG("Node ~ts has joined", [Node]),
{noreply, State}; {noreply, State};
handle_info({node_down, Node}, State) -> handle_info({node_down, Node}, State) ->
?INFO_MSG("Node ~s has left", [Node]), ?INFO_MSG("Node ~ts has left", [Node]),
{noreply, State}; {noreply, State};
handle_info(Info, State) -> handle_info(Info, State) ->
?WARNING_MSG("Unexpected info: ~p", [Info]), ?WARNING_MSG("Unexpected info: ~p", [Info]),

View File

@ -337,14 +337,14 @@ gen_calls(#ejabberd_commands{args_example=Values, args=ArgsDesc,
end. end.
format_type({list, {_, {tuple, Els}}}) -> format_type({list, {_, {tuple, Els}}}) ->
io_lib:format("[~s]", [format_type({tuple, Els})]); io_lib:format("[~ts]", [format_type({tuple, Els})]);
format_type({list, El}) -> format_type({list, El}) ->
io_lib:format("[~s]", [format_type(El)]); io_lib:format("[~ts]", [format_type(El)]);
format_type({tuple, Els}) -> format_type({tuple, Els}) ->
Args = [format_type(El) || El <- Els], Args = [format_type(El) || El <- Els],
io_lib:format("{~s}", [string:join(Args, ", ")]); io_lib:format("{~ts}", [string:join(Args, ", ")]);
format_type({Name, Type}) -> format_type({Name, Type}) ->
io_lib:format("~s::~s", [Name, format_type(Type)]); io_lib:format("~ts::~ts", [Name, format_type(Type)]);
format_type(binary) -> format_type(binary) ->
"string"; "string";
format_type(atom) -> format_type(atom) ->
@ -437,7 +437,7 @@ generate_html_output(File, RegExp, Languages) ->
Langs = binary:split(Languages, <<",">>, [global]), Langs = binary:split(Languages, <<",">>, [global]),
Out = lists:map(fun(C) -> gen_doc(C, true, Langs) end, Cmds4), Out = lists:map(fun(C) -> gen_doc(C, true, Langs) end, Cmds4),
{ok, Fh} = file:open(File, [write]), {ok, Fh} = file:open(File, [write]),
io:format(Fh, "~s", [[html_pre(), Out, html_post()]]), io:format(Fh, "~ts", [[html_pre(), Out, html_post()]]),
file:close(Fh), file:close(Fh),
ok. ok.
@ -463,7 +463,7 @@ generate_md_output(File, RegExp, Languages) ->
"// Autogenerated with 'ejabberdctl gen_markdown_doc_for_commands'\n---">>, "// Autogenerated with 'ejabberdctl gen_markdown_doc_for_commands'\n---">>,
Out = lists:map(fun(C) -> gen_doc(C, false, Langs) end, Cmds4), Out = lists:map(fun(C) -> gen_doc(C, false, Langs) end, Cmds4),
{ok, Fh} = file:open(File, [write]), {ok, Fh} = file:open(File, [write]),
io:format(Fh, "~s~s", [Header, Out]), io:format(Fh, "~ts~ts", [Header, Out]),
file:close(Fh), file:close(Fh),
ok. ok.

View File

@ -77,7 +77,7 @@ load() ->
load(Path) -> load(Path) ->
ConfigFile = unicode:characters_to_binary(Path), ConfigFile = unicode:characters_to_binary(Path),
UnixTime = erlang:monotonic_time(second), UnixTime = erlang:monotonic_time(second),
?INFO_MSG("Loading configuration from ~s", [ConfigFile]), ?INFO_MSG("Loading configuration from ~ts", [ConfigFile]),
_ = ets:new(ejabberd_options, _ = ets:new(ejabberd_options,
[named_table, public, {read_concurrency, true}]), [named_table, public, {read_concurrency, true}]),
case load_file(ConfigFile) of case load_file(ConfigFile) of
@ -92,7 +92,7 @@ load(Path) ->
-spec reload() -> ok | error_return(). -spec reload() -> ok | error_return().
reload() -> reload() ->
ConfigFile = path(), ConfigFile = path(),
?INFO_MSG("Reloading configuration from ~s", [ConfigFile]), ?INFO_MSG("Reloading configuration from ~ts", [ConfigFile]),
OldHosts = get_myhosts(), OldHosts = get_myhosts(),
case load_file(ConfigFile) of case load_file(ConfigFile) of
ok -> ok ->
@ -111,7 +111,7 @@ reload() ->
delete_host_options(DelHosts), delete_host_options(DelHosts),
?INFO_MSG("Configuration reloaded successfully", []); ?INFO_MSG("Configuration reloaded successfully", []);
Err -> Err ->
?ERROR_MSG("Configuration reload aborted: ~s", ?ERROR_MSG("Configuration reload aborted: ~ts",
[format_error(Err)]), [format_error(Err)]),
Err Err
end. end.
@ -130,7 +130,7 @@ dump(Y, Output) ->
Data = fast_yaml:encode(Y), Data = fast_yaml:encode(Y),
case Output of case Output of
stdout -> stdout ->
io:format("~s~n", [Data]); io:format("~ts~n", [Data]);
FileName -> FileName ->
try try
ok = filelib:ensure_dir(FileName), ok = filelib:ensure_dir(FileName),
@ -158,9 +158,9 @@ get_option({O, Host} = Opt) ->
catch ?EX_RULE(error, badarg, St) when Host /= global -> catch ?EX_RULE(error, badarg, St) when Host /= global ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
Val = get_option({O, global}), Val = get_option({O, global}),
?WARNING_MSG("Option '~s' is not defined for virtual host '~s'. " ?WARNING_MSG("Option '~ts' is not defined for virtual host '~ts'. "
"This is a bug, please report it with the following " "This is a bug, please report it with the following "
"stacktrace included:~n** ~s", "stacktrace included:~n** ~ts",
[O, Host, misc:format_exception(2, error, badarg, StackTrace)]), [O, Host, misc:format_exception(2, error, badarg, StackTrace)]),
Val Val
end. end.
@ -271,9 +271,9 @@ default_db(Opt, Host, Mod, Default) ->
case code:ensure_loaded(DBMod) of case code:ensure_loaded(DBMod) of
{module, _} -> Type; {module, _} -> Type;
{error, _} -> {error, _} ->
?WARNING_MSG("Module ~s doesn't support database '~s' " ?WARNING_MSG("Module ~ts doesn't support database '~ts' "
"defined in option '~s', using " "defined in option '~ts', using "
"'~s' as fallback", [Mod, Type, Opt, Default]), "'~ts' as fallback", [Mod, Type, Opt, Default]),
Default Default
end. end.
@ -355,15 +355,15 @@ format_error({error, Reason, Ctx}) ->
format_error({error, {merge_conflict, Opt, Host}}) -> format_error({error, {merge_conflict, Opt, Host}}) ->
lists:flatten( lists:flatten(
io_lib:format( io_lib:format(
"Cannot merge value of option '~s' defined in append_host_config " "Cannot merge value of option '~ts' defined in append_host_config "
"for virtual host ~s: only options of type list or map are allowed " "for virtual host ~ts: only options of type list or map are allowed "
"in append_host_config. Hint: specify the option in host_config", "in append_host_config. Hint: specify the option in host_config",
[Opt, Host])); [Opt, Host]));
format_error({error, {old_config, Path, Reason}}) -> format_error({error, {old_config, Path, Reason}}) ->
lists:flatten( lists:flatten(
io_lib:format( io_lib:format(
"Failed to read configuration from '~s': ~s~s", "Failed to read configuration from '~ts': ~ts~ts",
[unicode:characters_to_binary(Path), [Path,
case Reason of case Reason of
{_, _, _} -> "at line "; {_, _, _} -> "at line ";
_ -> "" _ -> ""
@ -371,8 +371,8 @@ format_error({error, {old_config, Path, Reason}}) ->
format_error({error, {write_file, Path, Reason}}) -> format_error({error, {write_file, Path, Reason}}) ->
lists:flatten( lists:flatten(
io_lib:format( io_lib:format(
"Failed to write to '~s': ~s", "Failed to write to '~ts': ~ts",
[unicode:characters_to_binary(Path), [Path,
file:format_error(Reason)])); file:format_error(Reason)]));
format_error({error, {exception, Class, Reason, St}}) -> format_error({error, {exception, Class, Reason, St}}) ->
lists:flatten( lists:flatten(
@ -381,7 +381,7 @@ format_error({error, {exception, Class, Reason, St}}) ->
"This is most likely due to faulty/incompatible validator in " "This is most likely due to faulty/incompatible validator in "
"third-party code. If you are not running any third-party " "third-party code. If you are not running any third-party "
"code, please report the bug with ejabberd configuration " "code, please report the bug with ejabberd configuration "
"file attached and the following stacktrace included:~n** ~s", "file attached and the following stacktrace included:~n** ~ts",
[misc:format_exception(2, Class, Reason, St)])). [misc:format_exception(2, Class, Reason, St)])).
%%%=================================================================== %%%===================================================================

View File

@ -31,7 +31,7 @@ map_reduce(Y) ->
Y2 = (validator())(Y1), Y2 = (validator())(Y1),
Y3 = transform(Y2), Y3 = transform(Y2),
if Y2 /= Y3 -> if Y2 /= Y3 ->
?DEBUG("Transformed configuration:~s~n", ?DEBUG("Transformed configuration:~ts~n",
[misc:format_val({yaml, Y3})]); [misc:format_val({yaml, Y3})]);
true -> true ->
ok ok
@ -89,8 +89,8 @@ transform(global, listen, Listeners, Acc) ->
transform(_Host, Opt, CertFile, Acc) when (Opt == domain_certfile) orelse transform(_Host, Opt, CertFile, Acc) when (Opt == domain_certfile) orelse
(Opt == c2s_certfile) orelse (Opt == c2s_certfile) orelse
(Opt == s2s_certfile) -> (Opt == s2s_certfile) ->
?WARNING_MSG("Option '~s' is deprecated and was automatically " ?WARNING_MSG("Option '~ts' is deprecated and was automatically "
"appended to 'certfiles' option. ~s", "appended to 'certfiles' option. ~ts",
[Opt, adjust_hint()]), [Opt, adjust_hint()]),
CertFiles = maps:get(certfiles, Acc, []), CertFiles = maps:get(certfiles, Acc, []),
Acc1 = maps:put(certfiles, CertFiles ++ [CertFile], Acc), Acc1 = maps:put(certfiles, CertFiles ++ [CertFile], Acc),
@ -105,10 +105,10 @@ transform(_Host, acme, ACME, Acc) ->
case http_uri:parse(binary_to_list(URL)) of case http_uri:parse(binary_to_list(URL)) of
{ok, {_, _, "acme-v01.api.letsencrypt.org", _, _, _}} -> {ok, {_, _, "acme-v01.api.letsencrypt.org", _, _, _}} ->
NewURL = ejabberd_acme:default_directory_url(), NewURL = ejabberd_acme:default_directory_url(),
?WARNING_MSG("ACME directory URL ~s defined in " ?WARNING_MSG("ACME directory URL ~ts defined in "
"option acme->ca_url is deprecated " "option acme->ca_url is deprecated "
"and was automatically replaced " "and was automatically replaced "
"with ~s. ~s", "with ~ts. ~ts",
[URL, NewURL, adjust_hint()]), [URL, NewURL, adjust_hint()]),
{ca_url, NewURL}; {ca_url, NewURL};
_ -> _ ->
@ -123,7 +123,7 @@ transform(Host, s2s_use_starttls, required_trusted, Acc) ->
"'s2s_use_starttls' is deprecated and was " "'s2s_use_starttls' is deprecated and was "
"automatically replaced with value 'required'. " "automatically replaced with value 'required'. "
"The module 'mod_s2s_dialback' has also " "The module 'mod_s2s_dialback' has also "
"been automatically removed from the configuration. ~s", "been automatically removed from the configuration. ~ts",
[adjust_hint()]), [adjust_hint()]),
Hosts = maps:get(remove_s2s_dialback, Acc, []), Hosts = maps:get(remove_s2s_dialback, Acc, []),
Acc1 = maps:put(remove_s2s_dialback, [Host|Hosts], Acc), Acc1 = maps:put(remove_s2s_dialback, [Host|Hosts], Acc),
@ -295,7 +295,7 @@ replace_request_handlers(Opts) ->
({http_poll, _}) -> ({http_poll, _}) ->
?WARNING_MSG("Listening option 'http_poll' is " ?WARNING_MSG("Listening option 'http_poll' is "
"ignored: HTTP Polling support was " "ignored: HTTP Polling support was "
"removed in ejabberd 15.04. ~s", "removed in ejabberd 15.04. ~ts",
[adjust_hint()]), [adjust_hint()]),
false; false;
({request_handlers, _}) -> ({request_handlers, _}) ->
@ -332,9 +332,9 @@ collect_listener_certfiles(Opts, Acc) ->
Mod == ejabberd_s2s_in -> Mod == ejabberd_s2s_in ->
case lists:keyfind(certfile, 1, Opts) of case lists:keyfind(certfile, 1, Opts) of
{_, CertFile} -> {_, CertFile} ->
?WARNING_MSG("Listening option 'certfile' of module ~s " ?WARNING_MSG("Listening option 'certfile' of module ~ts "
"is deprecated and was automatically " "is deprecated and was automatically "
"appended to global 'certfiles' option. ~s", "appended to global 'certfiles' option. ~ts",
[Mod, adjust_hint()]), [Mod, adjust_hint()]),
CertFiles = maps:get(certfiles, Acc, []), CertFiles = maps:get(certfiles, Acc, []),
{proplists:delete(certfile, Opts), {proplists:delete(certfile, Opts),
@ -458,10 +458,10 @@ transform_module(_Host, mod_pubsub, Opts, Acc) ->
<<"public">>]) of <<"public">>]) of
true -> true ->
?WARNING_MSG( ?WARNING_MSG(
"Plugin '~s' of mod_pubsub is not " "Plugin '~ts' of mod_pubsub is not "
"supported anymore and has been " "supported anymore and has been "
"automatically removed from 'plugins' " "automatically removed from 'plugins' "
"option. ~s", "option. ~ts",
[Plugin, adjust_hint()]), [Plugin, adjust_hint()]),
false; false;
false -> false ->
@ -501,49 +501,49 @@ set_certfiles(Y, Acc) ->
%%% Warnings %%% Warnings
%%%=================================================================== %%%===================================================================
warn_replaced_module(From, To) -> warn_replaced_module(From, To) ->
?WARNING_MSG("Module ~s is deprecated and was automatically " ?WARNING_MSG("Module ~ts is deprecated and was automatically "
"replaced by ~s. ~s", "replaced by ~ts. ~ts",
[From, To, adjust_hint()]). [From, To, adjust_hint()]).
warn_replaced_module(From, To, Type) -> warn_replaced_module(From, To, Type) ->
?WARNING_MSG("Module ~s is deprecated and was automatically " ?WARNING_MSG("Module ~ts is deprecated and was automatically "
"replaced by ~s with db_type: ~s. ~s", "replaced by ~ts with db_type: ~ts. ~ts",
[From, To, Type, adjust_hint()]). [From, To, Type, adjust_hint()]).
warn_removed_module(Mod) -> warn_removed_module(Mod) ->
?WARNING_MSG("Module ~s is deprecated and was automatically " ?WARNING_MSG("Module ~ts is deprecated and was automatically "
"removed from the configuration. ~s", [Mod, adjust_hint()]). "removed from the configuration. ~ts", [Mod, adjust_hint()]).
warn_replaced_handler(Opt, {Path, Module}) -> warn_replaced_handler(Opt, {Path, Module}) ->
?WARNING_MSG("Listening option '~s' is deprecated " ?WARNING_MSG("Listening option '~ts' is deprecated "
"and was automatically replaced by " "and was automatically replaced by "
"HTTP request handler: \"~s\" -> ~s. ~s", "HTTP request handler: \"~ts\" -> ~ts. ~ts",
[Opt, Path, Module, adjust_hint()]). [Opt, Path, Module, adjust_hint()]).
warn_deprecated_option(OldOpt, NewOpt) -> warn_deprecated_option(OldOpt, NewOpt) ->
?WARNING_MSG("Option '~s' is deprecated. Use option '~s' instead.", ?WARNING_MSG("Option '~ts' is deprecated. Use option '~ts' instead.",
[OldOpt, NewOpt]). [OldOpt, NewOpt]).
warn_replaced_option(OldOpt, NewOpt) -> warn_replaced_option(OldOpt, NewOpt) ->
?WARNING_MSG("Option '~s' is deprecated and was automatically " ?WARNING_MSG("Option '~ts' is deprecated and was automatically "
"replaced by '~s'. ~s", "replaced by '~ts'. ~ts",
[OldOpt, NewOpt, adjust_hint()]). [OldOpt, NewOpt, adjust_hint()]).
warn_removed_option(Opt) -> warn_removed_option(Opt) ->
?WARNING_MSG("Option '~s' is deprecated and has no effect anymore. " ?WARNING_MSG("Option '~ts' is deprecated and has no effect anymore. "
"Please remove it from the configuration.", [Opt]). "Please remove it from the configuration.", [Opt]).
warn_removed_option(OldOpt, NewOpt) -> warn_removed_option(OldOpt, NewOpt) ->
?WARNING_MSG("Option '~s' is deprecated and has no effect anymore. " ?WARNING_MSG("Option '~ts' is deprecated and has no effect anymore. "
"Use option '~s' instead.", [OldOpt, NewOpt]). "Use option '~ts' instead.", [OldOpt, NewOpt]).
warn_removed_module_option(Opt, Mod) -> warn_removed_module_option(Opt, Mod) ->
?WARNING_MSG("Option '~s' of module ~s is deprecated " ?WARNING_MSG("Option '~ts' of module ~ts is deprecated "
"and has no effect anymore. ~s", "and has no effect anymore. ~ts",
[Opt, Mod, adjust_hint()]). [Opt, Mod, adjust_hint()]).
warn_huge_timeout(Opt, T) when is_integer(T), T >= 1000 -> warn_huge_timeout(Opt, T) when is_integer(T), T >= 1000 ->
?WARNING_MSG("Value '~B' of option '~s' is too big, " ?WARNING_MSG("Value '~B' of option '~ts' is too big, "
"are you sure you have set seconds?", "are you sure you have set seconds?",
[T, Opt]); [T, Opt]);
warn_huge_timeout(_, _) -> warn_huge_timeout(_, _) ->

View File

@ -173,11 +173,11 @@ process(["status"], _Version) ->
false -> false ->
EjabberdLogPath = ejabberd_logger:get_log_path(), EjabberdLogPath = ejabberd_logger:get_log_path(),
print("ejabberd is not running in that node~n" print("ejabberd is not running in that node~n"
"Check for error messages: ~s~n" "Check for error messages: ~ts~n"
"or other files in that directory.~n", [EjabberdLogPath]), "or other files in that directory.~n", [EjabberdLogPath]),
?STATUS_ERROR; ?STATUS_ERROR;
true -> true ->
print("ejabberd ~s is running in that node~n", [ejabberd_option:version()]), print("ejabberd ~ts is running in that node~n", [ejabberd_option:version()]),
?STATUS_SUCCESS ?STATUS_SUCCESS
end; end;
@ -252,7 +252,7 @@ process(Args, Version) ->
case String of case String of
[] -> ok; [] -> ok;
_ -> _ ->
io:format("~s~n", [String]) io:format("~ts~n", [String])
end, end,
Code. Code.
@ -327,14 +327,14 @@ try_call_command(Args, Auth, AccessCommands, Version) ->
KnownCommands = [Cmd || {Cmd, _, _} <- ejabberd_commands:list_commands(Version)], KnownCommands = [Cmd || {Cmd, _, _} <- ejabberd_commands:list_commands(Version)],
UnknownCommand = list_to_atom(hd(Args)), UnknownCommand = list_to_atom(hd(Args)),
{io_lib:format( {io_lib:format(
"Error: unknown command '~s'. Did you mean '~s'?", "Error: unknown command '~ts'. Did you mean '~ts'?",
[hd(Args), misc:best_match(UnknownCommand, KnownCommands)]), [hd(Args), misc:best_match(UnknownCommand, KnownCommands)]),
?STATUS_ERROR}; ?STATUS_ERROR};
throw:Error -> throw:Error ->
{io_lib:format("~p", [Error]), ?STATUS_ERROR}; {io_lib:format("~p", [Error]), ?STATUS_ERROR};
?EX_RULE(A, Why, Stack) -> ?EX_RULE(A, Why, Stack) ->
StackTrace = ?EX_STACK(Stack), StackTrace = ?EX_STACK(Stack),
{io_lib:format("Unhandled exception occurred executing the command:~n** ~s", {io_lib:format("Unhandled exception occurred executing the command:~n** ~ts",
[misc:format_exception(2, A, Why, StackTrace)]), [misc:format_exception(2, A, Why, StackTrace)]),
?STATUS_ERROR} ?STATUS_ERROR}
end. end.
@ -363,7 +363,7 @@ call_command([CmdString | Args], Auth, _AccessCommands, Version) ->
{L1, L2} when L1 < L2 -> {L2-L1, "less argument"}; {L1, L2} when L1 < L2 -> {L2-L1, "less argument"};
{L1, L2} when L1 > L2 -> {L1-L2, "more argument"} {L1, L2} when L1 > L2 -> {L1-L2, "more argument"}
end, end,
{io_lib:format("Error: the command ~p requires ~p ~s.", {io_lib:format("Error: the command ~p requires ~p ~ts.",
[CmdString, NumCompa, TextCompa]), [CmdString, NumCompa, TextCompa]),
wrong_command_arguments} wrong_command_arguments}
end. end.
@ -417,16 +417,16 @@ format_result(Int, {_Name, integer}) ->
io_lib:format("~p", [Int]); io_lib:format("~p", [Int]);
format_result([A|_]=String, {_Name, string}) when is_list(String) and is_integer(A) -> format_result([A|_]=String, {_Name, string}) when is_list(String) and is_integer(A) ->
io_lib:format("~s", [String]); io_lib:format("~ts", [String]);
format_result(Binary, {_Name, string}) when is_binary(Binary) -> format_result(Binary, {_Name, string}) when is_binary(Binary) ->
io_lib:format("~s", [binary_to_list(Binary)]); io_lib:format("~ts", [binary_to_list(Binary)]);
format_result(Atom, {_Name, string}) when is_atom(Atom) -> format_result(Atom, {_Name, string}) when is_atom(Atom) ->
io_lib:format("~s", [atom_to_list(Atom)]); io_lib:format("~ts", [atom_to_list(Atom)]);
format_result(Integer, {_Name, string}) when is_integer(Integer) -> format_result(Integer, {_Name, string}) when is_integer(Integer) ->
io_lib:format("~s", [integer_to_list(Integer)]); io_lib:format("~ts", [integer_to_list(Integer)]);
format_result(Other, {_Name, string}) -> format_result(Other, {_Name, string}) ->
io_lib:format("~p", [Other]); io_lib:format("~p", [Other]);
@ -435,7 +435,7 @@ format_result(Code, {_Name, rescode}) ->
make_status(Code); make_status(Code);
format_result({Code, Text}, {_Name, restuple}) -> format_result({Code, Text}, {_Name, restuple}) ->
{io_lib:format("~s", [Text]), make_status(Code)}; {io_lib:format("~ts", [Text]), make_status(Code)};
%% The result is a list of something: [something()] %% The result is a list of something: [something()]
format_result([], {_Name, {list, _ElementsDef}}) -> format_result([], {_Name, {list, _ElementsDef}}) ->

View File

@ -239,7 +239,7 @@ safe_apply(Hook, Module, Function, Args) ->
Stack = ?EX_STACK(St), Stack = ?EX_STACK(St),
?ERROR_MSG("Hook ~p crashed when running ~p:~p/~p:~n" ++ ?ERROR_MSG("Hook ~p crashed when running ~p:~p/~p:~n" ++
string:join( string:join(
["** ~s"| ["** ~ts"|
["** Arg " ++ integer_to_list(I) ++ " = ~p" ["** Arg " ++ integer_to_list(I) ++ " = ~p"
|| I <- lists:seq(1, length(Args))]], || I <- lists:seq(1, length(Args))]],
"~n"), "~n"),

View File

@ -179,7 +179,7 @@ send_file(State, Fd, Size, FileName) ->
end end
catch _:{case_clause, {error, Why}} -> catch _:{case_clause, {error, Why}} ->
if Why /= closed -> if Why /= closed ->
?WARNING_MSG("Failed to read ~s: ~s", ?WARNING_MSG("Failed to read ~ts: ~ts",
[FileName, file_format_error(Why)]), [FileName, file_format_error(Why)]),
exit(normal); exit(normal);
true -> true ->
@ -530,7 +530,7 @@ analyze_ip_xff({IPLast, Port}, XFF) ->
{ok, IPFirst} = inet_parse:address( {ok, IPFirst} = inet_parse:address(
binary_to_list(ClientIP)), binary_to_list(ClientIP)),
?DEBUG("The IP ~w was replaced with ~w due to " ?DEBUG("The IP ~w was replaced with ~w due to "
"header X-Forwarded-For: ~s", "header X-Forwarded-For: ~ts",
[IPLast, IPFirst, XFF]), [IPLast, IPFirst, XFF]),
IPFirst; IPFirst;
false -> IPLast false -> IPLast
@ -677,12 +677,12 @@ make_file_output(State, Status, Headers, FileName) ->
none; none;
{error, Why} -> {error, Why} ->
Reason = file_format_error(Why), Reason = file_format_error(Why),
?ERROR_MSG("Failed to open ~s: ~s", [FileName, Reason]), ?ERROR_MSG("Failed to open ~ts: ~ts", [FileName, Reason]),
make_text_output(State, 404, Reason, [], <<>>) make_text_output(State, 404, Reason, [], <<>>)
end; end;
{error, Why} -> {error, Why} ->
Reason = file_format_error(Why), Reason = file_format_error(Why),
?ERROR_MSG("Failed to read info of ~s: ~s", [FileName, Reason]), ?ERROR_MSG("Failed to read info of ~ts: ~ts", [FileName, Reason]),
make_text_output(State, 404, Reason, [], <<>>) make_text_output(State, 404, Reason, [], <<>>)
end. end.

View File

@ -176,7 +176,7 @@ callback(undefined, IQRes, Fun) ->
try Fun(IQRes) try Fun(IQRes)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to process iq response:~n~s~n** ~s", ?ERROR_MSG("Failed to process iq response:~n~ts~n** ~ts",
[xmpp:pp(IQRes), [xmpp:pp(IQRes),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end; end;

View File

@ -115,7 +115,7 @@ init({Port, _, udp} = EndPoint, Module, Opts, SockOpts) ->
proc_lib:init_ack({ok, self()}), proc_lib:init_ack({ok, self()}),
case application:ensure_started(ejabberd) of case application:ensure_started(ejabberd) of
ok -> ok ->
?INFO_MSG("Start accepting ~s connections at ~s for ~p", ?INFO_MSG("Start accepting ~ts connections at ~ts for ~p",
[format_transport(udp, Opts), [format_transport(udp, Opts),
format_endpoint({Port1, Addr, udp}), Module]), format_endpoint({Port1, Addr, udp}), Module]),
Opts1 = opts_to_list(Module, Opts), Opts1 = opts_to_list(Module, Opts),
@ -148,7 +148,7 @@ init({Port, _, tcp} = EndPoint, Module, Opts, SockOpts) ->
Sup = start_module_sup(Module, Opts), Sup = start_module_sup(Module, Opts),
Interval = maps:get(accept_interval, Opts), Interval = maps:get(accept_interval, Opts),
Proxy = maps:get(use_proxy_protocol, Opts), Proxy = maps:get(use_proxy_protocol, Opts),
?INFO_MSG("Start accepting ~s connections at ~s for ~p", ?INFO_MSG("Start accepting ~ts connections at ~ts for ~p",
[format_transport(tcp, Opts), [format_transport(tcp, Opts),
format_endpoint({Port1, Addr, tcp}), Module]), format_endpoint({Port1, Addr, tcp}), Module]),
Opts1 = opts_to_list(Module, Opts), Opts1 = opts_to_list(Module, Opts),
@ -223,7 +223,7 @@ accept(ListenSocket, Module, State, Sup, Interval, Proxy, Arity) ->
{ok, Socket} when Proxy -> {ok, Socket} when Proxy ->
case proxy_protocol:decode(gen_tcp, Socket, 10000) of case proxy_protocol:decode(gen_tcp, Socket, 10000) of
{error, Err} -> {error, Err} ->
?ERROR_MSG("(~w) Proxy protocol parsing failed: ~s", ?ERROR_MSG("(~w) Proxy protocol parsing failed: ~ts",
[ListenSocket, format_error(Err)]), [ListenSocket, format_error(Err)]),
gen_tcp:close(Socket); gen_tcp:close(Socket);
{{Addr, Port}, {PAddr, PPort}} = SP -> {{Addr, Port}, {PAddr, PPort}} = SP ->
@ -236,7 +236,7 @@ accept(ListenSocket, Module, State, Sup, Interval, Proxy, Arity) ->
gen_tcp:close(Socket), gen_tcp:close(Socket),
none none
end, end,
?INFO_MSG("(~p) Accepted proxied connection ~s -> ~s", ?INFO_MSG("(~p) Accepted proxied connection ~ts -> ~ts",
[Receiver, [Receiver,
ejabberd_config:may_hide_data( ejabberd_config:may_hide_data(
format_endpoint({PPort, PAddr, tcp})), format_endpoint({PPort, PAddr, tcp})),
@ -253,7 +253,7 @@ accept(ListenSocket, Module, State, Sup, Interval, Proxy, Arity) ->
gen_tcp:close(Socket), gen_tcp:close(Socket),
none none
end, end,
?INFO_MSG("(~p) Accepted connection ~s -> ~s", ?INFO_MSG("(~p) Accepted connection ~ts -> ~ts",
[Receiver, [Receiver,
ejabberd_config:may_hide_data( ejabberd_config:may_hide_data(
format_endpoint({PPort, PAddr, tcp})), format_endpoint({PPort, PAddr, tcp})),
@ -263,7 +263,7 @@ accept(ListenSocket, Module, State, Sup, Interval, Proxy, Arity) ->
end, end,
accept(ListenSocket, Module, State, Sup, NewInterval, Proxy, Arity); accept(ListenSocket, Module, State, Sup, NewInterval, Proxy, Arity);
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("(~w) Failed TCP accept: ~s", ?ERROR_MSG("(~w) Failed TCP accept: ~ts",
[ListenSocket, format_error(Reason)]), [ListenSocket, format_error(Reason)]),
accept(ListenSocket, Module, State, Sup, NewInterval, Proxy, Arity) accept(ListenSocket, Module, State, Sup, NewInterval, Proxy, Arity)
end. end.
@ -283,7 +283,7 @@ udp_recv(Socket, Module, State) ->
udp_recv(Socket, Module, NewState) udp_recv(Socket, Module, NewState)
end; end;
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Unexpected UDP error: ~s", [format_error(Reason)]), ?ERROR_MSG("Unexpected UDP error: ~ts", [format_error(Reason)]),
throw({error, Reason}) throw({error, Reason})
end. end.
@ -376,7 +376,7 @@ stop_listeners() ->
stop_listener({_, _, Transport} = EndPoint, Module, Opts) -> stop_listener({_, _, Transport} = EndPoint, Module, Opts) ->
case supervisor:terminate_child(?MODULE, EndPoint) of case supervisor:terminate_child(?MODULE, EndPoint) of
ok -> ok ->
?INFO_MSG("Stop accepting ~s connections at ~s for ~p", ?INFO_MSG("Stop accepting ~ts connections at ~ts for ~p",
[format_transport(Transport, Opts), [format_transport(Transport, Opts),
format_endpoint(EndPoint), Module]), format_endpoint(EndPoint), Module]),
ets:delete(?MODULE, EndPoint), ets:delete(?MODULE, EndPoint),
@ -444,7 +444,7 @@ config_reloaded() ->
-spec report_socket_error(inet:posix(), endpoint(), module()) -> ok. -spec report_socket_error(inet:posix(), endpoint(), module()) -> ok.
report_socket_error(Reason, EndPoint, Module) -> report_socket_error(Reason, EndPoint, Module) ->
?ERROR_MSG("Failed to open socket at ~s for ~s: ~s", ?ERROR_MSG("Failed to open socket at ~ts for ~ts: ~ts",
[format_endpoint(EndPoint), Module, format_error(Reason)]). [format_endpoint(EndPoint), Module, format_error(Reason)]).
-spec format_error(inet:posix() | atom()) -> string(). -spec format_error(inet:posix() | atom()) -> string().

View File

@ -71,7 +71,7 @@ start_link() ->
-spec route(stanza()) -> ok. -spec route(stanza()) -> ok.
route(Packet) -> route(Packet) ->
?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Local route:~n~ts", [xmpp:pp(Packet)]),
Type = xmpp:get_type(Packet), Type = xmpp:get_type(Packet),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
if To#jid.luser /= <<"">> -> if To#jid.luser /= <<"">> ->

View File

@ -71,7 +71,7 @@ get_integer_env(Name, Default) ->
undefined -> undefined ->
Default; Default;
{ok, Junk} -> {ok, Junk} ->
error_logger:error_msg("wrong value for ~s: ~p; " error_logger:error_msg("wrong value for ~ts: ~p; "
"using ~p as a fallback~n", "using ~p as a fallback~n",
[Name, Junk, Default]), [Name, Junk, Default]),
Default Default
@ -83,7 +83,7 @@ get_string_env(Name, Default) ->
undefined -> undefined ->
Default; Default;
{ok, Junk} -> {ok, Junk} ->
error_logger:error_msg("wrong value for ~s: ~p; " error_logger:error_msg("wrong value for ~ts: ~p; "
"using ~p as a fallback~n", "using ~p as a fallback~n",
[Name, Junk, Default]), [Name, Junk, Default]),
Default Default

View File

@ -81,7 +81,7 @@ init([]) ->
Schema = read_schema_file(), Schema = read_schema_file(),
{ok, #state{schema = Schema}}; {ok, #state{schema = Schema}};
false -> false ->
?CRITICAL_MSG("Node name mismatch: I'm [~s], " ?CRITICAL_MSG("Node name mismatch: I'm [~ts], "
"the database is owned by ~p", [MyNode, DbNodes]), "the database is owned by ~p", [MyNode, DbNodes]),
?CRITICAL_MSG("Either set ERLANG_NODE in ejabberdctl.cfg " ?CRITICAL_MSG("Either set ERLANG_NODE in ejabberdctl.cfg "
"or change node name in Mnesia", []), "or change node name in Mnesia", []),
@ -139,7 +139,7 @@ do_create(Module, Name, TabDef, TabDefs) ->
end. end.
reset(Name, TabDef) -> reset(Name, TabDef) ->
?INFO_MSG("Deleting Mnesia table '~s'", [Name]), ?INFO_MSG("Deleting Mnesia table '~ts'", [Name]),
mnesia_op(delete_table, [Name]), mnesia_op(delete_table, [Name]),
create(Name, TabDef). create(Name, TabDef).
@ -170,7 +170,7 @@ change_table_copy_type(Name, TabDef) ->
[] -> CurrType [] -> CurrType
end, end,
if NewType /= CurrType -> if NewType /= CurrType ->
?INFO_MSG("Changing Mnesia table '~s' from ~s to ~s", ?INFO_MSG("Changing Mnesia table '~ts' from ~ts to ~ts",
[Name, CurrType, NewType]), [Name, CurrType, NewType]),
mnesia_op(change_table_copy_type, [Name, node(), NewType]); mnesia_op(change_table_copy_type, [Name, node(), NewType]);
true -> true ->
@ -178,7 +178,7 @@ change_table_copy_type(Name, TabDef) ->
end. end.
delete_indexes(Name, [Index|Indexes]) -> delete_indexes(Name, [Index|Indexes]) ->
?INFO_MSG("Deleting index '~s' from Mnesia table '~s'", [Index, Name]), ?INFO_MSG("Deleting index '~ts' from Mnesia table '~ts'", [Index, Name]),
case mnesia_op(del_table_index, [Name, Index]) of case mnesia_op(del_table_index, [Name, Index]) of
{atomic, ok} -> {atomic, ok} ->
delete_indexes(Name, Indexes); delete_indexes(Name, Indexes);
@ -189,7 +189,7 @@ delete_indexes(_Name, []) ->
{atomic, ok}. {atomic, ok}.
add_indexes(Name, [Index|Indexes]) -> add_indexes(Name, [Index|Indexes]) ->
?INFO_MSG("Adding index '~s' to Mnesia table '~s'", [Index, Name]), ?INFO_MSG("Adding index '~ts' to Mnesia table '~ts'", [Index, Name]),
case mnesia_op(add_table_index, [Name, Index]) of case mnesia_op(add_table_index, [Name, Index]) of
{atomic, ok} -> {atomic, ok} ->
add_indexes(Name, Indexes); add_indexes(Name, Indexes);
@ -207,7 +207,7 @@ schema(Name, Default, Schema) ->
case lists:keyfind(Name, 1, Schema) of case lists:keyfind(Name, 1, Schema) of
{_, Custom} -> {_, Custom} ->
TabDefs = merge(Custom, Default), TabDefs = merge(Custom, Default),
?DEBUG("Using custom schema for table '~s': ~p", ?DEBUG("Using custom schema for table '~ts': ~p",
[Name, TabDefs]), [Name, TabDefs]),
TabDefs; TabDefs;
false -> false ->
@ -221,7 +221,7 @@ read_schema_file() ->
{ok, Y} -> {ok, Y} ->
case econf:validate(validator(), lists:flatten(Y)) of case econf:validate(validator(), lists:flatten(Y)) of
{ok, []} -> {ok, []} ->
?WARNING_MSG("Mnesia schema file ~s is empty", [File]), ?WARNING_MSG("Mnesia schema file ~ts is empty", [File]),
[]; [];
{ok, Config} -> {ok, Config} ->
lists:map( lists:map(
@ -232,15 +232,15 @@ read_schema_file() ->
end, Opts)} end, Opts)}
end, Config); end, Config);
{error, Reason, Ctx} -> {error, Reason, Ctx} ->
?ERROR_MSG("Failed to read Mnesia schema from ~s: ~s", ?ERROR_MSG("Failed to read Mnesia schema from ~ts: ~ts",
[File, econf:format_error(Reason, Ctx)]), [File, econf:format_error(Reason, Ctx)]),
[] []
end; end;
{error, enoent} -> {error, enoent} ->
?DEBUG("No custom Mnesia schema file found at ~s", [File]), ?DEBUG("No custom Mnesia schema file found at ~ts", [File]),
[]; [];
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Failed to read Mnesia schema file ~s: ~s", ?ERROR_MSG("Failed to read Mnesia schema file ~ts: ~ts",
[File, fast_yaml:format_error(Reason)]) [File, fast_yaml:format_error(Reason)])
end. end.
@ -264,7 +264,7 @@ create(Name, TabDef) ->
({disc_only_copies, _}, _) -> " disc_only "; ({disc_only_copies, _}, _) -> " disc_only ";
(_, Acc) -> Acc (_, Acc) -> Acc
end, " ", TabDef), end, " ", TabDef),
?INFO_MSG("Creating Mnesia~stable '~s'", [Type, Name]), ?INFO_MSG("Creating Mnesia~tstable '~ts'", [Type, Name]),
case mnesia_op(create_table, [Name, TabDef]) of case mnesia_op(create_table, [Name, TabDef]) of
{atomic, ok} -> {atomic, ok} ->
add_table_copy(Name); add_table_copy(Name);
@ -323,7 +323,7 @@ transform(Module, Name, NewAttrs) ->
transform(Module, Name, Attrs, Attrs) -> transform(Module, Name, Attrs, Attrs) ->
case need_transform(Module, Name) of case need_transform(Module, Name) of
true -> true ->
?INFO_MSG("Transforming table '~s', this may take a while", [Name]), ?INFO_MSG("Transforming table '~ts', this may take a while", [Name]),
transform_table(Module, Name); transform_table(Module, Name);
false -> false ->
{atomic, ok} {atomic, ok}
@ -376,9 +376,9 @@ transform_fun(Module, Name) ->
try Module:transform(Obj) try Module:transform(Obj)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to transform Mnesia table ~s:~n" ?ERROR_MSG("Failed to transform Mnesia table ~ts:~n"
"** Record: ~p~n" "** Record: ~p~n"
"** ~s", "** ~ts",
[Name, Obj, [Name, Obj,
misc:format_exception(2, Class, Reason, StackTrace)]), misc:format_exception(2, Class, Reason, StackTrace)]),
erlang:raise(Class, Reason, StackTrace) erlang:raise(Class, Reason, StackTrace)
@ -426,7 +426,7 @@ mnesia_op(Fun, Args) ->
{atomic, ok} -> {atomic, ok} ->
{atomic, ok}; {atomic, ok};
Other -> Other ->
?ERROR_MSG("Failure on mnesia ~s ~p: ~p", ?ERROR_MSG("Failure on mnesia ~ts ~p: ~p",
[Fun, Args, Other]), [Fun, Args, Other]),
Other Other
end. end.
@ -454,8 +454,8 @@ dump_schema() ->
end, mnesia:system_info(tables)), end, mnesia:system_info(tables)),
case file:write_file(File, [fast_yaml:encode(Schema), io_lib:nl()]) of case file:write_file(File, [fast_yaml:encode(Schema), io_lib:nl()]) of
ok -> ok ->
io:format("Mnesia schema is written to ~s~n", [File]); io:format("Mnesia schema is written to ~ts~n", [File]);
{error, Reason} -> {error, Reason} ->
io:format("Failed to write Mnesia schema to ~s: ~s", io:format("Failed to write Mnesia schema to ~ts: ~ts",
[File, file:format_error(Reason)]) [File, file:format_error(Reason)])
end. end.

View File

@ -523,7 +523,7 @@ transform_globals(Opts) ->
transform_globals(Opt, Opts) when Opt == override_global; transform_globals(Opt, Opts) when Opt == override_global;
Opt == override_local; Opt == override_local;
Opt == override_acls -> Opt == override_acls ->
?WARNING_MSG("Option '~s' has no effect anymore", [Opt]), ?WARNING_MSG("Option '~ts' has no effect anymore", [Opt]),
Opts; Opts;
transform_globals({node_start, _}, Opts) -> transform_globals({node_start, _}, Opts) ->
?WARNING_MSG("Option 'node_start' has no effect anymore", []), ?WARNING_MSG("Option 'node_start' has no effect anymore", []),

View File

@ -86,7 +86,7 @@ import_file(FileName, State) ->
Res; Res;
{error, Reason} -> {error, Reason} ->
ErrTxt = file:format_error(Reason), ErrTxt = file:format_error(Reason),
?ERROR_MSG("Failed to open file '~s': ~s", [FileName, ErrTxt]), ?ERROR_MSG("Failed to open file '~ts': ~ts", [FileName, ErrTxt]),
{error, Reason} {error, Reason}
end. end.
@ -125,7 +125,7 @@ export_hosts(Hosts, Dir) ->
end, ok, FilesAndHosts); end, ok, FilesAndHosts);
{error, Reason} -> {error, Reason} ->
ErrTxt = file:format_error(Reason), ErrTxt = file:format_error(Reason),
?ERROR_MSG("Failed to open file '~s': ~s", [DFn, ErrTxt]), ?ERROR_MSG("Failed to open file '~ts': ~ts", [DFn, ErrTxt]),
{error, Reason} {error, Reason}
end. end.
@ -149,7 +149,7 @@ export_host(Dir, FnH, Host) ->
end; end;
{error, Reason} -> {error, Reason} ->
ErrTxt = file:format_error(Reason), ErrTxt = file:format_error(Reason),
?ERROR_MSG("Failed to open file '~s': ~s", [DFn, ErrTxt]), ?ERROR_MSG("Failed to open file '~ts': ~ts", [DFn, ErrTxt]),
{error, Reason} {error, Reason}
end. end.
@ -315,7 +315,7 @@ process_el({xmlstreamstart, <<"server-data">>, Attrs}, State) ->
?NS_PIE -> ?NS_PIE ->
{ok, State}; {ok, State};
NS -> NS ->
stop("Unknown 'server-data' namespace = ~s", [NS]) stop("Unknown 'server-data' namespace = ~ts", [NS])
end; end;
process_el({xmlstreamend, _}, State) -> process_el({xmlstreamend, _}, State) ->
{ok, State}; {ok, State};
@ -344,10 +344,10 @@ process_el({xmlstreamelement, #xmlel{name = <<"host">>,
true -> true ->
process_users(Els, State#state{server = S}); process_users(Els, State#state{server = S});
false -> false ->
stop("Unknown host: ~s", [S]) stop("Unknown host: ~ts", [S])
end end
catch _:{bad_jid, _} -> catch _:{bad_jid, _} ->
stop("Invalid 'jid': ~s", [JIDS]) stop("Invalid 'jid': ~ts", [JIDS])
end; end;
process_el({xmlstreamstart, <<"user">>, Attrs}, State = #state{server = S}) process_el({xmlstreamstart, <<"user">>, Attrs}, State = #state{server = S})
when S /= <<"">> -> when S /= <<"">> ->
@ -395,7 +395,7 @@ process_user(#xmlel{name = <<"user">>, attrs = Attrs, children = Els},
case jid:nodeprep(Name) of case jid:nodeprep(Name) of
error -> error ->
stop("Invalid 'user': ~s", [Name]); stop("Invalid 'user': ~ts", [Name]);
LUser -> LUser ->
case ejabberd_auth:try_register(LUser, LServer, Pass) of case ejabberd_auth:try_register(LUser, LServer, Pass) of
ok -> ok ->
@ -403,7 +403,7 @@ process_user(#xmlel{name = <<"user">>, attrs = Attrs, children = Els},
{error, invalid_password} when (Password == <<>>) -> {error, invalid_password} when (Password == <<>>) ->
process_user_els(Els, State#state{user = LUser}); process_user_els(Els, State#state{user = LUser});
{error, Err} -> {error, Err} ->
stop("Failed to create user '~s': ~p", [Name, Err]) stop("Failed to create user '~ts': ~p", [Name, Err])
end end
end. end.
@ -442,7 +442,7 @@ process_user_el(#xmlel{name = Name, attrs = Attrs, children = Els} = El,
end end
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
ErrTxt = xmpp:format_error(Why), ErrTxt = xmpp:format_error(Why),
stop("failed to decode XML '~s': ~s", stop("failed to decode XML '~ts': ~ts",
[fxml:element_to_binary(El), ErrTxt]) [fxml:element_to_binary(El), ErrTxt])
end. end.
@ -585,7 +585,7 @@ make_piefxis_xml_tail() ->
%% @spec () -> string() %% @spec () -> string()
make_piefxis_server_head() -> make_piefxis_server_head() ->
io_lib:format("<server-data xmlns='~s' xmlns:xi='~s'>", io_lib:format("<server-data xmlns='~ts' xmlns:xi='~ts'>",
[?NS_PIE, ?NS_XI]). [?NS_PIE, ?NS_XI]).
%% @spec () -> string() %% @spec () -> string()
@ -594,7 +594,7 @@ make_piefxis_server_tail() ->
%% @spec (Host::string()) -> string() %% @spec (Host::string()) -> string()
make_piefxis_host_head(Host) -> make_piefxis_host_head(Host) ->
io_lib:format("<host xmlns='~s' xmlns:xi='~s' jid='~s'>", io_lib:format("<host xmlns='~ts' xmlns:xi='~ts' jid='~ts'>",
[?NS_PIE, ?NS_XI, Host]). [?NS_PIE, ?NS_XI, Host]).
%% @spec () -> string() %% @spec () -> string()
@ -604,7 +604,7 @@ make_piefxis_host_tail() ->
%% @spec (Fn::string()) -> string() %% @spec (Fn::string()) -> string()
make_xinclude(Fn) -> make_xinclude(Fn) ->
Base = filename:basename(Fn), Base = filename:basename(Fn),
io_lib:format("<xi:include href='~s'/>", [Base]). io_lib:format("<xi:include href='~ts'/>", [Base]).
print(Fd, String) -> print(Fd, String) ->
file:write(Fd, String). file:write(Fd, String).

View File

@ -76,7 +76,7 @@ try_certfile(Path0) ->
case pkix:is_pem_file(Path) of case pkix:is_pem_file(Path) of
true -> Path; true -> Path;
{false, Reason} -> {false, Reason} ->
?ERROR_MSG("Failed to read PEM file ~s: ~s", ?ERROR_MSG("Failed to read PEM file ~ts: ~ts",
[Path, pkix:format_error(Reason)]), [Path, pkix:format_error(Reason)]),
erlang:error(badarg) erlang:error(badarg)
end. end.
@ -134,7 +134,7 @@ notify_expired(Event) ->
cert_expired(_Cert, #{domains := Domains, cert_expired(_Cert, #{domains := Domains,
expiry := Expiry, expiry := Expiry,
files := [{Path, Line}|_]}) -> files := [{Path, Line}|_]}) ->
?WARNING_MSG("Certificate in ~s (at line: ~B)~s ~s", ?WARNING_MSG("Certificate in ~ts (at line: ~B)~ts ~ts",
[Path, Line, [Path, Line,
case Domains of case Domains of
[] -> ""; [] -> "";
@ -262,7 +262,7 @@ add_file(File) ->
case pkix:add_file(File) of case pkix:add_file(File) of
ok -> ok; ok -> ok;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Failed to read PEM file ~s: ~s", ?ERROR_MSG("Failed to read PEM file ~ts: ~ts",
[File, pkix:format_error(Reason)]), [File, pkix:format_error(Reason)]),
Err Err
end. end.
@ -274,7 +274,7 @@ del_files(Files) ->
-spec do_commit() -> {ok, [{filename(), pkix:error_reason()}]} | error. -spec do_commit() -> {ok, [{filename(), pkix:error_reason()}]} | error.
do_commit() -> do_commit() ->
CAFile = ejabberd_option:ca_file(), CAFile = ejabberd_option:ca_file(),
?DEBUG("Using CA root certificates from: ~s", [CAFile]), ?DEBUG("Using CA root certificates from: ~ts", [CAFile]),
Opts = [{cafile, CAFile}, Opts = [{cafile, CAFile},
{notify_before, [7*24*60*60, % 1 week {notify_before, [7*24*60*60, % 1 week
24*60*60, % 1 day 24*60*60, % 1 day
@ -289,7 +289,7 @@ do_commit() ->
fast_tls_add_certfiles(), fast_tls_add_certfiles(),
{ok, Errors}; {ok, Errors};
{error, File, Reason} -> {error, File, Reason} ->
?CRITICAL_MSG("Failed to write to ~s: ~s", ?CRITICAL_MSG("Failed to write to ~ts: ~ts",
[File, file:format_error(Reason)]), [File, file:format_error(Reason)]),
error error
end. end.
@ -310,7 +310,7 @@ check_domain_certfiles(Hosts) ->
case get_certfile_no_default(Host) of case get_certfile_no_default(Host) of
error -> error ->
?WARNING_MSG( ?WARNING_MSG(
"No certificate found matching ~s", "No certificate found matching ~ts",
[Host]); [Host]);
_ -> _ ->
ok ok
@ -339,7 +339,7 @@ prep_path(Path0) ->
{ok, CWD} -> {ok, CWD} ->
unicode:characters_to_binary(filename:join(CWD, Path0)); unicode:characters_to_binary(filename:join(CWD, Path0));
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("Failed to get current directory name: ~s", ?WARNING_MSG("Failed to get current directory name: ~ts",
[file:format_error(Reason)]), [file:format_error(Reason)]),
unicode:characters_to_binary(Path0) unicode:characters_to_binary(Path0)
end; end;
@ -359,7 +359,7 @@ wildcard(Path) when is_binary(Path) ->
wildcard(Path) -> wildcard(Path) ->
case filelib:wildcard(Path) of case filelib:wildcard(Path) of
[] -> [] ->
?WARNING_MSG("Path ~s is empty, please make sure ejabberd has " ?WARNING_MSG("Path ~ts is empty, please make sure ejabberd has "
"sufficient rights to read it", [Path]), "sufficient rights to read it", [Path]),
[]; [];
Files -> Files ->
@ -382,9 +382,9 @@ fast_tls_add_certfiles() ->
fast_tls:clear_cache(). fast_tls:clear_cache().
reason_to_fmt({invalid_cert, _, _}) -> reason_to_fmt({invalid_cert, _, _}) ->
"Invalid certificate in ~s: ~s"; "Invalid certificate in ~ts: ~ts";
reason_to_fmt(_) -> reason_to_fmt(_) ->
"Failed to read PEM file ~s: ~s". "Failed to read PEM file ~ts: ~ts".
-spec log_warnings([{filename(), pkix:error_reason()}]) -> ok. -spec log_warnings([{filename(), pkix:error_reason()}]) -> ok.
log_warnings(Warnings) -> log_warnings(Warnings) ->
@ -404,7 +404,7 @@ log_errors(Errors) ->
-spec log_cafile_error({filename(), pkix:error_reason()} | undefined) -> ok. -spec log_cafile_error({filename(), pkix:error_reason()} | undefined) -> ok.
log_cafile_error({File, Reason}) -> log_cafile_error({File, Reason}) ->
?CRITICAL_MSG("Failed to read CA certitificates from ~s: ~s. " ?CRITICAL_MSG("Failed to read CA certitificates from ~ts: ~ts. "
"Try to change/set option 'ca_file'", "Try to change/set option 'ca_file'",
[File, pkix:format_error(Reason)]); [File, pkix:format_error(Reason)]);
log_cafile_error(_) -> log_cafile_error(_) ->

View File

@ -425,7 +425,7 @@ handle_info({subscribed, Channel, Pid}, State) ->
case maps:is_key(Channel, State#state.subscriptions) of case maps:is_key(Channel, State#state.subscriptions) of
true -> eredis_sub:ack_message(Pid); true -> eredis_sub:ack_message(Pid);
false -> false ->
?WARNING_MSG("Got subscription ack for unknown channel ~s", ?WARNING_MSG("Got subscription ack for unknown channel ~ts",
[Channel]) [Channel])
end; end;
_ -> _ ->
@ -466,7 +466,7 @@ connect(#state{num = Num}) ->
ConnTimeout = ejabberd_option:redis_connect_timeout(), ConnTimeout = ejabberd_option:redis_connect_timeout(),
try case do_connect(Num, Server, Port, Pass, DB, ConnTimeout) of try case do_connect(Num, Server, Port, Pass, DB, ConnTimeout) of
{ok, Client} -> {ok, Client} ->
?DEBUG("Connection #~p established to Redis at ~s:~p", ?DEBUG("Connection #~p established to Redis at ~ts:~p",
[Num, Server, Port]), [Num, Server, Port]),
register(get_connection(Num), Client), register(get_connection(Num), Client),
{ok, Client}; {ok, Client};
@ -476,7 +476,7 @@ connect(#state{num = Num}) ->
catch _:Reason -> catch _:Reason ->
Timeout = p1_rand:uniform( Timeout = p1_rand:uniform(
min(10, ejabberd_redis_sup:get_pool_size())), min(10, ejabberd_redis_sup:get_pool_size())),
?ERROR_MSG("Redis connection #~p at ~s:~p has failed: ~p; " ?ERROR_MSG("Redis connection #~p at ~ts:~p has failed: ~p; "
"reconnecting in ~p seconds", "reconnecting in ~p seconds",
[Num, Server, Port, Reason, Timeout]), [Num, Server, Port, Reason, Timeout]),
erlang:send_after(timer:seconds(Timeout), self(), connect), erlang:send_after(timer:seconds(Timeout), self(), connect),
@ -542,7 +542,7 @@ gen_server_call(Proc, Msg) ->
log_error(Cmd, Reason) -> log_error(Cmd, Reason) ->
?ERROR_MSG("Redis request has failed:~n" ?ERROR_MSG("Redis request has failed:~n"
"** request = ~p~n" "** request = ~p~n"
"** response = ~s", "** response = ~ts",
[Cmd, format_error(Reason)]). [Cmd, format_error(Reason)]).
-spec get_rnd_id() -> pos_integer(). -spec get_rnd_id() -> pos_integer().

View File

@ -47,7 +47,7 @@ start() ->
{ok, _} -> ok; {ok, _} -> ok;
{error, {already_started, _}} -> ok; {error, {already_started, _}} -> ok;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("Failed to start ~s: ~p", [?MODULE, Why]), ?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
Err Err
end end
end. end.

View File

@ -92,7 +92,7 @@ route(Packet) ->
try do_route(Packet) try do_route(Packet)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end. end.
@ -103,7 +103,7 @@ route(#jid{} = From, #jid{} = To, #xmlel{} = El) ->
Pkt -> route(From, To, Pkt) Pkt -> route(From, To, Pkt)
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode xml element ~p when " ?ERROR_MSG("Failed to decode xml element ~p when "
"routing from ~s to ~s: ~s", "routing from ~ts to ~ts: ~ts",
[El, jid:encode(From), jid:encode(To), [El, jid:encode(From), jid:encode(To),
xmpp:format_error(Why)]) xmpp:format_error(Why)])
end; end;
@ -171,12 +171,12 @@ register_route(Domain, ServerHost, LocalHint, Pid) ->
case Mod:register_route(LDomain, LServerHost, LocalHint, case Mod:register_route(LDomain, LServerHost, LocalHint,
get_component_number(LDomain), Pid) of get_component_number(LDomain), Pid) of
ok -> ok ->
?DEBUG("Route registered: ~s", [LDomain]), ?DEBUG("Route registered: ~ts", [LDomain]),
monitor_route(LDomain, Pid), monitor_route(LDomain, Pid),
ejabberd_hooks:run(route_registered, [LDomain]), ejabberd_hooks:run(route_registered, [LDomain]),
delete_cache(Mod, LDomain); delete_cache(Mod, LDomain);
{error, Err} -> {error, Err} ->
?ERROR_MSG("Failed to register route ~s: ~p", ?ERROR_MSG("Failed to register route ~ts: ~p",
[LDomain, Err]) [LDomain, Err])
end end
end. end.
@ -201,12 +201,12 @@ unregister_route(Domain, Pid) ->
case Mod:unregister_route( case Mod:unregister_route(
LDomain, get_component_number(LDomain), Pid) of LDomain, get_component_number(LDomain), Pid) of
ok -> ok ->
?DEBUG("Route unregistered: ~s", [LDomain]), ?DEBUG("Route unregistered: ~ts", [LDomain]),
demonitor_route(LDomain, Pid), demonitor_route(LDomain, Pid),
ejabberd_hooks:run(route_unregistered, [LDomain]), ejabberd_hooks:run(route_unregistered, [LDomain]),
delete_cache(Mod, LDomain); delete_cache(Mod, LDomain);
{error, Err} -> {error, Err} ->
?ERROR_MSG("Failed to unregister route ~s: ~p", ?ERROR_MSG("Failed to unregister route ~ts: ~p",
[LDomain, Err]) [LDomain, Err])
end end
end. end.
@ -355,7 +355,7 @@ handle_info({route, Packet}, State) ->
handle_info({'DOWN', MRef, _, Pid, Info}, State) -> handle_info({'DOWN', MRef, _, Pid, Info}, State) ->
MRefs = maps:filter( MRefs = maps:filter(
fun({Domain, P}, M) when P == Pid, M == MRef -> fun({Domain, P}, M) when P == Pid, M == MRef ->
?DEBUG("Process ~p with route registered to ~s " ?DEBUG("Process ~p with route registered to ~ts "
"has terminated unexpectedly with reason: ~p", "has terminated unexpectedly with reason: ~p",
[P, Domain, Info]), [P, Domain, Info]),
try unregister_route(Domain, Pid) try unregister_route(Domain, Pid)
@ -381,7 +381,7 @@ code_change(_OldVsn, State, _Extra) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-spec do_route(stanza()) -> ok. -spec do_route(stanza()) -> ok.
do_route(OrigPacket) -> do_route(OrigPacket) ->
?DEBUG("Route:~n~s", [xmpp:pp(OrigPacket)]), ?DEBUG("Route:~n~ts", [xmpp:pp(OrigPacket)]),
case ejabberd_hooks:run_fold(filter_packet, OrigPacket, []) of case ejabberd_hooks:run_fold(filter_packet, OrigPacket, []) of
drop -> drop ->
ok; ok;

View File

@ -211,7 +211,7 @@ code_change(_OldVsn, State, _Extra) ->
%% Destinations = [#jid] %% Destinations = [#jid]
-spec do_route(binary(), [jid()], stanza()) -> any(). -spec do_route(binary(), [jid()], stanza()) -> any().
do_route(Domain, Destinations, Packet) -> do_route(Domain, Destinations, Packet) ->
?DEBUG("Route multicast:~n~s~nDomain: ~s~nDestinations: ~s~n", ?DEBUG("Route multicast:~n~ts~nDomain: ~ts~nDestinations: ~ts~n",
[xmpp:pp(Packet), Domain, [xmpp:pp(Packet), Domain,
str:join([jid:encode(To) || To <- Destinations], <<", ">>)]), str:join([jid:encode(To) || To <- Destinations], <<", ">>)]),
%% Try to find an appropriate multicast service %% Try to find an appropriate multicast service

View File

@ -125,8 +125,8 @@ row_to_route(Domain, {ServerHost, NodeS, PidS, LocalHintS} = Row) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to decode row from 'route' table:~n" ?ERROR_MSG("Failed to decode row from 'route' table:~n"
"** Row = ~p~n" "** Row = ~p~n"
"** Domain = ~s~n" "** Domain = ~ts~n"
"** ~s", "** ~ts",
[Row, Domain, [Row, Domain,
misc:format_exception(2, Class, Reason, StackTrace)]), misc:format_exception(2, Class, Reason, StackTrace)]),
[] []

View File

@ -91,7 +91,7 @@ list_temporarily_blocked_hosts() ->
-spec external_host_overloaded(binary()) -> {aborted, any()} | {atomic, ok}. -spec external_host_overloaded(binary()) -> {aborted, any()} | {atomic, ok}.
external_host_overloaded(Host) -> external_host_overloaded(Host) ->
?INFO_MSG("Disabling s2s connections to ~s for ~p seconds", ?INFO_MSG("Disabling s2s connections to ~ts for ~p seconds",
[Host, ?S2S_OVERLOAD_BLOCK_PERIOD]), [Host, ?S2S_OVERLOAD_BLOCK_PERIOD]),
mnesia:transaction(fun () -> mnesia:transaction(fun () ->
Time = erlang:monotonic_time(), Time = erlang:monotonic_time(),
@ -122,7 +122,7 @@ remove_connection({From, To} = FromTo, Pid) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, _} -> ok; {atomic, _} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("Failed to unregister s2s connection ~s -> ~s: " ?ERROR_MSG("Failed to unregister s2s connection ~ts -> ~ts: "
"Mnesia failure: ~p", "Mnesia failure: ~p",
[From, To, Reason]) [From, To, Reason])
end; end;
@ -167,7 +167,7 @@ try_register({From, To} = FromTo) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, Res} -> Res; {atomic, Res} -> Res;
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("Failed to register s2s connection ~s -> ~s: " ?ERROR_MSG("Failed to register s2s connection ~ts -> ~ts: "
"Mnesia failure: ~p", "Mnesia failure: ~p",
[From, To, Reason]), [From, To, Reason]),
false false
@ -284,7 +284,7 @@ handle_info({route, Packet}, State) ->
try route(Packet) try route(Packet)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end, end,
@ -344,7 +344,7 @@ clean_table_from_bad_node(Node) ->
-spec route(stanza()) -> ok. -spec route(stanza()) -> ok.
route(Packet) -> route(Packet) ->
?DEBUG("Local route:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Local route:~n~ts", [xmpp:pp(Packet)]),
From = xmpp:get_from(Packet), From = xmpp:get_from(Packet),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
case start_connection(From, To) of case start_connection(From, To) of
@ -477,7 +477,7 @@ new_connection(MyServer, Server, From, FromTo,
end, end,
[Pid1]; [Pid1];
{aborted, Reason} -> {aborted, Reason} ->
?ERROR_MSG("Failed to register s2s connection ~s -> ~s: " ?ERROR_MSG("Failed to register s2s connection ~ts -> ~ts: "
"Mnesia failure: ~p", "Mnesia failure: ~p",
[MyServer, Server, Reason]), [MyServer, Server, Reason]),
ejabberd_s2s_out:stop(Pid), ejabberd_s2s_out:stop(Pid),

View File

@ -128,7 +128,7 @@ process_closed(#{server := LServer} = State, Reason) ->
#{ip := IP} -> #{ip := IP} ->
ejabberd_config:may_hide_data(misc:ip_to_list(IP)) ejabberd_config:may_hide_data(misc:ip_to_list(IP))
end, end,
?INFO_MSG("Closing inbound s2s connection ~s -> ~s: ~s", ?INFO_MSG("Closing inbound s2s connection ~ts -> ~ts: ~ts",
[RServer, LServer, xmpp_stream_out:format_error(Reason)]), [RServer, LServer, xmpp_stream_out:format_error(Reason)]),
stop(State). stop(State).
@ -178,7 +178,7 @@ handle_auth_success(RServer, Mech, _AuthModule,
auth_domains := AuthDomains, auth_domains := AuthDomains,
server_host := ServerHost, server_host := ServerHost,
lserver := LServer} = State) -> lserver := LServer} = State) ->
?INFO_MSG("(~s) Accepted inbound s2s ~s authentication ~s -> ~s (~s)", ?INFO_MSG("(~ts) Accepted inbound s2s ~ts authentication ~ts -> ~ts (~ts)",
[xmpp_socket:pp(Socket), Mech, RServer, LServer, [xmpp_socket:pp(Socket), Mech, RServer, LServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
State1 = case ejabberd_s2s:allow_host(ServerHost, RServer) of State1 = case ejabberd_s2s:allow_host(ServerHost, RServer) of
@ -195,7 +195,7 @@ handle_auth_failure(RServer, Mech, Reason,
#{socket := Socket, ip := IP, #{socket := Socket, ip := IP,
server_host := ServerHost, server_host := ServerHost,
lserver := LServer} = State) -> lserver := LServer} = State) ->
?WARNING_MSG("(~s) Failed inbound s2s ~s authentication ~s -> ~s (~s): ~s", ?WARNING_MSG("(~ts) Failed inbound s2s ~ts authentication ~ts -> ~ts (~ts): ~ts",
[xmpp_socket:pp(Socket), Mech, RServer, LServer, [xmpp_socket:pp(Socket), Mech, RServer, LServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]), ejabberd_config:may_hide_data(misc:ip_to_list(IP)), Reason]),
ejabberd_hooks:run_fold(s2s_in_auth_result, ejabberd_hooks:run_fold(s2s_in_auth_result,
@ -283,7 +283,7 @@ terminate(Reason, #{auth_domains := AuthDomains,
socket := Socket} = State) -> socket := Socket} = State) ->
case maps:get(stop_reason, State, undefined) of case maps:get(stop_reason, State, undefined) of
{tls, _} = Err -> {tls, _} = Err ->
?WARNING_MSG("(~s) Failed to secure inbound s2s connection: ~s", ?WARNING_MSG("(~ts) Failed to secure inbound s2s connection: ~ts",
[xmpp_socket:pp(Socket), xmpp_stream_in:format_error(Err)]); [xmpp_socket:pp(Socket), xmpp_stream_in:format_error(Err)]);
_ -> _ ->
ok ok

View File

@ -135,7 +135,7 @@ host_down(Host) ->
process_auth_result(#{server := LServer, remote_server := RServer} = State, process_auth_result(#{server := LServer, remote_server := RServer} = State,
{false, Reason}) -> {false, Reason}) ->
Delay = get_delay(), Delay = get_delay(),
?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: " ?WARNING_MSG("Failed to establish outbound s2s connection ~ts -> ~ts: "
"authentication failed; bouncing for ~p seconds", "authentication failed; bouncing for ~p seconds",
[LServer, RServer, Delay div 1000]), [LServer, RServer, Delay div 1000]),
State1 = State#{on_route => bounce, stop_reason => Reason}, State1 = State#{on_route => bounce, stop_reason => Reason},
@ -148,13 +148,13 @@ process_auth_result(State, true) ->
process_closed(#{server := LServer, remote_server := RServer, process_closed(#{server := LServer, remote_server := RServer,
on_route := send} = State, on_route := send} = State,
Reason) -> Reason) ->
?INFO_MSG("Closing outbound s2s connection ~s -> ~s: ~s", ?INFO_MSG("Closing outbound s2s connection ~ts -> ~ts: ~ts",
[LServer, RServer, format_error(Reason)]), [LServer, RServer, format_error(Reason)]),
stop(State); stop(State);
process_closed(#{server := LServer, remote_server := RServer} = State, process_closed(#{server := LServer, remote_server := RServer} = State,
Reason) -> Reason) ->
Delay = get_delay(), Delay = get_delay(),
?WARNING_MSG("Failed to establish outbound s2s connection ~s -> ~s: ~s; " ?WARNING_MSG("Failed to establish outbound s2s connection ~ts -> ~ts: ~ts; "
"bouncing for ~p seconds", "bouncing for ~p seconds",
[LServer, RServer, format_error(Reason), Delay div 1000]), [LServer, RServer, format_error(Reason), Delay div 1000]),
State1 = State#{on_route => bounce}, State1 = State#{on_route => bounce},
@ -206,7 +206,7 @@ handle_auth_success(Mech, #{socket := Socket, ip := IP,
remote_server := RServer, remote_server := RServer,
server_host := ServerHost, server_host := ServerHost,
server := LServer} = State) -> server := LServer} = State) ->
?INFO_MSG("(~s) Accepted outbound s2s ~s authentication ~s -> ~s (~s)", ?INFO_MSG("(~ts) Accepted outbound s2s ~ts authentication ~ts -> ~ts (~ts)",
[xmpp_socket:pp(Socket), Mech, LServer, RServer, [xmpp_socket:pp(Socket), Mech, LServer, RServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
ejabberd_hooks:run_fold(s2s_out_auth_result, ServerHost, State, [true]). ejabberd_hooks:run_fold(s2s_out_auth_result, ServerHost, State, [true]).
@ -216,7 +216,7 @@ handle_auth_failure(Mech, Reason,
remote_server := RServer, remote_server := RServer,
server_host := ServerHost, server_host := ServerHost,
server := LServer} = State) -> server := LServer} = State) ->
?WARNING_MSG("(~s) Failed outbound s2s ~s authentication ~s -> ~s (~s): ~s", ?WARNING_MSG("(~ts) Failed outbound s2s ~ts authentication ~ts -> ~ts (~ts): ~ts",
[xmpp_socket:pp(Socket), Mech, LServer, RServer, [xmpp_socket:pp(Socket), Mech, LServer, RServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
xmpp_stream_out:format_error(Reason)]), xmpp_stream_out:format_error(Reason)]),
@ -270,7 +270,7 @@ init([#{server := LServer, remote_server := RServer} = State, Opts]) ->
server_host => ServerHost, server_host => ServerHost,
shaper => none}, shaper => none},
State2 = xmpp_stream_out:set_timeout(State1, Timeout), State2 = xmpp_stream_out:set_timeout(State1, Timeout),
?INFO_MSG("Outbound s2s connection started: ~s -> ~s", ?INFO_MSG("Outbound s2s connection started: ~ts -> ~ts",
[LServer, RServer]), [LServer, RServer]),
ejabberd_hooks:run_fold(s2s_out_init, ServerHost, {ok, State2}, [Opts]). ejabberd_hooks:run_fold(s2s_out_init, ServerHost, {ok, State2}, [Opts]).
@ -335,7 +335,7 @@ bounce_message_queue({LServer, RServer} = FromTo, State) ->
Pids = ejabberd_s2s:get_connections_pids(FromTo), Pids = ejabberd_s2s:get_connections_pids(FromTo),
case lists:member(self(), Pids) of case lists:member(self(), Pids) of
true -> true ->
?WARNING_MSG("Outgoing s2s connection ~s -> ~s is supposed " ?WARNING_MSG("Outgoing s2s connection ~ts -> ~ts is supposed "
"to be unregistered, but pid ~p still presents " "to be unregistered, but pid ~p still presents "
"in 's2s' table", [LServer, RServer, self()]), "in 's2s' table", [LServer, RServer, self()]),
State; State;

View File

@ -164,8 +164,8 @@ get_password_fun(#{remote_server := RemoteServer,
{ok, Password} -> {ok, Password} ->
{Password, undefined}; {Password, undefined};
error -> error ->
?WARNING_MSG("(~s) Domain ~s is unconfigured for " ?WARNING_MSG("(~ts) Domain ~ts is unconfigured for "
"external component from ~s", "external component from ~ts",
[xmpp_socket:pp(Socket), RemoteServer, [xmpp_socket:pp(Socket), RemoteServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
{false, undefined} {false, undefined}
@ -176,8 +176,8 @@ handle_auth_success(_, Mech, _,
#{remote_server := RemoteServer, host_opts := HostOpts, #{remote_server := RemoteServer, host_opts := HostOpts,
socket := Socket, ip := IP, socket := Socket, ip := IP,
global_routes := GlobalRoutes} = State) -> global_routes := GlobalRoutes} = State) ->
?INFO_MSG("(~s) Accepted external component ~s authentication " ?INFO_MSG("(~ts) Accepted external component ~ts authentication "
"for ~s from ~s", "for ~ts from ~ts",
[xmpp_socket:pp(Socket), Mech, RemoteServer, [xmpp_socket:pp(Socket), Mech, RemoteServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
Routes = if GlobalRoutes -> Routes = if GlobalRoutes ->
@ -195,8 +195,8 @@ handle_auth_success(_, Mech, _,
handle_auth_failure(_, Mech, Reason, handle_auth_failure(_, Mech, Reason,
#{remote_server := RemoteServer, #{remote_server := RemoteServer,
socket := Socket, ip := IP} = State) -> socket := Socket, ip := IP} = State) ->
?WARNING_MSG("(~s) Failed external component ~s authentication " ?WARNING_MSG("(~ts) Failed external component ~ts authentication "
"for ~s from ~s: ~s", "for ~ts from ~ts: ~ts",
[xmpp_socket:pp(Socket), Mech, RemoteServer, [xmpp_socket:pp(Socket), Mech, RemoteServer,
ejabberd_config:may_hide_data(misc:ip_to_list(IP)), ejabberd_config:may_hide_data(misc:ip_to_list(IP)),
Reason]), Reason]),
@ -272,7 +272,7 @@ listen_opt_type(shaper_rule) ->
econf:and_then( econf:and_then(
econf:shaper(), econf:shaper(),
fun(S) -> fun(S) ->
?WARNING_MSG("Listening option 'shaper_rule' of module ~s " ?WARNING_MSG("Listening option 'shaper_rule' of module ~ts "
"is renamed to 'shaper'. Please adjust your " "is renamed to 'shaper'. Please adjust your "
"configuration", [?MODULE]), "configuration", [?MODULE]),
S S

View File

@ -72,7 +72,7 @@ new(_) -> none.
update(none, _Size) -> {none, 0}; update(none, _Size) -> {none, 0};
update(Shaper1, Size) -> update(Shaper1, Size) ->
Shaper2 = p1_shaper:update(Shaper1, Size), Shaper2 = p1_shaper:update(Shaper1, Size),
?DEBUG("Shaper update:~n~s =>~n~s", ?DEBUG("Shaper update:~n~ts =>~n~ts",
[p1_shaper:pp(Shaper1), p1_shaper:pp(Shaper2)]), [p1_shaper:pp(Shaper1), p1_shaper:pp(Shaper2)]),
Shaper2. Shaper2.
@ -231,7 +231,7 @@ resolve_shapers(ShaperRule, Rules, Shapers) ->
try {true, {maps:get(Name, Shapers), Rule}} try {true, {maps:get(Name, Shapers), Rule}}
catch _:{badkey, _} -> catch _:{badkey, _} ->
?WARNING_MSG( ?WARNING_MSG(
"Shaper rule '~s' refers to unknown shaper: ~s", "Shaper rule '~ts' refers to unknown shaper: ~ts",
[ShaperRule, Name]), [ShaperRule, Name]),
false false
end; end;

View File

@ -30,7 +30,7 @@
-include("logger.hrl"). -include("logger.hrl").
-export([accept/1, start/3, start_link/3, listen_options/0]). -export([accept/1, start/3, start_link/3, listen_options/0]).
fail() -> fail() ->
?CRITICAL_MSG("Listening module ~s is not available: " ?CRITICAL_MSG("Listening module ~ts is not available: "
"ejabberd is not compiled with SIP support", "ejabberd is not compiled with SIP support",
[?MODULE]), [?MODULE]),
erlang:error(sip_not_compiled). erlang:error(sip_not_compiled).

View File

@ -129,9 +129,9 @@ route(To, Term) ->
try do_route(To, Term), ok try do_route(To, Term), ok
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route term to ~s:~n" ?ERROR_MSG("Failed to route term to ~ts:~n"
"** Term = ~p~n" "** Term = ~p~n"
"** ~s", "** ~ts",
[jid:encode(To), Term, [jid:encode(To), Term,
misc:format_exception(2, E, R, StackTrace)]) misc:format_exception(2, E, R, StackTrace)])
end. end.
@ -141,7 +141,7 @@ route(Packet) ->
#jid{lserver = LServer} = xmpp:get_to(Packet), #jid{lserver = LServer} = xmpp:get_to(Packet),
case ejabberd_hooks:run_fold(sm_receive_packet, LServer, Packet, []) of case ejabberd_hooks:run_fold(sm_receive_packet, LServer, Packet, []) of
drop -> drop ->
?DEBUG("Hook dropped stanza:~n~s", [xmpp:pp(Packet)]); ?DEBUG("Hook dropped stanza:~n~ts", [xmpp:pp(Packet)]);
Packet1 -> Packet1 ->
do_route(Packet1), do_route(Packet1),
ok ok
@ -204,7 +204,7 @@ bounce_sm_packet({bounce, Packet} = Acc) ->
ejabberd_router:route_error(Packet, Err), ejabberd_router:route_error(Packet, Err),
{stop, Acc}; {stop, Acc};
bounce_sm_packet({_, Packet} = Acc) -> bounce_sm_packet({_, Packet} = Acc) ->
?DEBUG("Dropping packet to unavailable resource:~n~s", ?DEBUG("Dropping packet to unavailable resource:~n~ts",
[xmpp:pp(Packet)]), [xmpp:pp(Packet)]),
Acc. Acc.
@ -654,7 +654,7 @@ do_route(#jid{lresource = <<"">>} = To, Term) ->
do_route(jid:replace_resource(To, R), Term) do_route(jid:replace_resource(To, R), Term)
end, get_user_resources(To#jid.user, To#jid.server)); end, get_user_resources(To#jid.user, To#jid.server));
do_route(To, Term) -> do_route(To, Term) ->
?DEBUG("Broadcasting ~p to ~s", [Term, jid:encode(To)]), ?DEBUG("Broadcasting ~p to ~ts", [Term, jid:encode(To)]),
{U, S, R} = jid:tolower(To), {U, S, R} = jid:tolower(To),
Mod = get_sm_backend(S), Mod = get_sm_backend(S),
case get_sessions(Mod, U, S, R) of case get_sessions(Mod, U, S, R) of
@ -670,7 +670,7 @@ do_route(To, Term) ->
-spec do_route(stanza()) -> any(). -spec do_route(stanza()) -> any().
do_route(#presence{to = To, type = T} = Packet) do_route(#presence{to = To, type = T} = Packet)
when T == subscribe; T == subscribed; T == unsubscribe; T == unsubscribed -> when T == subscribe; T == subscribed; T == unsubscribe; T == unsubscribed ->
?DEBUG("Processing subscription:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing subscription:~n~ts", [xmpp:pp(Packet)]),
#jid{luser = LUser, lserver = LServer} = To, #jid{luser = LUser, lserver = LServer} = To,
case is_privacy_allow(Packet) andalso case is_privacy_allow(Packet) andalso
ejabberd_hooks:run_fold( ejabberd_hooks:run_fold(
@ -683,7 +683,7 @@ do_route(#presence{to = To, type = T} = Packet)
priority = Prio}) when is_integer(Prio) -> priority = Prio}) when is_integer(Prio) ->
Pid = element(2, SID), Pid = element(2, SID),
Packet1 = Packet#presence{to = jid:replace_resource(To, R)}, Packet1 = Packet#presence{to = jid:replace_resource(To, R)},
?DEBUG("Sending to process ~p:~n~s", ?DEBUG("Sending to process ~p:~n~ts",
[Pid, xmpp:pp(Packet1)]), [Pid, xmpp:pp(Packet1)]),
ejabberd_c2s:route(Pid, {route, Packet1}); ejabberd_c2s:route(Pid, {route, Packet1});
(_) -> (_) ->
@ -693,14 +693,14 @@ do_route(#presence{to = To, type = T} = Packet)
ok ok
end; end;
do_route(#presence{to = #jid{lresource = <<"">>} = To} = Packet) -> do_route(#presence{to = #jid{lresource = <<"">>} = To} = Packet) ->
?DEBUG("Processing presence to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing presence to bare JID:~n~ts", [xmpp:pp(Packet)]),
{LUser, LServer, _} = jid:tolower(To), {LUser, LServer, _} = jid:tolower(To),
lists:foreach( lists:foreach(
fun({_, R}) -> fun({_, R}) ->
do_route(Packet#presence{to = jid:replace_resource(To, R)}) do_route(Packet#presence{to = jid:replace_resource(To, R)})
end, get_user_present_resources(LUser, LServer)); end, get_user_present_resources(LUser, LServer));
do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) -> do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
?DEBUG("Processing message to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing message to bare JID:~n~ts", [xmpp:pp(Packet)]),
if T == chat; T == headline; T == normal -> if T == chat; T == headline; T == normal ->
route_message(Packet); route_message(Packet);
true -> true ->
@ -709,14 +709,14 @@ do_route(#message{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
end; end;
do_route(#iq{to = #jid{lresource = <<"">>} = To, type = T} = Packet) -> do_route(#iq{to = #jid{lresource = <<"">>} = To, type = T} = Packet) ->
if T == set; T == get -> if T == set; T == get ->
?DEBUG("Processing IQ to bare JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing IQ to bare JID:~n~ts", [xmpp:pp(Packet)]),
gen_iq_handler:handle(?MODULE, Packet); gen_iq_handler:handle(?MODULE, Packet);
true -> true ->
ejabberd_hooks:run_fold(bounce_sm_packet, ejabberd_hooks:run_fold(bounce_sm_packet,
To#jid.lserver, {pass, Packet}, []) To#jid.lserver, {pass, Packet}, [])
end; end;
do_route(Packet) -> do_route(Packet) ->
?DEBUG("Processing packet to full JID:~n~s", [xmpp:pp(Packet)]), ?DEBUG("Processing packet to full JID:~n~ts", [xmpp:pp(Packet)]),
To = xmpp:get_to(Packet), To = xmpp:get_to(Packet),
{LUser, LServer, LResource} = jid:tolower(To), {LUser, LServer, LResource} = jid:tolower(To),
Mod = get_sm_backend(LServer), Mod = get_sm_backend(LServer),
@ -738,7 +738,7 @@ do_route(Packet) ->
Ss -> Ss ->
Session = lists:max(Ss), Session = lists:max(Ss),
Pid = element(2, Session#session.sid), Pid = element(2, Session#session.sid),
?DEBUG("Sending to process ~p:~n~s", [Pid, xmpp:pp(Packet)]), ?DEBUG("Sending to process ~p:~n~ts", [Pid, xmpp:pp(Packet)]),
ejabberd_c2s:route(Pid, {route, Packet}) ejabberd_c2s:route(Pid, {route, Packet})
end. end.

View File

@ -250,8 +250,8 @@ load_script() ->
V when V >= ?MIN_REDIS_VERSION -> V when V >= ?MIN_REDIS_VERSION ->
ejabberd_redis:script_load(Data); ejabberd_redis:script_load(Data);
V -> V ->
?CRITICAL_MSG("Unsupported Redis version: ~s. " ?CRITICAL_MSG("Unsupported Redis version: ~ts. "
"The version must be ~s or above", "The version must be ~ts or above",
[V, ?MIN_REDIS_VERSION]), [V, ?MIN_REDIS_VERSION]),
{error, unsupported_redis_version} {error, unsupported_redis_version}
end; end;

View File

@ -264,14 +264,14 @@ decode_term(Bin) ->
Term Term
catch _:{badmatch, {error, {Line, Mod, Reason}, _}} -> catch _:{badmatch, {error, {Line, Mod, Reason}, _}} ->
?ERROR_MSG("Corrupted Erlang term in SQL database:~n" ?ERROR_MSG("Corrupted Erlang term in SQL database:~n"
"** Scanner error: at line ~B: ~s~n" "** Scanner error: at line ~B: ~ts~n"
"** Term: ~s", "** Term: ~ts",
[Line, Mod:format_error(Reason), Bin]), [Line, Mod:format_error(Reason), Bin]),
erlang:error(badarg); erlang:error(badarg);
_:{badmatch, {error, {Line, Mod, Reason}}} -> _:{badmatch, {error, {Line, Mod, Reason}}} ->
?ERROR_MSG("Corrupted Erlang term in SQL database:~n" ?ERROR_MSG("Corrupted Erlang term in SQL database:~n"
"** Parser error: at line ~B: ~s~n" "** Parser error: at line ~B: ~ts~n"
"** Term: ~s", "** Term: ~ts",
[Line, Mod:format_error(Reason), Bin]), [Line, Mod:format_error(Reason), Bin]),
erlang:error(badarg) erlang:error(badarg)
end. end.
@ -290,7 +290,7 @@ sqlite_file(Host) ->
{ok, Cwd} -> {ok, Cwd} ->
filename:join([Cwd|Path]); filename:join([Cwd|Path]);
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Failed to get current directory: ~s", ?ERROR_MSG("Failed to get current directory: ~ts",
[file:format_error(Reason)]), [file:format_error(Reason)]),
filename:join(Path) filename:join(Path)
end; end;
@ -382,7 +382,7 @@ connecting({sql_cmd, Command, Timestamp} = Req, From,
State#state.pending_requests) State#state.pending_requests)
catch error:full -> catch error:full ->
Err = <<"SQL request queue is overfilled">>, Err = <<"SQL request queue is overfilled">>,
?ERROR_MSG("~s, bouncing all pending requests", [Err]), ?ERROR_MSG("~ts, bouncing all pending requests", [Err]),
Q = p1_queue:dropwhile( Q = p1_queue:dropwhile(
fun({sql_cmd, _, To, TS}) -> fun({sql_cmd, _, To, TS}) ->
reply(To, {error, Err}, TS), reply(To, {error, Err}, TS),
@ -497,7 +497,7 @@ inner_transaction(F) ->
?TOP_LEVEL_TXN -> ?TOP_LEVEL_TXN ->
{backtrace, T} = process_info(self(), backtrace), {backtrace, T} = process_info(self(), backtrace),
?ERROR_MSG("Inner transaction called at outer txn " ?ERROR_MSG("Inner transaction called at outer txn "
"level. Trace: ~s", "level. Trace: ~ts",
[T]), [T]),
erlang:exit(implementation_faulty); erlang:exit(implementation_faulty);
_N -> ok _N -> ok
@ -519,7 +519,7 @@ outer_transaction(F, NRestarts, _Reason) ->
_N -> _N ->
{backtrace, T} = process_info(self(), backtrace), {backtrace, T} = process_info(self(), backtrace),
?ERROR_MSG("Outer transaction called at inner txn " ?ERROR_MSG("Outer transaction called at inner txn "
"level. Trace: ~s", "level. Trace: ~ts",
[T]), [T]),
erlang:exit(implementation_faulty) erlang:exit(implementation_faulty)
end, end,
@ -616,7 +616,7 @@ sql_query_internal(#sql_query{} = Query) ->
{error, <<"shutdown">>}; {error, <<"shutdown">>};
?EX_RULE(Class, Reason, Stack) -> ?EX_RULE(Class, Reason, Stack) ->
StackTrace = ?EX_STACK(Stack), StackTrace = ?EX_STACK(Stack),
?ERROR_MSG("Internal error while processing SQL query:~n** ~s", ?ERROR_MSG("Internal error while processing SQL query:~n** ~ts",
[misc:format_exception(2, Class, Reason, StackTrace)]), [misc:format_exception(2, Class, Reason, StackTrace)]),
{error, <<"internal error">>} {error, <<"internal error">>}
end, end,
@ -629,7 +629,7 @@ sql_query_internal(F) when is_function(F) ->
end; end;
sql_query_internal(Query) -> sql_query_internal(Query) ->
State = get(?STATE_KEY), State = get(?STATE_KEY),
?DEBUG("SQL: \"~s\"", [Query]), ?DEBUG("SQL: \"~ts\"", [Query]),
QueryTimeout = query_timeout(State#state.host), QueryTimeout = query_timeout(State#state.host),
Res = case State#state.db_type of Res = case State#state.db_type of
odbc -> odbc ->
@ -744,7 +744,7 @@ pgsql_execute_sql_query(SQLQuery, State) ->
pgsql:execute(State#state.db_ref, SQLQuery#sql_query.hash, Args), pgsql:execute(State#state.db_ref, SQLQuery#sql_query.hash, Args),
% {T, ExecuteRes} = % {T, ExecuteRes} =
% timer:tc(pgsql, execute, [State#state.db_ref, SQLQuery#sql_query.hash, Args]), % timer:tc(pgsql, execute, [State#state.db_ref, SQLQuery#sql_query.hash, Args]),
% io:format("T ~s ~p~n", [SQLQuery#sql_query.hash, T]), % io:format("T ~ts ~p~n", [SQLQuery#sql_query.hash, T]),
Res = pgsql_execute_to_odbc(ExecuteRes), Res = pgsql_execute_to_odbc(ExecuteRes),
sql_query_format_res(Res, SQLQuery). sql_query_format_res(Res, SQLQuery).
@ -759,7 +759,7 @@ sql_query_format_res({selected, _, Rows}, SQLQuery) ->
?EX_RULE(Class, Reason, Stack) -> ?EX_RULE(Class, Reason, Stack) ->
StackTrace = ?EX_STACK(Stack), StackTrace = ?EX_STACK(Stack),
?ERROR_MSG("Error while processing SQL query result:~n" ?ERROR_MSG("Error while processing SQL query result:~n"
"** Row: ~p~n** ~s", "** Row: ~p~n** ~ts",
[Row, [Row,
misc:format_exception(2, Class, Reason, StackTrace)]), misc:format_exception(2, Class, Reason, StackTrace)]),
[] []
@ -1053,7 +1053,7 @@ warn_if_ssl_unsupported(tcp, _) ->
warn_if_ssl_unsupported(ssl, pgsql) -> warn_if_ssl_unsupported(ssl, pgsql) ->
ok; ok;
warn_if_ssl_unsupported(ssl, Type) -> warn_if_ssl_unsupported(ssl, Type) ->
?WARNING_MSG("SSL connection is not supported for ~s", [Type]). ?WARNING_MSG("SSL connection is not supported for ~ts", [Type]).
get_ssl_opts(ssl, Host) -> get_ssl_opts(ssl, Host) ->
Opts1 = case ejabberd_option:sql_ssl_certfile(Host) of Opts1 = case ejabberd_option:sql_ssl_certfile(Host) of
@ -1089,8 +1089,8 @@ init_mssql(Host) ->
undefined -> <<"ejabberd">>; undefined -> <<"ejabberd">>;
D -> D D -> D
end, end,
FreeTDS = io_lib:fwrite("[~s]~n" FreeTDS = io_lib:fwrite("[~ts]~n"
"\thost = ~s~n" "\thost = ~ts~n"
"\tport = ~p~n" "\tport = ~p~n"
"\tclient charset = UTF-8~n" "\tclient charset = UTF-8~n"
"\ttds version = 7.1~n", "\ttds version = 7.1~n",
@ -1101,16 +1101,16 @@ init_mssql(Host) ->
"Setup = libtdsS.so~n" "Setup = libtdsS.so~n"
"UsageCount = 1~n" "UsageCount = 1~n"
"FileUsage = 1~n", []), "FileUsage = 1~n", []),
ODBCINI = io_lib:fwrite("[~s]~n" ODBCINI = io_lib:fwrite("[~ts]~n"
"Description = MS SQL~n" "Description = MS SQL~n"
"Driver = freetds~n" "Driver = freetds~n"
"Servername = ~s~n" "Servername = ~ts~n"
"Database = ~s~n" "Database = ~ts~n"
"Port = ~p~n", "Port = ~p~n",
[Host, Host, DB, Port]), [Host, Host, DB, Port]),
?DEBUG("~s:~n~s", [freetds_config(), FreeTDS]), ?DEBUG("~ts:~n~ts", [freetds_config(), FreeTDS]),
?DEBUG("~s:~n~s", [odbcinst_config(), ODBCINST]), ?DEBUG("~ts:~n~ts", [odbcinst_config(), ODBCINST]),
?DEBUG("~s:~n~s", [odbc_config(), ODBCINI]), ?DEBUG("~ts:~n~ts", [odbc_config(), ODBCINI]),
case filelib:ensure_dir(freetds_config()) of case filelib:ensure_dir(freetds_config()) of
ok -> ok ->
try try
@ -1122,12 +1122,12 @@ init_mssql(Host) ->
os:putenv("FREETDSCONF", freetds_config()), os:putenv("FREETDSCONF", freetds_config()),
ok ok
catch error:{badmatch, {error, Reason} = Err} -> catch error:{badmatch, {error, Reason} = Err} ->
?ERROR_MSG("Failed to create temporary files in ~s: ~s", ?ERROR_MSG("Failed to create temporary files in ~ts: ~ts",
[tmp_dir(), file:format_error(Reason)]), [tmp_dir(), file:format_error(Reason)]),
Err Err
end; end;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Failed to create temporary directory ~s: ~s", ?ERROR_MSG("Failed to create temporary directory ~ts: ~ts",
[tmp_dir(), file:format_error(Reason)]), [tmp_dir(), file:format_error(Reason)]),
Err Err
end. end.
@ -1168,22 +1168,22 @@ current_time() ->
%% ***IMPORTANT*** This error format requires extended_errors turned on. %% ***IMPORTANT*** This error format requires extended_errors turned on.
extended_error({"08S01", _, Reason}) -> extended_error({"08S01", _, Reason}) ->
% TCP Provider: The specified network name is no longer available % TCP Provider: The specified network name is no longer available
?DEBUG("ODBC Link Failure: ~s", [Reason]), ?DEBUG("ODBC Link Failure: ~ts", [Reason]),
<<"Communication link failure">>; <<"Communication link failure">>;
extended_error({"08001", _, Reason}) -> extended_error({"08001", _, Reason}) ->
% Login timeout expired % Login timeout expired
?DEBUG("ODBC Connect Timeout: ~s", [Reason]), ?DEBUG("ODBC Connect Timeout: ~ts", [Reason]),
<<"SQL connection failed">>; <<"SQL connection failed">>;
extended_error({"IMC01", _, Reason}) -> extended_error({"IMC01", _, Reason}) ->
% The connection is broken and recovery is not possible % The connection is broken and recovery is not possible
?DEBUG("ODBC Link Failure: ~s", [Reason]), ?DEBUG("ODBC Link Failure: ~ts", [Reason]),
<<"Communication link failure">>; <<"Communication link failure">>;
extended_error({"IMC06", _, Reason}) -> extended_error({"IMC06", _, Reason}) ->
% The connection is broken and recovery is not possible % The connection is broken and recovery is not possible
?DEBUG("ODBC Link Failure: ~s", [Reason]), ?DEBUG("ODBC Link Failure: ~ts", [Reason]),
<<"Communication link failure">>; <<"Communication link failure">>;
extended_error({Code, _, Reason}) -> extended_error({Code, _, Reason}) ->
?DEBUG("ODBC Error ~s: ~s", [Code, Reason]), ?DEBUG("ODBC Error ~ts: ~ts", [Code, Reason]),
iolist_to_binary(Reason); iolist_to_binary(Reason);
extended_error(Error) -> extended_error(Error) ->
Error. Error.
@ -1192,14 +1192,14 @@ check_error({error, Why} = Err, _Query) when Why == killed ->
Err; Err;
check_error({error, Why}, #sql_query{} = Query) -> check_error({error, Why}, #sql_query{} = Query) ->
Err = extended_error(Why), Err = extended_error(Why),
?ERROR_MSG("SQL query '~s' at ~p failed: ~p", ?ERROR_MSG("SQL query '~ts' at ~p failed: ~p",
[Query#sql_query.hash, Query#sql_query.loc, Err]), [Query#sql_query.hash, Query#sql_query.loc, Err]),
{error, Err}; {error, Err};
check_error({error, Why}, Query) -> check_error({error, Why}, Query) ->
Err = extended_error(Why), Err = extended_error(Why),
case catch iolist_to_binary(Query) of case catch iolist_to_binary(Query) of
SQuery when is_binary(SQuery) -> SQuery when is_binary(SQuery) ->
?ERROR_MSG("SQL query '~s' failed: ~p", [SQuery, Err]); ?ERROR_MSG("SQL query '~ts' failed: ~p", [SQuery, Err]);
_ -> _ ->
?ERROR_MSG("SQL query ~p failed: ~p", [Query, Err]) ?ERROR_MSG("SQL query ~p failed: ~p", [Query, Err])
end, end,

View File

@ -54,7 +54,7 @@ start(Host) ->
{ok, _} -> ok; {ok, _} -> ok;
{error, {already_started, _}} -> ok; {error, {already_started, _}} -> ok;
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("Failed to start ~s: ~p", [?MODULE, Why]), ?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
Err Err
end end
end. end.
@ -195,7 +195,7 @@ create_sqlite_tables(DB) ->
[ok = sqlite3:sql_exec(DB, Q) || Q <- Qs], [ok = sqlite3:sql_exec(DB, Q) || Q <- Qs],
ok = sqlite3:sql_exec(DB, "commit"); ok = sqlite3:sql_exec(DB, "commit");
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("Failed to read SQLite schema file: ~s", ?WARNING_MSG("Failed to read SQLite schema file: ~ts",
[file:format_error(Reason)]) [file:format_error(Reason)])
end. end.

View File

@ -32,7 +32,7 @@
-include("logger.hrl"). -include("logger.hrl").
-export([accept/1, start/3, start_link/3, listen_options/0]). -export([accept/1, start/3, start_link/3, listen_options/0]).
fail() -> fail() ->
?CRITICAL_MSG("Listening module ~s is not available: " ?CRITICAL_MSG("Listening module ~ts is not available: "
"ejabberd is not compiled with STUN/TURN support", "ejabberd is not compiled with STUN/TURN support",
[?MODULE]), [?MODULE]),
erlang:error(stun_not_compiled). erlang:error(stun_not_compiled).
@ -104,7 +104,7 @@ prepare_turn_opts(Opts, _UseTurn = true) ->
"'auth_realm' is undefined and " "'auth_realm' is undefined and "
"'auth_type' is set to 'user', " "'auth_type' is set to 'user', "
"most likely the TURN relay won't " "most likely the TURN relay won't "
"be working properly. Using ~s as " "be working properly. Using ~ts as "
"a fallback", [ejabberd_config:get_myname()]); "a fallback", [ejabberd_config:get_myname()]);
true -> true ->
ok ok

View File

@ -94,7 +94,7 @@ handle_event({set_alarm, {process_memory_high_watermark, Pid}}, State) ->
case proc_stat(Pid, get_app_pids()) of case proc_stat(Pid, get_app_pids()) of
#proc_stat{name = Name} = ProcStat -> #proc_stat{name = Name} = ProcStat ->
error_logger:warning_msg( error_logger:warning_msg(
"Process ~p consumes more than 5% of OS memory (~s)~n", "Process ~p consumes more than 5% of OS memory (~ts)~n",
[Name, format_proc(ProcStat)]), [Name, format_proc(ProcStat)]),
handle_overload(State), handle_overload(State),
{ok, State}; {ok, State};
@ -140,8 +140,8 @@ handle_overload(_State, Procs) ->
error_logger:warning_msg( error_logger:warning_msg(
"The system is overloaded with ~b messages " "The system is overloaded with ~b messages "
"queued by ~b process(es) (~b%) " "queued by ~b process(es) (~b%) "
"from the following applications: ~s; " "from the following applications: ~ts; "
"the top processes are:~n~s~n", "the top processes are:~n~ts~n",
[TotalMsgs, ProcsNum, [TotalMsgs, ProcsNum,
round(ProcsNum*100/length(Procs)), round(ProcsNum*100/length(Procs)),
format_apps(Apps), format_apps(Apps),
@ -246,13 +246,13 @@ format_proc(#proc_stat{qlen = Len, memory = Mem, initial_call = InitCall,
current_function = CurrFun, ancestors = Ancs, current_function = CurrFun, ancestors = Ancs,
application = App}) -> application = App}) ->
io_lib:format( io_lib:format(
"msgs = ~b, memory = ~b, initial_call = ~s, " "msgs = ~b, memory = ~b, initial_call = ~ts, "
"current_function = ~s, ancestors = ~w, application = ~w", "current_function = ~ts, ancestors = ~w, application = ~w",
[Len, Mem, format_mfa(InitCall), format_mfa(CurrFun), Ancs, App]). [Len, Mem, format_mfa(InitCall), format_mfa(CurrFun), Ancs, App]).
-spec format_mfa(mfa()) -> iodata(). -spec format_mfa(mfa()) -> iodata().
format_mfa({M, F, A}) when is_atom(M), is_atom(F), is_integer(A) -> format_mfa({M, F, A}) when is_atom(M), is_atom(F), is_integer(A) ->
io_lib:format("~s:~s/~b", [M, F, A]); io_lib:format("~ts:~ts/~b", [M, F, A]);
format_mfa(WTF) -> format_mfa(WTF) ->
io_lib:format("~w", [WTF]). io_lib:format("~w", [WTF]).

View File

@ -166,7 +166,7 @@ process([<<"doc">>, LocalFile], _Request) ->
"documentation with the environment variable " "documentation with the environment variable "
"EJABBERD_DOC_PATH. Check the ejabberd " "EJABBERD_DOC_PATH. Check the ejabberd "
"Guide for more information.">>, "Guide for more information.">>,
?WARNING_MSG("Problem '~p' accessing the local Guide file ~s", [Error, Help]), ?WARNING_MSG("Problem '~p' accessing the local Guide file ~ts", [Error, Help]),
case Error of case Error of
eacces -> {403, [], <<"Forbidden", Help/binary>>}; eacces -> {403, [], <<"Forbidden", Help/binary>>};
enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>}; enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>};
@ -927,7 +927,7 @@ user_info(User, Server, Query, Lang) ->
end; end;
_ -> translate:translate(Lang, ?T("Online")) _ -> translate:translate(Lang, ?T("Online"))
end, end,
[?XC(<<"h1">>, (str:format(translate:translate(Lang, ?T("User ~s")), [?XC(<<"h1">>, (str:format(translate:translate(Lang, ?T("User ~ts")),
[us_to_list(US)])))] [us_to_list(US)])))]
++ ++
case Res of case Res of

View File

@ -211,7 +211,7 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode, Shaper) ->
?DEBUG("TCP connection was closed, exit", []), ?DEBUG("TCP connection was closed, exit", []),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0); websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
{tcp_error, Socket, Reason} -> {tcp_error, Socket, Reason} ->
?DEBUG("TCP connection error: ~s", [inet:format_error(Reason)]), ?DEBUG("TCP connection error: ~ts", [inet:format_error(Reason)]),
websocket_close(Socket, WsHandleLoopPid, SocketMode, 0); websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
{'DOWN', Ref, process, WsHandleLoopPid, Reason} -> {'DOWN', Ref, process, WsHandleLoopPid, Reason} ->
Code = case Reason of Code = case Reason of
@ -356,7 +356,7 @@ process_frame(#frame_info{unprocessed = none,
8 -> % Close 8 -> % Close
CloseCode = case Unmasked of CloseCode = case Unmasked of
<<Code:16/integer-big, Message/binary>> -> <<Code:16/integer-big, Message/binary>> ->
?DEBUG("WebSocket close op: ~p ~s", ?DEBUG("WebSocket close op: ~p ~ts",
[Code, Message]), [Code, Message]),
Code; Code;
<<Code:16/integer-big>> -> <<Code:16/integer-big>> ->

View File

@ -78,7 +78,7 @@ process(_, #request{method = 'POST', data = Data, opts = Opts, ip = {IP, _}}) ->
El -> El ->
case fxmlrpc:decode(El) of case fxmlrpc:decode(El) of
{error, _} = Err -> {error, _} = Err ->
?ERROR_MSG("XML-RPC request ~s failed with reason: ~p", ?ERROR_MSG("XML-RPC request ~ts failed with reason: ~p",
[Data, Err]), [Data, Err]),
{400, [], {400, [],
#xmlel{name = <<"h1">>, attrs = [], #xmlel{name = <<"h1">>, attrs = [],

View File

@ -86,8 +86,8 @@ export(Server, Output, Module1) ->
case export(LServer, Table, IO, ConvertFun) of case export(LServer, Table, IO, ConvertFun) of
{atomic, ok} -> ok; {atomic, ok} -> ok;
{aborted, {no_exists, _}} -> {aborted, {no_exists, _}} ->
?WARNING_MSG("Ignoring export for module ~s: " ?WARNING_MSG("Ignoring export for module ~ts: "
"Mnesia table ~s doesn't exist (most likely " "Mnesia table ~ts doesn't exist (most likely "
"because the module is unused)", "because the module is unused)",
[Module1, Table]); [Module1, Table]);
{aborted, Reason} -> {aborted, Reason} ->
@ -133,9 +133,9 @@ import(Mod, Server, Dir, ToType) ->
{error, enoent} -> {error, enoent} ->
ok; ok;
eof -> eof ->
?INFO_MSG("It seems like SQL dump ~s is empty", [FileName]); ?INFO_MSG("It seems like SQL dump ~ts is empty", [FileName]);
Err -> Err ->
?ERROR_MSG("Failed to open SQL dump ~s: ~s", ?ERROR_MSG("Failed to open SQL dump ~ts: ~ts",
[FileName, format_error(Err)]) [FileName, format_error(Err)])
end end
end, import_info(Mod)), end, import_info(Mod)),
@ -260,7 +260,7 @@ import_rows(LServer, FromType, ToType, Tab, Mod, Dump, FieldsNumber) ->
eof -> eof ->
ok; ok;
Err -> Err ->
?ERROR_MSG("Failed to read row from SQL dump: ~s", ?ERROR_MSG("Failed to read row from SQL dump: ~ts",
[format_error(Err)]) [format_error(Err)])
end. end.

View File

@ -692,7 +692,7 @@ handle_info({Tag, _Socket, Data}, StateName, S)
end; end;
handle_info({Tag, _Socket}, Fsm_state, S) handle_info({Tag, _Socket}, Fsm_state, S)
when Tag == tcp_closed; Tag == ssl_closed -> when Tag == tcp_closed; Tag == ssl_closed ->
?WARNING_MSG("LDAP server closed the connection: ~s:~p~nIn " ?WARNING_MSG("LDAP server closed the connection: ~ts:~p~nIn "
"State: ~p", "State: ~p",
[S#eldap.host, S#eldap.port, Fsm_state]), [S#eldap.host, S#eldap.port, Fsm_state]),
{next_state, connecting, close_and_retry(S)}; {next_state, connecting, close_and_retry(S)};
@ -985,7 +985,7 @@ close_and_retry(S) ->
close_and_retry(S, ?RETRY_TIMEOUT). close_and_retry(S, ?RETRY_TIMEOUT).
report_bind_failure(Host, Port, Reason) -> report_bind_failure(Host, Port, Reason) ->
?WARNING_MSG("LDAP bind failed on ~s:~p~nReason: ~p", ?WARNING_MSG("LDAP bind failed on ~ts:~p~nReason: ~p",
[Host, Port, Reason]). [Host, Port, Reason]).
%%----------------------------------------------------------------------- %%-----------------------------------------------------------------------
@ -1048,7 +1048,7 @@ connect_bind(S) ->
[{packet, asn1}, {active, true}, {keepalive, true}, [{packet, asn1}, {active, true}, {keepalive, true},
{send_timeout, ?SEND_TIMEOUT}, binary] {send_timeout, ?SEND_TIMEOUT}, binary]
end, end,
?DEBUG("Connecting to LDAP server at ~s:~p with options ~p", ?DEBUG("Connecting to LDAP server at ~ts:~p with options ~p",
[Host, S#eldap.port, Opts]), [Host, S#eldap.port, Opts]),
HostS = binary_to_list(Host), HostS = binary_to_list(Host),
SockMod = case S#eldap.tls of SockMod = case S#eldap.tls of
@ -1070,7 +1070,7 @@ connect_bind(S) ->
{ok, connecting, NewS#eldap{host = Host}} {ok, connecting, NewS#eldap{host = Host}}
end; end;
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("LDAP connection to ~s:~b failed: ~s", ?ERROR_MSG("LDAP connection to ~ts:~b failed: ~ts",
[Host, S#eldap.port, format_error(SockMod, Reason)]), [Host, S#eldap.port, format_error(SockMod, Reason)]),
NewS = close_and_retry(S), NewS = close_and_retry(S),
{ok, connecting, NewS#eldap{host = Host}} {ok, connecting, NewS#eldap{host = Host}}

View File

@ -159,7 +159,7 @@ update() ->
end, Contrib, modules_spec(sources_dir(), "*/*")), end, Contrib, modules_spec(sources_dir(), "*/*")),
Repos = maps:fold(fun(Repo, _Mods, Acc) -> Repos = maps:fold(fun(Repo, _Mods, Acc) ->
Update = add_sources(Repo), Update = add_sources(Repo),
?INFO_MSG("Update packages from repo ~s: ~p", [Repo, Update]), ?INFO_MSG("Update packages from repo ~ts: ~p", [Repo, Update]),
case Update of case Update of
ok -> Acc; ok -> Acc;
Error -> [{repository, Repo, Error}|Acc] Error -> [{repository, Repo, Error}|Acc]
@ -168,7 +168,7 @@ update() ->
Res = lists:foldl(fun({Package, Spec}, Acc) -> Res = lists:foldl(fun({Package, Spec}, Acc) ->
Repo = proplists:get_value(url, Spec, ""), Repo = proplists:get_value(url, Spec, ""),
Update = add_sources(Package, Repo), Update = add_sources(Package, Repo),
?INFO_MSG("Update package ~s: ~p", [Package, Update]), ?INFO_MSG("Update package ~ts: ~p", [Package, Update]),
case Update of case Update of
ok -> Acc; ok -> Acc;
Error -> [{Package, Repo, Error}|Acc] Error -> [{Package, Repo, Error}|Acc]

View File

@ -129,7 +129,7 @@ handle_call({cmd, Cmd, EndTime}, _From, State) ->
{reply, decode_bool(N), State}; {reply, decode_bool(N), State};
{Port, Data} -> {Port, Data} ->
?ERROR_MSG("Received unexpected response from external " ?ERROR_MSG("Received unexpected response from external "
"authentication program '~s': ~p " "authentication program '~ts': ~p "
"(port = ~p, pid = ~w)", "(port = ~p, pid = ~w)",
[State#state.prog, Data, Port, State#state.os_pid]), [State#state.prog, Data, Port, State#state.os_pid]),
{reply, {error, unexpected_response}, State}; {reply, {error, unexpected_response}, State};
@ -149,11 +149,11 @@ handle_info({'EXIT', Port, _Reason}, #state{port = Port,
start_time = Time} = State) -> start_time = Time} = State) ->
case curr_time() - Time of case curr_time() - Time of
Diff when Diff < 1000 -> Diff when Diff < 1000 ->
?ERROR_MSG("Failed to start external authentication program '~s'", ?ERROR_MSG("Failed to start external authentication program '~ts'",
[State#state.prog]), [State#state.prog]),
{stop, normal, State}; {stop, normal, State};
_ -> _ ->
?ERROR_MSG("External authentication program '~s' has terminated " ?ERROR_MSG("External authentication program '~ts' has terminated "
"unexpectedly (pid=~w), restarting via supervisor...", "unexpectedly (pid=~w), restarting via supervisor...",
[State#state.prog, State#state.os_pid]), [State#state.prog, State#state.os_pid]),
{stop, normal, State} {stop, normal, State}

View File

@ -35,7 +35,7 @@
start(Host) -> start(Host) ->
case extauth:prog_name(Host) of case extauth:prog_name(Host) of
undefined -> undefined ->
?ERROR_MSG("Option 'extauth_program' is not set for '~s'", ?ERROR_MSG("Option 'extauth_program' is not set for '~ts'",
[Host]), [Host]),
ignore; ignore;
Prog -> Prog ->

View File

@ -113,7 +113,7 @@ process_iq(_Host, Module, Function, IQ) ->
ok ok
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to process iq:~n~s~n** ~s", ?ERROR_MSG("Failed to process iq:~n~ts~n** ~ts",
[xmpp:pp(IQ), [xmpp:pp(IQ),
misc:format_exception(2, Class, Reason, StackTrace)]), misc:format_exception(2, Class, Reason, StackTrace)]),
Txt = ?T("Module failed to handle the query"), Txt = ?T("Module failed to handle the query"),

View File

@ -121,7 +121,7 @@ stop_child(Proc) ->
-spec start_modules() -> any(). -spec start_modules() -> any().
start_modules() -> start_modules() ->
Hosts = ejabberd_option:hosts(), Hosts = ejabberd_option:hosts(),
?INFO_MSG("Loading modules for ~s", [misc:format_hosts_list(Hosts)]), ?INFO_MSG("Loading modules for ~ts", [misc:format_hosts_list(Hosts)]),
lists:foreach(fun start_modules/1, Hosts). lists:foreach(fun start_modules/1, Hosts).
-spec start_modules(binary()) -> ok. -spec start_modules(binary()) -> ok.
@ -144,7 +144,7 @@ start_module(Host, Module) ->
-spec start_module(binary(), atom(), opts(), integer()) -> ok | {ok, pid()}. -spec start_module(binary(), atom(), opts(), integer()) -> ok | {ok, pid()}.
start_module(Host, Module, Opts, Order) -> start_module(Host, Module, Opts, Order) ->
?DEBUG("Loading ~s at ~s", [Module, Host]), ?DEBUG("Loading ~ts at ~ts", [Module, Host]),
store_options(Host, Module, Opts, Order), store_options(Host, Module, Opts, Order),
try case Module:start(Host, Opts) of try case Module:start(Host, Opts) of
ok -> ok; ok -> ok;
@ -205,7 +205,7 @@ reload_modules(Host) ->
reload_module(Host, Module, NewOpts, OldOpts, Order) -> reload_module(Host, Module, NewOpts, OldOpts, Order) ->
case erlang:function_exported(Module, reload, 3) of case erlang:function_exported(Module, reload, 3) of
true -> true ->
?DEBUG("Reloading ~s at ~s", [Module, Host]), ?DEBUG("Reloading ~ts at ~ts", [Module, Host]),
store_options(Host, Module, NewOpts, Order), store_options(Host, Module, NewOpts, Order),
try case Module:reload(Host, NewOpts, OldOpts) of try case Module:reload(Host, NewOpts, OldOpts) of
ok -> ok; ok -> ok;
@ -222,7 +222,7 @@ reload_module(Host, Module, NewOpts, OldOpts, Order) ->
erlang:raise(Class, Reason, StackTrace) erlang:raise(Class, Reason, StackTrace)
end; end;
false -> false ->
?WARNING_MSG("Module ~s doesn't support reloading " ?WARNING_MSG("Module ~ts doesn't support reloading "
"and will be restarted", [Module]), "and will be restarted", [Module]),
stop_module(Host, Module), stop_module(Host, Module),
start_module(Host, Module, NewOpts, Order) start_module(Host, Module, NewOpts, Order)
@ -284,14 +284,14 @@ stop_module(Host, Module) ->
-spec stop_module_keep_config(binary(), atom()) -> error | ok. -spec stop_module_keep_config(binary(), atom()) -> error | ok.
stop_module_keep_config(Host, Module) -> stop_module_keep_config(Host, Module) ->
?DEBUG("Stopping ~s at ~s", [Module, Host]), ?DEBUG("Stopping ~ts at ~ts", [Module, Host]),
try Module:stop(Host) of try Module:stop(Host) of
_ -> _ ->
ets:delete(ejabberd_modules, {Module, Host}), ets:delete(ejabberd_modules, {Module, Host}),
ok ok
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to stop module ~s at ~s:~n** ~s", ?ERROR_MSG("Failed to stop module ~ts at ~ts:~n** ~ts",
[Module, Host, [Module, Host,
misc:format_exception(2, Class, Reason, StackTrace)]), misc:format_exception(2, Class, Reason, StackTrace)]),
error error
@ -429,19 +429,19 @@ is_equal_opt(Opt, NewOpts, OldOpts) ->
format_module_error(Module, Fun, Arity, Opts, Class, Reason, St) -> format_module_error(Module, Fun, Arity, Opts, Class, Reason, St) ->
case {Class, Reason} of case {Class, Reason} of
{error, {bad_return, Module, {error, _} = Err}} -> {error, {bad_return, Module, {error, _} = Err}} ->
io_lib:format("Failed to ~s module ~s: ~s", io_lib:format("Failed to ~ts module ~ts: ~ts",
[Fun, Module, misc:format_val(Err)]); [Fun, Module, misc:format_val(Err)]);
{error, {bad_return, Module, Ret}} -> {error, {bad_return, Module, Ret}} ->
io_lib:format("Module ~s returned unexpected value from ~s/~B:~n" io_lib:format("Module ~ts returned unexpected value from ~ts/~B:~n"
"** Error: ~p~n" "** Error: ~p~n"
"** Hint: this is either not an ejabberd module " "** Hint: this is either not an ejabberd module "
"or it implements ejabberd API incorrectly", "or it implements ejabberd API incorrectly",
[Module, Fun, Arity, Ret]); [Module, Fun, Arity, Ret]);
_ -> _ ->
io_lib:format("Internal error of module ~s has " io_lib:format("Internal error of module ~ts has "
"occurred during ~s:~n" "occurred during ~ts:~n"
"** Options: ~p~n" "** Options: ~p~n"
"** ~s", "** ~ts",
[Module, Fun, Opts, [Module, Fun, Opts,
misc:format_exception(2, Class, Reason, St)]) misc:format_exception(2, Class, Reason, St)])
end. end.
@ -573,13 +573,13 @@ sort_modules(Host, ModOpts) ->
-spec warn_soft_dep_fail(module(), module()) -> ok. -spec warn_soft_dep_fail(module(), module()) -> ok.
warn_soft_dep_fail(DepMod, Mod) -> warn_soft_dep_fail(DepMod, Mod) ->
?WARNING_MSG("Module ~s is recommended for module " ?WARNING_MSG("Module ~ts is recommended for module "
"~s but is not found in the config", "~ts but is not found in the config",
[DepMod, Mod]). [DepMod, Mod]).
-spec warn_cyclic_dep([module()]) -> ok. -spec warn_cyclic_dep([module()]) -> ok.
warn_cyclic_dep(Path) -> warn_cyclic_dep(Path) ->
?WARNING_MSG("Cyclic dependency detected between modules ~s. " ?WARNING_MSG("Cyclic dependency detected between modules ~ts. "
"This is either a bug, or the modules are not " "This is either a bug, or the modules are not "
"supposed to work together in this configuration. " "supposed to work together in this configuration. "
"The modules will still be loaded though", "The modules will still be loaded though",

View File

@ -50,24 +50,24 @@ import_file(File) ->
El when is_record(El, xmlel) -> El when is_record(El, xmlel) ->
case catch process_xdb(User, Server, El) of case catch process_xdb(User, Server, El) of
{'EXIT', Reason} -> {'EXIT', Reason} ->
?ERROR_MSG("Error while processing file \"~s\": " ?ERROR_MSG("Error while processing file \"~ts\": "
"~p~n", "~p~n",
[File, Reason]), [File, Reason]),
{error, Reason}; {error, Reason};
_ -> ok _ -> ok
end; end;
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Can't parse file \"~s\": ~p~n", ?ERROR_MSG("Can't parse file \"~ts\": ~p~n",
[File, Reason]), [File, Reason]),
{error, Reason} {error, Reason}
end; end;
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Can't read file \"~s\": ~p~n", ?ERROR_MSG("Can't read file \"~ts\": ~p~n",
[File, Reason]), [File, Reason]),
{error, Reason} {error, Reason}
end; end;
false -> false ->
?ERROR_MSG("Illegal user/server name in file \"~s\"~n", ?ERROR_MSG("Illegal user/server name in file \"~ts\"~n",
[File]), [File]),
{error, <<"illegal user/server">>} {error, <<"illegal user/server">>}
end. end.
@ -144,7 +144,7 @@ xdb_data(User, Server, #xmlel{attrs = Attrs} = El) ->
From, From,
[{XMLNS, El#xmlel{attrs = NewAttrs}}]); [{XMLNS, El#xmlel{attrs = NewAttrs}}]);
_ -> _ ->
?DEBUG("Unknown namespace \"~s\"~n", [XMLNS]) ?DEBUG("Unknown namespace \"~ts\"~n", [XMLNS])
end, end,
ok ok
end. end.
@ -166,7 +166,7 @@ process_offline(Server, To, #xmlel{children = Els}) ->
ok ok
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
Txt = xmpp:format_error(Why), Txt = xmpp:format_error(Why),
?ERROR_MSG("Failed to decode XML '~s': ~s", ?ERROR_MSG("Failed to decode XML '~ts': ~ts",
[fxml:element_to_binary(El), Txt]) [fxml:element_to_binary(El), Txt])
end end
end, Els). end, Els).

View File

@ -315,7 +315,7 @@ try_read_file(Path) ->
file:close(Fd), file:close(Fd),
iolist_to_binary(Path); iolist_to_binary(Path);
{error, Why} -> {error, Why} ->
?ERROR_MSG("Failed to read ~s: ~s", [Path, file:format_error(Why)]), ?ERROR_MSG("Failed to read ~ts: ~ts", [Path, file:format_error(Why)]),
erlang:error(badarg) erlang:error(badarg)
end. end.
@ -330,15 +330,15 @@ try_url(URL0) ->
end, end,
case http_uri:parse(URL) of case http_uri:parse(URL) of
{ok, {Scheme, _, _, _, _, _}} when Scheme /= http, Scheme /= https -> {ok, {Scheme, _, _, _, _, _}} when Scheme /= http, Scheme /= https ->
?ERROR_MSG("Unsupported URI scheme: ~s", [URL]), ?ERROR_MSG("Unsupported URI scheme: ~ts", [URL]),
erlang:error(badarg); erlang:error(badarg);
{ok, {_, _, Host, _, _, _}} when Host == ""; Host == <<"">> -> {ok, {_, _, Host, _, _, _}} when Host == ""; Host == <<"">> ->
?ERROR_MSG("Invalid URL: ~s", [URL]), ?ERROR_MSG("Invalid URL: ~ts", [URL]),
erlang:error(badarg); erlang:error(badarg);
{ok, _} -> {ok, _} ->
iolist_to_binary(URL); iolist_to_binary(URL);
{error, _} -> {error, _} ->
?ERROR_MSG("Invalid URL: ~s", [URL]), ?ERROR_MSG("Invalid URL: ~ts", [URL]),
erlang:error(badarg) erlang:error(badarg)
end. end.
@ -555,7 +555,7 @@ format_hosts_list([H1, H2]) ->
format_hosts_list([H1, H2, H3]) -> format_hosts_list([H1, H2, H3]) ->
[H1, ", ", H2, " and ", H3]; [H1, ", ", H2, " and ", H3];
format_hosts_list([H1, H2|Hs]) -> format_hosts_list([H1, H2|Hs]) ->
io_lib:format("~s, ~s and ~B more hosts", io_lib:format("~ts, ~ts and ~B more hosts",
[H1, H2, length(Hs)]). [H1, H2, length(Hs)]).
-spec format_cycle([atom(), ...]) -> iolist(). -spec format_cycle([atom(), ...]) -> iolist().
@ -621,7 +621,7 @@ read_file(Path) ->
{ok, Data} -> {ok, Data} ->
{ok, Data}; {ok, Data};
{error, Why} = Err -> {error, Why} = Err ->
?ERROR_MSG("Failed to read file ~s: ~s", ?ERROR_MSG("Failed to read file ~ts: ~ts",
[Path, file:format_error(Why)]), [Path, file:format_error(Why)]),
Err Err
end. end.

View File

@ -1504,13 +1504,13 @@ send_stanza(FromString, ToString, Stanza) ->
Pkt = xmpp:decode(El, ?NS_CLIENT, CodecOpts), Pkt = xmpp:decode(El, ?NS_CLIENT, CodecOpts),
ejabberd_router:route(xmpp:set_from_to(Pkt, From, To)) ejabberd_router:route(xmpp:set_from_to(Pkt, From, To))
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
io:format("incorrect stanza: ~s~n", [xmpp:format_error(Why)]), io:format("incorrect stanza: ~ts~n", [xmpp:format_error(Why)]),
{error, Why}; {error, Why};
_:{badmatch, {error, Why}} -> _:{badmatch, {error, Why}} ->
io:format("invalid xml: ~p~n", [Why]), io:format("invalid xml: ~p~n", [Why]),
{error, Why}; {error, Why};
_:{bad_jid, S} -> _:{bad_jid, S} ->
io:format("malformed JID: ~s~n", [S]), io:format("malformed JID: ~ts~n", [S]),
{error, "JID malformed"} {error, "JID malformed"}
end. end.
@ -1530,7 +1530,7 @@ send_stanza_c2s(Username, Host, Resource, Stanza) ->
io:format("invalid xml: ~p~n", [Why]), io:format("invalid xml: ~p~n", [Why]),
Err; Err;
_:{xmpp_codec, Why} -> _:{xmpp_codec, Why} ->
io:format("incorrect stanza: ~s~n", [xmpp:format_error(Why)]), io:format("incorrect stanza: ~ts~n", [xmpp:format_error(Why)]),
{error, Why} {error, Why}
end. end.

View File

@ -348,7 +348,7 @@ create_index(#state{dbtype = mysql} = State, Table, Index, Cols) ->
SCols, ");"]). SCols, ");"]).
sql_query(Host, Query) -> sql_query(Host, Query) ->
io:format("executing \"~s\" on ~s~n", [Query, Host]), io:format("executing \"~ts\" on ~ts~n", [Query, Host]),
case ejabberd_sql:sql_query(Host, Query) of case ejabberd_sql:sql_query(Host, Query) of
{error, Error} -> {error, Error} ->
io:format("error: ~p~n", [Error]), io:format("error: ~p~n", [Error]),

View File

@ -724,7 +724,7 @@ send_motd({#presence{type = available},
ok ok
end end
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode motd packet ~p: ~s", ?ERROR_MSG("Failed to decode motd packet ~p: ~ts",
[Packet, xmpp:format_error(Why)]) [Packet, xmpp:format_error(Why)])
end; end;
_ -> _ ->
@ -808,7 +808,7 @@ get_stored_motd(LServer) ->
#message{body = Body, subject = Subject} -> #message{body = Body, subject = Subject} ->
{xmpp:get_text(Subject), xmpp:get_text(Body)} {xmpp:get_text(Subject), xmpp:get_text(Body)}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode motd packet ~p: ~s", ?ERROR_MSG("Failed to decode motd packet ~p: ~ts",
[Packet, xmpp:format_error(Why)]) [Packet, xmpp:format_error(Why)])
end; end;
_ -> _ ->

View File

@ -155,6 +155,6 @@ parse_element(XML) ->
{ok, El}; {ok, El};
_ -> _ ->
?ERROR_MSG("Malformed XML element in SQL table " ?ERROR_MSG("Malformed XML element in SQL table "
"'motd' for username='': ~s", [XML]), "'motd' for username='': ~ts", [XML]),
{error, db_failure} {error, db_failure}
end. end.

View File

@ -96,11 +96,11 @@ pubsub_publish_item(LServer, ?NS_AVATAR_METADATA,
set_vcard_avatar(From, Photo, #{}) set_vcard_avatar(From, Photo, #{})
end; end;
_ -> _ ->
?WARNING_MSG("Invalid avatar metadata of ~s@~s published " ?WARNING_MSG("Invalid avatar metadata of ~ts@~ts published "
"with item id ~s", "with item id ~ts",
[LUser, LServer, ItemId]) [LUser, LServer, ItemId])
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("Failed to decode avatar metadata of ~s@~s: ~s", ?WARNING_MSG("Failed to decode avatar metadata of ~ts@~ts: ~ts",
[LUser, LServer, xmpp:format_error(Why)]) [LUser, LServer, xmpp:format_error(Why)])
end; end;
pubsub_publish_item(_, _, _, _, _, _) -> pubsub_publish_item(_, _, _, _, _, _) ->
@ -210,26 +210,26 @@ get_avatar_data(JID, ItemID) ->
{ok, Data}; {ok, Data};
_ -> _ ->
?WARNING_MSG("Invalid avatar data detected " ?WARNING_MSG("Invalid avatar data detected "
"for ~s@~s with item id ~s", "for ~ts@~ts with item id ~ts",
[LUser, LServer, ItemID]), [LUser, LServer, ItemID]),
{error, invalid_data} {error, invalid_data}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("Failed to decode avatar data for " ?WARNING_MSG("Failed to decode avatar data for "
"~s@~s with item id ~s: ~s", "~ts@~ts with item id ~ts: ~ts",
[LUser, LServer, ItemID, [LUser, LServer, ItemID,
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
{error, invalid_data} {error, invalid_data}
end; end;
#pubsub_item{payload = []} -> #pubsub_item{payload = []} ->
?WARNING_MSG("Empty avatar data detected " ?WARNING_MSG("Empty avatar data detected "
"for ~s@~s with item id ~s", "for ~ts@~ts with item id ~ts",
[LUser, LServer, ItemID]), [LUser, LServer, ItemID]),
{error, invalid_data}; {error, invalid_data};
{error, #stanza_error{reason = 'item-not-found'}} -> {error, #stanza_error{reason = 'item-not-found'}} ->
{error, notfound}; {error, notfound};
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("Failed to get item for ~s@~s at node ~s " ?WARNING_MSG("Failed to get item for ~ts@~ts at node ~ts "
"with item id ~s: ~p", "with item id ~ts: ~p",
[LUser, LServer, ?NS_AVATAR_METADATA, ItemID, Reason]), [LUser, LServer, ?NS_AVATAR_METADATA, ItemID, Reason]),
{error, internal_error} {error, internal_error}
end. end.
@ -248,12 +248,12 @@ get_avatar_meta(#iq{from = JID}) ->
{ok, ItemID, Meta}; {ok, ItemID, Meta};
_ -> _ ->
?WARNING_MSG("Invalid metadata payload detected " ?WARNING_MSG("Invalid metadata payload detected "
"for ~s@~s with item id ~s", "for ~ts@~ts with item id ~ts",
[LUser, LServer, ItemID]), [LUser, LServer, ItemID]),
{error, invalid_metadata} {error, invalid_metadata}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?WARNING_MSG("Failed to decode metadata for " ?WARNING_MSG("Failed to decode metadata for "
"~s@~s with item id ~s: ~s", "~ts@~ts with item id ~ts: ~ts",
[LUser, LServer, ItemID, [LUser, LServer, ItemID,
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
{error, invalid_metadata} {error, invalid_metadata}
@ -261,7 +261,7 @@ get_avatar_meta(#iq{from = JID}) ->
{error, #stanza_error{reason = 'item-not-found'}} -> {error, #stanza_error{reason = 'item-not-found'}} ->
{error, notfound}; {error, notfound};
{error, Reason} -> {error, Reason} ->
?WARNING_MSG("Failed to get items for ~s@~s at node ~s: ~p", ?WARNING_MSG("Failed to get items for ~ts@~ts at node ~ts: ~p",
[LUser, LServer, ?NS_AVATAR_METADATA, Reason]), [LUser, LServer, ?NS_AVATAR_METADATA, Reason]),
{error, internal_error} {error, internal_error}
end. end.
@ -305,16 +305,16 @@ publish_avatar(#iq{from = JID} = IQ, Meta, MimeType, Data, ItemID) ->
{result, _} -> {result, _} ->
IQ; IQ;
{error, StanzaErr} -> {error, StanzaErr} ->
?ERROR_MSG("Failed to publish avatar metadata for ~s: ~p", ?ERROR_MSG("Failed to publish avatar metadata for ~ts: ~p",
[jid:encode(JID), StanzaErr]), [jid:encode(JID), StanzaErr]),
{stop, StanzaErr} {stop, StanzaErr}
end; end;
{error, #stanza_error{reason = 'not-acceptable'} = StanzaErr} -> {error, #stanza_error{reason = 'not-acceptable'} = StanzaErr} ->
?WARNING_MSG("Failed to publish avatar data for ~s: ~p", ?WARNING_MSG("Failed to publish avatar data for ~ts: ~p",
[jid:encode(JID), StanzaErr]), [jid:encode(JID), StanzaErr]),
{stop, StanzaErr}; {stop, StanzaErr};
{error, StanzaErr} -> {error, StanzaErr} ->
?ERROR_MSG("Failed to publish avatar data for ~s: ~p", ?ERROR_MSG("Failed to publish avatar data for ~ts: ~p",
[jid:encode(JID), StanzaErr]), [jid:encode(JID), StanzaErr]),
{stop, StanzaErr} {stop, StanzaErr}
end. end.
@ -346,7 +346,7 @@ convert_avatar(LUser, LServer, Data, Rules) ->
if NewType == undefined -> if NewType == undefined ->
pass; pass;
true -> true ->
?DEBUG("Converting avatar of ~s@~s: ~s -> ~s", ?DEBUG("Converting avatar of ~ts@~ts: ~ts -> ~ts",
[LUser, LServer, Type, NewType]), [LUser, LServer, Type, NewType]),
RateLimit = mod_avatar_opt:rate_limit(LServer), RateLimit = mod_avatar_opt:rate_limit(LServer),
Opts = [{limit_by, {LUser, LServer}}, Opts = [{limit_by, {LUser, LServer}},
@ -356,7 +356,7 @@ convert_avatar(LUser, LServer, Data, Rules) ->
{ok, encode_mime_type(NewType), NewData}; {ok, encode_mime_type(NewType), NewData};
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Failed to convert avatar of " ?ERROR_MSG("Failed to convert avatar of "
"~s@~s (~s -> ~s): ~s", "~ts@~ts (~ts -> ~ts): ~ts",
[LUser, LServer, Type, NewType, [LUser, LServer, Type, NewType,
eimp:format_error(Reason)]), eimp:format_error(Reason)]),
Err Err
@ -393,11 +393,11 @@ get_vcard(#jid{luser = LUser, lserver = LServer}) ->
#vcard_temp{} = VCard -> #vcard_temp{} = VCard ->
{ok, VCard}; {ok, VCard};
_ -> _ ->
?ERROR_MSG("Invalid vCard of ~s@~s in the database", ?ERROR_MSG("Invalid vCard of ~ts@~ts in the database",
[LUser, LServer]), [LUser, LServer]),
{error, invalid_vcard} {error, invalid_vcard}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode vCard of ~s@~s: ~s", ?ERROR_MSG("Failed to decode vCard of ~ts@~ts: ~ts",
[LUser, LServer, xmpp:format_error(Why)]), [LUser, LServer, xmpp:format_error(Why)]),
{error, invalid_vcard} {error, invalid_vcard}
end. end.

View File

@ -116,7 +116,7 @@ filter_subscription(Acc, #presence{from = From, to = To, lang = Lang,
case mod_block_strangers_opt:log(LServer) of case mod_block_strangers_opt:log(LServer) of
true -> true ->
?INFO_MSG("Challenge subscription request " ?INFO_MSG("Challenge subscription request "
"from stranger ~s to ~s with " "from stranger ~ts to ~ts with "
"CAPTCHA", "CAPTCHA",
[jid:encode(From), jid:encode(To)]); [jid:encode(From), jid:encode(To)]);
false -> false ->
@ -164,7 +164,7 @@ check_message(#message{from = From, to = To, lang = Lang} = Msg) ->
Log = mod_block_strangers_opt:log(LServer), Log = mod_block_strangers_opt:log(LServer),
if if
Log -> Log ->
?INFO_MSG("~s message from stranger ~s to ~s", ?INFO_MSG("~ts message from stranger ~ts to ~ts",
[if Drop -> "Rejecting"; [if Drop -> "Rejecting";
true -> "Allow" true -> "Allow"
end, end,

View File

@ -166,7 +166,7 @@ process_block(#iq{from = From} = IQ, LJIDs) ->
broadcast_event(From, #block{items = Items}), broadcast_event(From, #block{items = Items}),
xmpp:make_iq_result(IQ); xmpp:make_iq_result(IQ);
{error, notfound} -> {error, notfound} ->
?ERROR_MSG("Failed to set default list '~s': " ?ERROR_MSG("Failed to set default list '~ts': "
"the list should exist, but not found", "the list should exist, but not found",
[Name]), [Name]),
err_db_failure(IQ); err_db_failure(IQ);

View File

@ -89,7 +89,7 @@ find_session(SID) ->
try try
{ok, binary_to_term(Pid)} {ok, binary_to_term(Pid)}
catch _:badarg -> catch _:badarg ->
?ERROR_MSG("Malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~ts'): ~p",
[SID, Pid]), [SID, Pid]),
{error, db_failure} {error, db_failure}
end; end;

View File

@ -241,23 +241,23 @@ build_forward_packet(JID, #message{type = T} = Msg, Sender, Dest, Direction) ->
-spec enable(binary(), binary(), binary(), binary()) -> ok | {error, any()}. -spec enable(binary(), binary(), binary(), binary()) -> ok | {error, any()}.
enable(Host, U, R, CC)-> enable(Host, U, R, CC)->
?DEBUG("Enabling carbons for ~s@~s/~s", [U, Host, R]), ?DEBUG("Enabling carbons for ~ts@~ts/~ts", [U, Host, R]),
case ejabberd_sm:set_user_info(U, Host, R, carboncopy, CC) of case ejabberd_sm:set_user_info(U, Host, R, carboncopy, CC) of
ok -> ok; ok -> ok;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Failed to enable carbons for ~s@~s/~s: ~p", ?ERROR_MSG("Failed to enable carbons for ~ts@~ts/~ts: ~p",
[U, Host, R, Reason]), [U, Host, R, Reason]),
Err Err
end. end.
-spec disable(binary(), binary(), binary()) -> ok | {error, any()}. -spec disable(binary(), binary(), binary()) -> ok | {error, any()}.
disable(Host, U, R)-> disable(Host, U, R)->
?DEBUG("Disabling carbons for ~s@~s/~s", [U, Host, R]), ?DEBUG("Disabling carbons for ~ts@~ts/~ts", [U, Host, R]),
case ejabberd_sm:del_user_info(U, Host, R, carboncopy) of case ejabberd_sm:del_user_info(U, Host, R, carboncopy) of
ok -> ok; ok -> ok;
{error, notfound} -> ok; {error, notfound} -> ok;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Failed to disable carbons for ~s@~s/~s: ~p", ?ERROR_MSG("Failed to disable carbons for ~ts@~ts/~ts: ~p",
[U, Host, R, Reason]), [U, Host, R, Reason]),
Err Err
end. end.

View File

@ -227,7 +227,7 @@ filter_presence({#presence{meta = #{csi_resend := true}}, _} = Acc) ->
filter_presence({#presence{to = To, type = Type} = Pres, filter_presence({#presence{to = To, type = Type} = Pres,
#{csi_state := inactive} = C2SState}) #{csi_state := inactive} = C2SState})
when Type == available; Type == unavailable -> when Type == available; Type == unavailable ->
?DEBUG("Got availability presence stanza for ~s", [jid:encode(To)]), ?DEBUG("Got availability presence stanza for ~ts", [jid:encode(To)]),
enqueue_stanza(presence, Pres, C2SState); enqueue_stanza(presence, Pres, C2SState);
filter_presence(Acc) -> filter_presence(Acc) ->
Acc. Acc.
@ -246,7 +246,7 @@ filter_chat_states({#message{from = From, to = To} = Msg,
%% conversations across clients. %% conversations across clients.
Acc; Acc;
_ -> _ ->
?DEBUG("Got standalone chat state notification for ~s", ?DEBUG("Got standalone chat state notification for ~ts",
[jid:encode(To)]), [jid:encode(To)]),
enqueue_stanza(chatstate, Msg, C2SState) enqueue_stanza(chatstate, Msg, C2SState)
end; end;
@ -265,7 +265,7 @@ filter_pep({#message{to = To} = Msg,
undefined -> undefined ->
Acc; Acc;
Node -> Node ->
?DEBUG("Got PEP notification for ~s", [jid:encode(To)]), ?DEBUG("Got PEP notification for ~ts", [jid:encode(To)]),
enqueue_stanza({pep, Node}, Msg, C2SState) enqueue_stanza({pep, Node}, Msg, C2SState)
end; end;
filter_pep(Acc) -> filter_pep(Acc) ->
@ -277,7 +277,7 @@ filter_other({Stanza, #{jid := JID} = C2SState} = Acc) when ?is_stanza(Stanza) -
#{csi_resend := true} -> #{csi_resend := true} ->
Acc; Acc;
_ -> _ ->
?DEBUG("Won't add stanza for ~s to CSI queue", [jid:encode(JID)]), ?DEBUG("Won't add stanza for ~ts to CSI queue", [jid:encode(JID)]),
From = case xmpp:get_from(Stanza) of From = case xmpp:get_from(Stanza) of
undefined -> JID; undefined -> JID;
F -> F F -> F
@ -328,7 +328,7 @@ dequeue_sender(#jid{luser = U, lserver = S} = Sender,
%% This may happen when the module is (re)loaded in runtime %% This may happen when the module is (re)loaded in runtime
init_csi_state(C2SState); init_csi_state(C2SState);
Q -> Q ->
?DEBUG("Flushing packets of ~s@~s from CSI queue of ~s", ?DEBUG("Flushing packets of ~ts@~ts from CSI queue of ~ts",
[U, S, jid:encode(JID)]), [U, S, jid:encode(JID)]),
{Elems, Q1} = queue_take(Sender, Q), {Elems, Q1} = queue_take(Sender, Q),
C2SState1 = flush_stanzas(C2SState, Elems), C2SState1 = flush_stanzas(C2SState, Elems),
@ -337,7 +337,7 @@ dequeue_sender(#jid{luser = U, lserver = S} = Sender,
-spec flush_queue(c2s_state()) -> c2s_state(). -spec flush_queue(c2s_state()) -> c2s_state().
flush_queue(#{csi_queue := Q, jid := JID} = C2SState) -> flush_queue(#{csi_queue := Q, jid := JID} = C2SState) ->
?DEBUG("Flushing CSI queue of ~s", [jid:encode(JID)]), ?DEBUG("Flushing CSI queue of ~ts", [jid:encode(JID)]),
C2SState1 = flush_stanzas(C2SState, queue_to_list(Q)), C2SState1 = flush_stanzas(C2SState, queue_to_list(Q)),
C2SState1#{csi_queue => queue_new()}. C2SState1#{csi_queue => queue_new()}.

View File

@ -663,7 +663,7 @@ get_outgoing_s2s(Host, Lang) ->
Host == FH orelse str:suffix(DotHost, FH)], Host == FH orelse str:suffix(DotHost, FH)],
lists:map( lists:map(
fun (T) -> fun (T) ->
Name = str:format(tr(Lang, ?T("To ~s")),[T]), Name = str:format(tr(Lang, ?T("To ~ts")),[T]),
#disco_item{jid = jid:make(Host), #disco_item{jid = jid:make(Host),
node = <<"outgoing s2s/", T/binary>>, node = <<"outgoing s2s/", T/binary>>,
name = Name} name = Name}
@ -675,7 +675,7 @@ get_outgoing_s2s(Host, Lang, To) ->
lists:map( lists:map(
fun ({F, _T}) -> fun ({F, _T}) ->
Node = <<"outgoing s2s/", To/binary, "/", F/binary>>, Node = <<"outgoing s2s/", To/binary, "/", F/binary>>,
Name = str:format(tr(Lang, ?T("From ~s")), [F]), Name = str:format(tr(Lang, ?T("From ~ts")), [F]),
#disco_item{jid = jid:make(Host), node = Node, name = Name} #disco_item{jid = jid:make(Host), node = Node, name = Name}
end, end,
lists:keysort( lists:keysort(
@ -821,7 +821,7 @@ get_form(_Host, [<<"running nodes">>, ENode, <<"DB">>],
case ejabberd_cluster:call(Node, mnesia, system_info, [tables]) of case ejabberd_cluster:call(Node, mnesia, system_info, [tables]) of
{badrpc, Reason} -> {badrpc, Reason} ->
?ERROR_MSG("RPC call mnesia:system_info(tables) on node " ?ERROR_MSG("RPC call mnesia:system_info(tables) on node "
"~s failed: ~p", [Node, Reason]), "~ts failed: ~p", [Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
Tables -> Tables ->
STables = lists:sort(Tables), STables = lists:sort(Tables),
@ -844,7 +844,7 @@ get_form(_Host, [<<"running nodes">>, ENode, <<"DB">>],
fields = [?HFIELD()|Fs]}} fields = [?HFIELD()|Fs]}}
catch _:{case_clause, {badrpc, Reason}} -> catch _:{case_clause, {badrpc, Reason}} ->
?ERROR_MSG("RPC call mnesia:table_info/2 " ?ERROR_MSG("RPC call mnesia:table_info/2 "
"on node ~s failed: ~p", [Node, Reason]), "on node ~ts failed: ~p", [Node, Reason]),
{error, xmpp:err_internal_server_error()} {error, xmpp:err_internal_server_error()}
end end
end end
@ -1139,11 +1139,11 @@ set_form(_From, _Host,
Node, mnesia, backup, [binary_to_list(String)], Node, mnesia, backup, [binary_to_list(String)],
timer:minutes(10)) of timer:minutes(10)) of
{badrpc, Reason} -> {badrpc, Reason} ->
?ERROR_MSG("RPC call mnesia:backup(~s) to node ~s " ?ERROR_MSG("RPC call mnesia:backup(~ts) to node ~ts "
"failed: ~p", [String, Node, Reason]), "failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("RPC call mnesia:backup(~s) to node ~s " ?ERROR_MSG("RPC call mnesia:backup(~ts) to node ~ts "
"failed: ~p", [String, Node, Reason]), "failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
_ -> _ ->
@ -1172,12 +1172,12 @@ set_form(_From, _Host,
Node, ejabberd_admin, restore, Node, ejabberd_admin, restore,
[String], timer:minutes(10)) of [String], timer:minutes(10)) of
{badrpc, Reason} -> {badrpc, Reason} ->
?ERROR_MSG("RPC call ejabberd_admin:restore(~s) to node " ?ERROR_MSG("RPC call ejabberd_admin:restore(~ts) to node "
"~s failed: ~p", [String, Node, Reason]), "~ts failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("RPC call ejabberd_admin:restore(~s) to node " ?ERROR_MSG("RPC call ejabberd_admin:restore(~ts) to node "
"~s failed: ~p", [String, Node, Reason]), "~ts failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
_ -> _ ->
{result, undefined} {result, undefined}
@ -1205,12 +1205,12 @@ set_form(_From, _Host,
Node, ejabberd_admin, dump_to_textfile, Node, ejabberd_admin, dump_to_textfile,
[String], timer:minutes(10)) of [String], timer:minutes(10)) of
{badrpc, Reason} -> {badrpc, Reason} ->
?ERROR_MSG("RPC call ejabberd_admin:dump_to_textfile(~s) " ?ERROR_MSG("RPC call ejabberd_admin:dump_to_textfile(~ts) "
"to node ~s failed: ~p", [String, Node, Reason]), "to node ~ts failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("RPC call ejabberd_admin:dump_to_textfile(~s) " ?ERROR_MSG("RPC call ejabberd_admin:dump_to_textfile(~ts) "
"to node ~s failed: ~p", [String, Node, Reason]), "to node ~ts failed: ~p", [String, Node, Reason]),
{error, xmpp:err_internal_server_error()}; {error, xmpp:err_internal_server_error()};
_ -> _ ->
{result, undefined} {result, undefined}

View File

@ -168,7 +168,7 @@ handle_cast({component_connected, Host}, State) ->
allow -> allow ->
send_disco_queries(ServerHost, Host, NS); send_disco_queries(ServerHost, Host, NS);
deny -> deny ->
?DEBUG("Denied delegation for ~s on ~s", [Host, NS]) ?DEBUG("Denied delegation for ~ts on ~ts", [Host, NS])
end end
end, NSAttrsAccessList), end, NSAttrsAccessList),
{noreply, State}; {noreply, State};
@ -177,8 +177,8 @@ handle_cast({component_disconnected, Host}, State) ->
Delegations = Delegations =
maps:filter( maps:filter(
fun({NS, Type}, {H, _}) when H == Host -> fun({NS, Type}, {H, _}) when H == Host ->
?INFO_MSG("Remove delegation of namespace '~s' " ?INFO_MSG("Remove delegation of namespace '~ts' "
"from external component '~s'", "from external component '~ts'",
[NS, Host]), [NS, Host]),
gen_iq_handler:remove_iq_handler(Type, ServerHost, NS), gen_iq_handler:remove_iq_handler(Type, ServerHost, NS),
false; false;
@ -293,7 +293,7 @@ process_iq_result(#iq{from = From, to = To, id = ID, lang = Lang} = IQ,
end end
catch _:_ -> catch _:_ ->
?ERROR_MSG("Got iq-result with invalid delegated " ?ERROR_MSG("Got iq-result with invalid delegated "
"payload:~n~s", [xmpp:pp(ResIQ)]), "payload:~n~ts", [xmpp:pp(ResIQ)]),
Txt = ?T("External component failure"), Txt = ?T("External component failure"),
Err = xmpp:err_internal_server_error(Txt, Lang), Err = xmpp:err_internal_server_error(Txt, Lang),
ejabberd_router:route_error(IQ, Err) ejabberd_router:route_error(IQ, Err)
@ -320,12 +320,12 @@ process_disco_info(ServerHost, Type, Host, NS, Info) ->
gen_iq_handler:add_iq_handler(Type, ServerHost, NS, ?MODULE, Type), gen_iq_handler:add_iq_handler(Type, ServerHost, NS, ?MODULE, Type),
ejabberd_router:route(Msg), ejabberd_router:route(Msg),
set_delegations(ServerHost, Delegations1), set_delegations(ServerHost, Delegations1),
?INFO_MSG("Namespace '~s' is delegated to external component '~s'", ?INFO_MSG("Namespace '~ts' is delegated to external component '~ts'",
[NS, Host]); [NS, Host]);
{ok, {AnotherHost, _}} -> {ok, {AnotherHost, _}} ->
?WARNING_MSG("Failed to delegate namespace '~s' to " ?WARNING_MSG("Failed to delegate namespace '~ts' to "
"external component '~s' because it's already " "external component '~ts' because it's already "
"delegated to '~s'", "delegated to '~ts'",
[NS, Host, AnotherHost]) [NS, Host, AnotherHost])
end. end.

View File

@ -217,10 +217,10 @@ log_and_disconnect(#{ip := {Addr, _}, lang := Lang} = State, Attempts, UnbanTS)
UnbanDate = format_date( UnbanDate = format_date(
calendar:now_to_universal_time(msec_to_now(UnbanTS))), calendar:now_to_universal_time(msec_to_now(UnbanTS))),
Format = ?T("Too many (~p) failed authentications " Format = ?T("Too many (~p) failed authentications "
"from this IP address (~s). The address " "from this IP address (~ts). The address "
"will be unblocked at ~s UTC"), "will be unblocked at ~ts UTC"),
Args = [Attempts, IP, UnbanDate], Args = [Attempts, IP, UnbanDate],
?WARNING_MSG("Connection attempt from blacklisted IP ~s: ~s", ?WARNING_MSG("Connection attempt from blacklisted IP ~ts: ~ts",
[IP, io_lib:fwrite(Format, Args)]), [IP, io_lib:fwrite(Format, Args)]),
Err = xmpp:serr_policy_violation({Format, Args}, Lang), Err = xmpp:serr_policy_violation({Format, Args}, Lang),
{stop, ejabberd_c2s:send(State, Err)}. {stop, ejabberd_c2s:send(State, Err)}.

View File

@ -255,7 +255,7 @@ handle(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
?EX_RULE(Class, Error, Stack) -> ?EX_RULE(Class, Error, Stack) ->
StackTrace = ?EX_STACK(Stack), StackTrace = ?EX_STACK(Stack),
?ERROR_MSG("REST API Error: " ?ERROR_MSG("REST API Error: "
"~s(~p) -> ~p:~p ~p", "~ts(~p) -> ~p:~p ~p",
[Call, hide_sensitive_args(Args), [Call, hide_sensitive_args(Args),
Class, Error, StackTrace]), Class, Error, StackTrace]),
{500, <<"internal_error">>} {500, <<"internal_error">>}
@ -286,7 +286,7 @@ get_elem_delete(Call, A, L, F) ->
case proplists:get_all_values(A, L) of case proplists:get_all_values(A, L) of
[Value] -> {Value, proplists:delete(A, L)}; [Value] -> {Value, proplists:delete(A, L)};
[_, _ | _] -> [_, _ | _] ->
?INFO_MSG("Command ~s call rejected, it has duplicate attribute ~w", ?INFO_MSG("Command ~ts call rejected, it has duplicate attribute ~w",
[Call, A]), [Call, A]),
throw({invalid_parameter, throw({invalid_parameter,
io_lib:format("Request have duplicate argument: ~w", [A])}); io_lib:format("Request have duplicate argument: ~w", [A])});
@ -295,7 +295,7 @@ get_elem_delete(Call, A, L, F) ->
{list, _} -> {list, _} ->
{[], L}; {[], L};
_ -> _ ->
?INFO_MSG("Command ~s call rejected, missing attribute ~w", ?INFO_MSG("Command ~ts call rejected, missing attribute ~w",
[Call, A]), [Call, A]),
throw({invalid_parameter, throw({invalid_parameter,
io_lib:format("Request have missing argument: ~w", [A])}) io_lib:format("Request have missing argument: ~w", [A])})
@ -318,7 +318,7 @@ format_args(Call, Args, ArgsFormat) ->
[] -> R; [] -> R;
L when is_list(L) -> L when is_list(L) ->
ExtraArgs = [N || {N, _} <- L], ExtraArgs = [N || {N, _} <- L],
?INFO_MSG("Command ~s call rejected, it has unknown arguments ~w", ?INFO_MSG("Command ~ts call rejected, it has unknown arguments ~w",
[Call, ExtraArgs]), [Call, ExtraArgs]),
throw({invalid_parameter, throw({invalid_parameter,
io_lib:format("Request have unknown arguments: ~w", [ExtraArgs])}) io_lib:format("Request have unknown arguments: ~w", [ExtraArgs])})
@ -506,9 +506,9 @@ json_error(HTTPCode, JSONCode, Message) ->
log(Call, Args, {Addr, Port}) -> log(Call, Args, {Addr, Port}) ->
AddrS = misc:ip_to_list({Addr, Port}), AddrS = misc:ip_to_list({Addr, Port}),
?INFO_MSG("API call ~s ~p from ~s:~p", [Call, hide_sensitive_args(Args), AddrS, Port]); ?INFO_MSG("API call ~ts ~p from ~ts:~p", [Call, hide_sensitive_args(Args), AddrS, Port]);
log(Call, Args, IP) -> log(Call, Args, IP) ->
?INFO_MSG("API call ~s ~p (~p)", [Call, hide_sensitive_args(Args), IP]). ?INFO_MSG("API call ~ts ~p (~p)", [Call, hide_sensitive_args(Args), IP]).
hide_sensitive_args(Args=[_H|_T]) -> hide_sensitive_args(Args=[_H|_T]) ->
lists:map( fun({<<"password">>, Password}) -> {<<"password">>, ejabberd_config:may_hide_data(Password)}; lists:map( fun({<<"password">>, Password}) -> {<<"password">>, ejabberd_config:may_hide_data(Password)};

View File

@ -137,7 +137,7 @@ initialize(Host, Opts) ->
ContentTypes = build_list_content_types( ContentTypes = build_list_content_types(
mod_http_fileserver_opt:content_types(Opts), mod_http_fileserver_opt:content_types(Opts),
?DEFAULT_CONTENT_TYPES), ?DEFAULT_CONTENT_TYPES),
?DEBUG("Known content types: ~s", ?DEBUG("Known content types: ~ts",
[str:join([[$*, K, " -> ", V] || {K, V} <- ContentTypes], [str:join([[$*, K, " -> ", V] || {K, V} <- ContentTypes],
<<", ">>)]), <<", ">>)]),
#state{host = Host, #state{host = Host,
@ -278,7 +278,7 @@ process(LocalPath, #request{host = Host, auth = Auth, headers = RHeaders} = Requ
add_to_log(FileSize, Code, Request#request{host = VHost}), add_to_log(FileSize, Code, Request#request{host = VHost}),
{Code, Headers, Contents} {Code, Headers, Contents}
catch _:{Why, _} when Why == noproc; Why == invalid_domain; Why == unregistered_route -> catch _:{Why, _} when Why == noproc; Why == invalid_domain; Why == unregistered_route ->
?DEBUG("Received an HTTP request with Host: ~s, " ?DEBUG("Received an HTTP request with Host: ~ts, "
"but couldn't find the related " "but couldn't find the related "
"ejabberd virtual host", [Host]), "ejabberd virtual host", [Host]),
{FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN, {FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN,
@ -342,7 +342,7 @@ serve_index(FileName, [Index | T], CH, DefaultContentType, ContentTypes) ->
end. end.
serve_not_modified(FileInfo, FileName, CustomHeaders) -> serve_not_modified(FileInfo, FileName, CustomHeaders) ->
?DEBUG("Delivering not modified: ~s", [FileName]), ?DEBUG("Delivering not modified: ~ts", [FileName]),
{0, 304, {0, 304,
[{<<"Server">>, <<"ejabberd">>}, [{<<"Server">>, <<"ejabberd">>},
{<<"Last-Modified">>, last_modified(FileInfo)} {<<"Last-Modified">>, last_modified(FileInfo)}
@ -351,7 +351,7 @@ serve_not_modified(FileInfo, FileName, CustomHeaders) ->
%% Assume the file exists if we got this far and attempt to read it in %% Assume the file exists if we got this far and attempt to read it in
%% and serve it up. %% and serve it up.
serve_file(FileInfo, FileName, CustomHeaders, DefaultContentType, ContentTypes) -> serve_file(FileInfo, FileName, CustomHeaders, DefaultContentType, ContentTypes) ->
?DEBUG("Delivering: ~s", [FileName]), ?DEBUG("Delivering: ~ts", [FileName]),
ContentType = content_type(FileName, DefaultContentType, ContentType = content_type(FileName, DefaultContentType,
ContentTypes), ContentTypes),
{FileInfo#file_info.size, 200, {FileInfo#file_info.size, 200,
@ -414,7 +414,7 @@ add_to_log(File, FileSize, Code, Request) ->
%% Missing time zone = (`+' | `-') 4*digit %% Missing time zone = (`+' | `-') 4*digit
%% Missing protocol version: HTTP/1.1 %% Missing protocol version: HTTP/1.1
%% For reference: http://httpd.apache.org/docs/2.2/logs.html %% For reference: http://httpd.apache.org/docs/2.2/logs.html
io:format(File, "~s - - [~p/~p/~p:~p:~p:~p] \"~s /~s~s\" ~p ~p ~p ~p~n", io:format(File, "~ts - - [~p/~p/~p:~p:~p:~p] \"~ts /~ts~ts\" ~p ~p ~p ~p~n",
[IP, Day, Month, Year, Hour, Minute, Second, Request#request.method, Path, Query, Code, [IP, Day, Month, Year, Hour, Minute, Second, Request#request.method, Path, Query, Code,
FileSize, Referer, UserAgent]). FileSize, Referer, UserAgent]).

View File

@ -334,13 +334,13 @@ handle_info(Info, State) ->
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok. -spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.
terminate(Reason, #state{server_host = ServerHost, hosts = Hosts}) -> terminate(Reason, #state{server_host = ServerHost, hosts = Hosts}) ->
?DEBUG("Stopping HTTP upload process for ~s: ~p", [ServerHost, Reason]), ?DEBUG("Stopping HTTP upload process for ~ts: ~p", [ServerHost, Reason]),
ejabberd_hooks:delete(remove_user, ServerHost, ?MODULE, remove_user, 50), ejabberd_hooks:delete(remove_user, ServerHost, ?MODULE, remove_user, 50),
lists:foreach(fun ejabberd_router:unregister_route/1, Hosts). lists:foreach(fun ejabberd_router:unregister_route/1, Hosts).
-spec code_change({down, _} | _, state(), _) -> {ok, state()}. -spec code_change({down, _} | _, state(), _) -> {ok, state()}.
code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) -> code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) ->
?DEBUG("Updating HTTP upload process for ~s", [ServerHost]), ?DEBUG("Updating HTTP upload process for ~ts", [ServerHost]),
{ok, State}. {ok, State}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
@ -353,7 +353,7 @@ process(LocalPath, #request{method = Method, host = Host, ip = IP})
Method == 'PUT' orelse Method == 'PUT' orelse
Method == 'GET' orelse Method == 'GET' orelse
Method == 'HEAD' -> Method == 'HEAD' ->
?DEBUG("Rejecting ~s request from ~s for ~s: Too few path components", ?DEBUG("Rejecting ~ts request from ~ts for ~ts: Too few path components",
[Method, encode_addr(IP), Host]), [Method, encode_addr(IP), Host]),
http_response(404); http_response(404);
process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP, process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP,
@ -361,7 +361,7 @@ process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP,
{Proc, Slot} = parse_http_request(Request), {Proc, Slot} = parse_http_request(Request),
try gen_server:call(Proc, {use_slot, Slot, Length}, ?CALL_TIMEOUT) of try gen_server:call(Proc, {use_slot, Slot, Length}, ?CALL_TIMEOUT) of
{ok, Path, FileMode, DirMode, GetPrefix, Thumbnail, CustomHeaders} -> {ok, Path, FileMode, DirMode, GetPrefix, Thumbnail, CustomHeaders} ->
?DEBUG("Storing file from ~s for ~s: ~s", ?DEBUG("Storing file from ~ts for ~ts: ~ts",
[encode_addr(IP), Host, Path]), [encode_addr(IP), Host, Path]),
case store_file(Path, Request, FileMode, DirMode, case store_file(Path, Request, FileMode, DirMode,
GetPrefix, Slot, Thumbnail) of GetPrefix, Slot, Thumbnail) of
@ -370,30 +370,30 @@ process(_LocalPath, #request{method = 'PUT', host = Host, ip = IP,
{ok, Headers, OutData} -> {ok, Headers, OutData} ->
http_response(201, Headers ++ CustomHeaders, OutData); http_response(201, Headers ++ CustomHeaders, OutData);
{error, closed} -> {error, closed} ->
?DEBUG("Cannot store file ~s from ~s for ~s: connection closed", ?DEBUG("Cannot store file ~ts from ~ts for ~ts: connection closed",
[Path, encode_addr(IP), Host]), [Path, encode_addr(IP), Host]),
http_response(404); http_response(404);
{error, Error} -> {error, Error} ->
?ERROR_MSG("Cannot store file ~s from ~s for ~s: ~s", ?ERROR_MSG("Cannot store file ~ts from ~ts for ~ts: ~ts",
[Path, encode_addr(IP), Host, format_error(Error)]), [Path, encode_addr(IP), Host, format_error(Error)]),
http_response(500) http_response(500)
end; end;
{error, size_mismatch} -> {error, size_mismatch} ->
?WARNING_MSG("Rejecting file ~s from ~s for ~s: Unexpected size (~B)", ?WARNING_MSG("Rejecting file ~ts from ~ts for ~ts: Unexpected size (~B)",
[lists:last(Slot), encode_addr(IP), Host, Length]), [lists:last(Slot), encode_addr(IP), Host, Length]),
http_response(413); http_response(413);
{error, invalid_slot} -> {error, invalid_slot} ->
?WARNING_MSG("Rejecting file ~s from ~s for ~s: Invalid slot", ?WARNING_MSG("Rejecting file ~ts from ~ts for ~ts: Invalid slot",
[lists:last(Slot), encode_addr(IP), Host]), [lists:last(Slot), encode_addr(IP), Host]),
http_response(403) http_response(403)
catch catch
exit:{noproc, _} -> exit:{noproc, _} ->
?WARNING_MSG("Cannot handle PUT request from ~s for ~s: " ?WARNING_MSG("Cannot handle PUT request from ~ts for ~ts: "
"Upload not configured for this host", "Upload not configured for this host",
[encode_addr(IP), Host]), [encode_addr(IP), Host]),
http_response(404); http_response(404);
_:Error -> _:Error ->
?ERROR_MSG("Cannot handle PUT request from ~s for ~s: ~p", ?ERROR_MSG("Cannot handle PUT request from ~ts for ~ts: ~p",
[encode_addr(IP), Host, Error]), [encode_addr(IP), Host, Error]),
http_response(500) http_response(500)
end; end;
@ -407,7 +407,7 @@ process(_LocalPath, #request{method = Method, host = Host, ip = IP} = Request)
case file:open(Path, [read]) of case file:open(Path, [read]) of
{ok, Fd} -> {ok, Fd} ->
file:close(Fd), file:close(Fd),
?INFO_MSG("Serving ~s to ~s", [Path, encode_addr(IP)]), ?INFO_MSG("Serving ~ts to ~ts", [Path, encode_addr(IP)]),
ContentType = guess_content_type(FileName), ContentType = guess_content_type(FileName),
Headers1 = case ContentType of Headers1 = case ContentType of
<<"image/", _SubType/binary>> -> []; <<"image/", _SubType/binary>> -> [];
@ -421,36 +421,36 @@ process(_LocalPath, #request{method = Method, host = Host, ip = IP} = Request)
Headers3 = Headers2 ++ CustomHeaders, Headers3 = Headers2 ++ CustomHeaders,
http_response(200, Headers3, {file, Path}); http_response(200, Headers3, {file, Path});
{error, eacces} -> {error, eacces} ->
?WARNING_MSG("Cannot serve ~s to ~s: Permission denied", ?WARNING_MSG("Cannot serve ~ts to ~ts: Permission denied",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(403); http_response(403);
{error, enoent} -> {error, enoent} ->
?WARNING_MSG("Cannot serve ~s to ~s: No such file", ?WARNING_MSG("Cannot serve ~ts to ~ts: No such file",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(404); http_response(404);
{error, eisdir} -> {error, eisdir} ->
?WARNING_MSG("Cannot serve ~s to ~s: Is a directory", ?WARNING_MSG("Cannot serve ~ts to ~ts: Is a directory",
[Path, encode_addr(IP)]), [Path, encode_addr(IP)]),
http_response(404); http_response(404);
{error, Error} -> {error, Error} ->
?WARNING_MSG("Cannot serve ~s to ~s: ~s", ?WARNING_MSG("Cannot serve ~ts to ~ts: ~ts",
[Path, encode_addr(IP), format_error(Error)]), [Path, encode_addr(IP), format_error(Error)]),
http_response(500) http_response(500)
end end
catch catch
exit:{noproc, _} -> exit:{noproc, _} ->
?WARNING_MSG("Cannot handle ~s request from ~s for ~s: " ?WARNING_MSG("Cannot handle ~ts request from ~ts for ~ts: "
"Upload not configured for this host", "Upload not configured for this host",
[Method, encode_addr(IP), Host]), [Method, encode_addr(IP), Host]),
http_response(404); http_response(404);
_:Error -> _:Error ->
?ERROR_MSG("Cannot handle ~s request from ~s for ~s: ~p", ?ERROR_MSG("Cannot handle ~ts request from ~ts for ~ts: ~p",
[Method, encode_addr(IP), Host, Error]), [Method, encode_addr(IP), Host, Error]),
http_response(500) http_response(500)
end; end;
process(_LocalPath, #request{method = 'OPTIONS', host = Host, process(_LocalPath, #request{method = 'OPTIONS', host = Host,
ip = IP} = Request) -> ip = IP} = Request) ->
?DEBUG("Responding to OPTIONS request from ~s for ~s", ?DEBUG("Responding to OPTIONS request from ~ts for ~ts",
[encode_addr(IP), Host]), [encode_addr(IP), Host]),
{Proc, _Slot} = parse_http_request(Request), {Proc, _Slot} = parse_http_request(Request),
try gen_server:call(Proc, get_conf, ?CALL_TIMEOUT) of try gen_server:call(Proc, get_conf, ?CALL_TIMEOUT) of
@ -459,17 +459,17 @@ process(_LocalPath, #request{method = 'OPTIONS', host = Host,
http_response(200, [AllowHeader | CustomHeaders]) http_response(200, [AllowHeader | CustomHeaders])
catch catch
exit:{noproc, _} -> exit:{noproc, _} ->
?WARNING_MSG("Cannot handle OPTIONS request from ~s for ~s: " ?WARNING_MSG("Cannot handle OPTIONS request from ~ts for ~ts: "
"Upload not configured for this host", "Upload not configured for this host",
[encode_addr(IP), Host]), [encode_addr(IP), Host]),
http_response(404); http_response(404);
_:Error -> _:Error ->
?ERROR_MSG("Cannot handle OPTIONS request from ~s for ~s: ~p", ?ERROR_MSG("Cannot handle OPTIONS request from ~ts for ~ts: ~p",
[encode_addr(IP), Host, Error]), [encode_addr(IP), Host, Error]),
http_response(500) http_response(500)
end; end;
process(_LocalPath, #request{method = Method, host = Host, ip = IP}) -> process(_LocalPath, #request{method = Method, host = Host, ip = IP}) ->
?DEBUG("Rejecting ~s request from ~s for ~s", ?DEBUG("Rejecting ~ts request from ~ts for ~ts",
[Method, encode_addr(IP), Host]), [Method, encode_addr(IP), Host]),
http_response(405, [{<<"Allow">>, <<"OPTIONS, HEAD, GET, PUT">>}]). http_response(405, [{<<"Allow">>, <<"OPTIONS, HEAD, GET, PUT">>}]).
@ -617,7 +617,7 @@ process_slot_request(#iq{lang = Lang, from = From} = IQ,
xmpp:make_error(IQ, Error) xmpp:make_error(IQ, Error)
end; end;
deny -> deny ->
?DEBUG("Denying HTTP upload slot request from ~s", ?DEBUG("Denying HTTP upload slot request from ~ts",
[jid:encode(From)]), [jid:encode(From)]),
Txt = ?T("Access denied by service policy"), Txt = ?T("Access denied by service policy"),
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
@ -631,7 +631,7 @@ create_slot(#state{service_url = undefined, max_size = MaxSize},
when MaxSize /= infinity, when MaxSize /= infinity,
Size > MaxSize -> Size > MaxSize ->
Text = {?T("File larger than ~w bytes"), [MaxSize]}, Text = {?T("File larger than ~w bytes"), [MaxSize]},
?WARNING_MSG("Rejecting file ~s from ~s (too large: ~B bytes)", ?WARNING_MSG("Rejecting file ~ts from ~ts (too large: ~B bytes)",
[File, jid:encode(JID), Size]), [File, jid:encode(JID), Size]),
Error = xmpp:err_not_acceptable(Text, Lang), Error = xmpp:err_not_acceptable(Text, Lang),
Els = xmpp:get_els(Error), Els = xmpp:get_els(Error),
@ -652,7 +652,7 @@ create_slot(#state{service_url = undefined,
allow -> allow ->
RandStr = p1_rand:get_alphanum_string(SecretLength), RandStr = p1_rand:get_alphanum_string(SecretLength),
FileStr = make_file_string(File), FileStr = make_file_string(File),
?INFO_MSG("Got HTTP upload slot for ~s (file: ~s, size: ~B)", ?INFO_MSG("Got HTTP upload slot for ~ts (file: ~ts, size: ~B)",
[jid:encode(JID), File, Size]), [jid:encode(JID), File, Size]),
{ok, [UserStr, RandStr, FileStr]}; {ok, [UserStr, RandStr, FileStr]};
deny -> deny ->
@ -678,33 +678,33 @@ create_slot(#state{service_url = ServiceURL},
case binary:split(Body, <<$\n>>, [global, trim]) of case binary:split(Body, <<$\n>>, [global, trim]) of
[<<"http", _/binary>> = PutURL, [<<"http", _/binary>> = PutURL,
<<"http", _/binary>> = GetURL] -> <<"http", _/binary>> = GetURL] ->
?INFO_MSG("Got HTTP upload slot for ~s (file: ~s, size: ~B)", ?INFO_MSG("Got HTTP upload slot for ~ts (file: ~ts, size: ~B)",
[jid:encode(JID), File, Size]), [jid:encode(JID), File, Size]),
{ok, PutURL, GetURL}; {ok, PutURL, GetURL};
Lines -> Lines ->
?ERROR_MSG("Can't parse data received for ~s from <~s>: ~p", ?ERROR_MSG("Can't parse data received for ~ts from <~ts>: ~p",
[jid:encode(JID), ServiceURL, Lines]), [jid:encode(JID), ServiceURL, Lines]),
Txt = ?T("Failed to parse HTTP response"), Txt = ?T("Failed to parse HTTP response"),
{error, xmpp:err_service_unavailable(Txt, Lang)} {error, xmpp:err_service_unavailable(Txt, Lang)}
end; end;
{ok, {402, _Body}} -> {ok, {402, _Body}} ->
?WARNING_MSG("Got status code 402 for ~s from <~s>", ?WARNING_MSG("Got status code 402 for ~ts from <~ts>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_resource_constraint()}; {error, xmpp:err_resource_constraint()};
{ok, {403, _Body}} -> {ok, {403, _Body}} ->
?WARNING_MSG("Got status code 403 for ~s from <~s>", ?WARNING_MSG("Got status code 403 for ~ts from <~ts>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_not_allowed()}; {error, xmpp:err_not_allowed()};
{ok, {413, _Body}} -> {ok, {413, _Body}} ->
?WARNING_MSG("Got status code 413 for ~s from <~s>", ?WARNING_MSG("Got status code 413 for ~ts from <~ts>",
[jid:encode(JID), ServiceURL]), [jid:encode(JID), ServiceURL]),
{error, xmpp:err_not_acceptable()}; {error, xmpp:err_not_acceptable()};
{ok, {Code, _Body}} -> {ok, {Code, _Body}} ->
?ERROR_MSG("Unexpected status code for ~s from <~s>: ~B", ?ERROR_MSG("Unexpected status code for ~ts from <~ts>: ~B",
[jid:encode(JID), ServiceURL, Code]), [jid:encode(JID), ServiceURL, Code]),
{error, xmpp:err_service_unavailable()}; {error, xmpp:err_service_unavailable()};
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Error requesting upload slot for ~s from <~s>: ~p", ?ERROR_MSG("Error requesting upload slot for ~ts from <~ts>: ~p",
[jid:encode(JID), ServiceURL, Reason]), [jid:encode(JID), ServiceURL, Reason]),
{error, xmpp:err_service_unavailable()} {error, xmpp:err_service_unavailable()}
end. end.
@ -942,12 +942,12 @@ read_image(Path) ->
width = proplists:get_value(width, Info), width = proplists:get_value(width, Info),
height = proplists:get_value(height, Info)}}; height = proplists:get_value(height, Info)}};
{error, Why} -> {error, Why} ->
?DEBUG("Cannot identify type of ~s: ~s", ?DEBUG("Cannot identify type of ~ts: ~ts",
[Path, eimp:format_error(Why)]), [Path, eimp:format_error(Why)]),
pass pass
end; end;
{error, Reason} -> {error, Reason} ->
?DEBUG("Failed to read file ~s: ~s", ?DEBUG("Failed to read file ~ts: ~ts",
[Path, format_error(Reason)]), [Path, format_error(Reason)]),
pass pass
end. end.
@ -955,7 +955,7 @@ read_image(Path) ->
-spec convert(binary(), media_info()) -> {ok, media_info()} | pass. -spec convert(binary(), media_info()) -> {ok, media_info()} | pass.
convert(InData, #media_info{path = Path, type = T, width = W, height = H} = Info) -> convert(InData, #media_info{path = Path, type = T, width = W, height = H} = Info) ->
if W * H >= 25000000 -> if W * H >= 25000000 ->
?DEBUG("The image ~s is more than 25 Mpix", [Path]), ?DEBUG("The image ~ts is more than 25 Mpix", [Path]),
pass; pass;
W =< 300, H =< 300 -> W =< 300, H =< 300 ->
{ok, Info}; {ok, Info};
@ -975,12 +975,12 @@ convert(InData, #media_info{path = Path, type = T, width = W, height = H} = Info
ok -> ok ->
{ok, OutInfo}; {ok, OutInfo};
{error, Why} -> {error, Why} ->
?ERROR_MSG("Failed to write to ~s: ~s", ?ERROR_MSG("Failed to write to ~ts: ~ts",
[OutPath, format_error(Why)]), [OutPath, format_error(Why)]),
pass pass
end; end;
{error, Why} -> {error, Why} ->
?ERROR_MSG("Failed to convert ~s to ~s: ~s", ?ERROR_MSG("Failed to convert ~ts to ~ts: ~ts",
[Path, OutPath, eimp:format_error(Why)]), [Path, OutPath, eimp:format_error(Why)]),
pass pass
end end
@ -1006,11 +1006,11 @@ remove_user(User, Server) ->
UserDir = str:join([DocRoot1, UserStr], <<$/>>), UserDir = str:join([DocRoot1, UserStr], <<$/>>),
case misc:delete_dir(UserDir) of case misc:delete_dir(UserDir) of
ok -> ok ->
?INFO_MSG("Removed HTTP upload directory of ~s@~s", [User, Server]); ?INFO_MSG("Removed HTTP upload directory of ~ts@~ts", [User, Server]);
{error, enoent} -> {error, enoent} ->
?DEBUG("Found no HTTP upload directory of ~s@~s", [User, Server]); ?DEBUG("Found no HTTP upload directory of ~ts@~ts", [User, Server]);
{error, Error} -> {error, Error} ->
?ERROR_MSG("Cannot remove HTTP upload directory of ~s@~s: ~s", ?ERROR_MSG("Cannot remove HTTP upload directory of ~ts@~ts: ~ts",
[User, Server, format_error(Error)]) [User, Server, format_error(Error)])
end, end,
ok. ok.

View File

@ -155,24 +155,24 @@ handle_cast({handle_slot_request, #jid{user = U, server = S} = JID, Path, Size},
end, end,
NewSize = case {HardQuota, SoftQuota} of NewSize = case {HardQuota, SoftQuota} of
{0, 0} -> {0, 0} ->
?DEBUG("No quota specified for ~s", ?DEBUG("No quota specified for ~ts",
[jid:encode(JID)]), [jid:encode(JID)]),
undefined; undefined;
{0, _} -> {0, _} ->
?WARNING_MSG("No hard quota specified for ~s", ?WARNING_MSG("No hard quota specified for ~ts",
[jid:encode(JID)]), [jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota); enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota);
{_, 0} -> {_, 0} ->
?WARNING_MSG("No soft quota specified for ~s", ?WARNING_MSG("No soft quota specified for ~ts",
[jid:encode(JID)]), [jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, HardQuota, HardQuota); enforce_quota(Path, Size, OldSize, HardQuota, HardQuota);
_ when SoftQuota > HardQuota -> _ when SoftQuota > HardQuota ->
?WARNING_MSG("Bad quota for ~s (soft: ~p, hard: ~p)", ?WARNING_MSG("Bad quota for ~ts (soft: ~p, hard: ~p)",
[jid:encode(JID), [jid:encode(JID),
SoftQuota, HardQuota]), SoftQuota, HardQuota]),
enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota); enforce_quota(Path, Size, OldSize, SoftQuota, SoftQuota);
_ -> _ ->
?DEBUG("Enforcing quota for ~s", ?DEBUG("Enforcing quota for ~ts",
[jid:encode(JID)]), [jid:encode(JID)]),
enforce_quota(Path, Size, OldSize, SoftQuota, HardQuota) enforce_quota(Path, Size, OldSize, SoftQuota, HardQuota)
end, end,
@ -191,7 +191,7 @@ handle_info(sweep, #state{server_host = ServerHost,
docroot = DocRoot, docroot = DocRoot,
max_days = MaxDays} = State) max_days = MaxDays} = State)
when is_integer(MaxDays), MaxDays > 0 -> when is_integer(MaxDays), MaxDays > 0 ->
?DEBUG("Got 'sweep' message for ~s", [ServerHost]), ?DEBUG("Got 'sweep' message for ~ts", [ServerHost]),
case file:list_dir(DocRoot) of case file:list_dir(DocRoot) of
{ok, Entries} -> {ok, Entries} ->
BackThen = secs_since_epoch() - (MaxDays * 86400), BackThen = secs_since_epoch() - (MaxDays * 86400),
@ -204,7 +204,7 @@ handle_info(sweep, #state{server_host = ServerHost,
delete_old_files(UserDir, BackThen) delete_old_files(UserDir, BackThen)
end, UserDirs); end, UserDirs);
{error, Error} -> {error, Error} ->
?ERROR_MSG("Cannot open document root ~s: ~s", ?ERROR_MSG("Cannot open document root ~ts: ~ts",
[DocRoot, ?FORMAT(Error)]) [DocRoot, ?FORMAT(Error)])
end, end,
{noreply, State}; {noreply, State};
@ -214,14 +214,14 @@ handle_info(Info, State) ->
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok. -spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.
terminate(Reason, #state{server_host = ServerHost, timers = Timers}) -> terminate(Reason, #state{server_host = ServerHost, timers = Timers}) ->
?DEBUG("Stopping upload quota process for ~s: ~p", [ServerHost, Reason]), ?DEBUG("Stopping upload quota process for ~ts: ~p", [ServerHost, Reason]),
ejabberd_hooks:delete(http_upload_slot_request, ServerHost, ?MODULE, ejabberd_hooks:delete(http_upload_slot_request, ServerHost, ?MODULE,
handle_slot_request, 50), handle_slot_request, 50),
lists:foreach(fun timer:cancel/1, Timers). lists:foreach(fun timer:cancel/1, Timers).
-spec code_change({down, _} | _, state(), _) -> {ok, state()}. -spec code_change({down, _} | _, state(), _) -> {ok, state()}.
code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) -> code_change(_OldVsn, #state{server_host = ServerHost} = State, _Extra) ->
?DEBUG("Updating upload quota process for ~s", [ServerHost]), ?DEBUG("Updating upload quota process for ~ts", [ServerHost]),
{ok, State}. {ok, State}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
@ -295,20 +295,20 @@ gather_file_info(Dir) ->
size = Size}} -> size = Size}} ->
[{Path, Size, Time} | Acc]; [{Path, Size, Time} | Acc];
{ok, _Info} -> {ok, _Info} ->
?DEBUG("Won't stat(2) non-regular file ~s", ?DEBUG("Won't stat(2) non-regular file ~ts",
[Path]), [Path]),
Acc; Acc;
{error, Error} -> {error, Error} ->
?ERROR_MSG("Cannot stat(2) ~s: ~s", ?ERROR_MSG("Cannot stat(2) ~ts: ~ts",
[Path, ?FORMAT(Error)]), [Path, ?FORMAT(Error)]),
Acc Acc
end end
end, [], Entries); end, [], Entries);
{error, enoent} -> {error, enoent} ->
?DEBUG("Directory ~s doesn't exist", [Dir]), ?DEBUG("Directory ~ts doesn't exist", [Dir]),
[]; [];
{error, Error} -> {error, Error} ->
?ERROR_MSG("Cannot open directory ~s: ~s", [Dir, ?FORMAT(Error)]), ?ERROR_MSG("Cannot open directory ~ts: ~ts", [Dir, ?FORMAT(Error)]),
[] []
end. end.
@ -316,16 +316,16 @@ gather_file_info(Dir) ->
del_file_and_dir(File) -> del_file_and_dir(File) ->
case file:delete(File) of case file:delete(File) of
ok -> ok ->
?INFO_MSG("Removed ~s", [File]), ?INFO_MSG("Removed ~ts", [File]),
Dir = filename:dirname(File), Dir = filename:dirname(File),
case file:del_dir(Dir) of case file:del_dir(Dir) of
ok -> ok ->
?DEBUG("Removed ~s", [Dir]); ?DEBUG("Removed ~ts", [Dir]);
{error, Error} -> {error, Error} ->
?DEBUG("Cannot remove ~s: ~s", [Dir, ?FORMAT(Error)]) ?DEBUG("Cannot remove ~ts: ~ts", [Dir, ?FORMAT(Error)])
end; end;
{error, Error} -> {error, Error} ->
?WARNING_MSG("Cannot remove ~s: ~s", [File, ?FORMAT(Error)]) ?WARNING_MSG("Cannot remove ~ts: ~ts", [File, ?FORMAT(Error)])
end. end.
-spec secs_since_epoch() -> non_neg_integer(). -spec secs_since_epoch() -> non_neg_integer().

View File

@ -128,17 +128,17 @@ process_iq(#iq{from = From, to = #jid{lserver = LServer}, lang = Lang,
allow -> allow ->
case jid:make(U, S, R) of case jid:make(U, S, R) of
#jid{} = Normalized -> #jid{} = Normalized ->
?DEBUG("Normalized JID for ~s: ~s", ?DEBUG("Normalized JID for ~ts: ~ts",
[jid:encode(From), jid:encode(JID)]), [jid:encode(From), jid:encode(JID)]),
xmpp:make_iq_result(IQ, #jidprep{jid = Normalized}); xmpp:make_iq_result(IQ, #jidprep{jid = Normalized});
error -> % Cannot happen. error -> % Cannot happen.
?DEBUG("Normalizing JID failed for ~s: ~s", ?DEBUG("Normalizing JID failed for ~ts: ~ts",
[jid:encode(From), jid:encode(JID)]), [jid:encode(From), jid:encode(JID)]),
Txt = ?T("JID normalization failed"), Txt = ?T("JID normalization failed"),
xmpp:make_error(IQ, xmpp:err_jid_malformed(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_jid_malformed(Txt, Lang))
end; end;
deny -> deny ->
?DEBUG("Won't return normalized JID to ~s: ~s", ?DEBUG("Won't return normalized JID to ~ts: ~ts",
[jid:encode(From), jid:encode(JID)]), [jid:encode(From), jid:encode(JID)]),
Txt = ?T("JID normalization denied by service policy"), Txt = ?T("JID normalization denied by service policy"),
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))

View File

@ -95,7 +95,7 @@
start(Host, Opts) -> start(Host, Opts) ->
case mod_mam_opt:db_type(Opts) of case mod_mam_opt:db_type(Opts) of
mnesia -> mnesia ->
?WARNING_MSG("Mnesia backend for ~s is not recommended: " ?WARNING_MSG("Mnesia backend for ~ts is not recommended: "
"it's limited to 2GB and often gets corrupted " "it's limited to 2GB and often gets corrupted "
"when reaching this limit. SQL backend is " "when reaching this limit. SQL backend is "
"recommended. Namely, for small servers SQLite " "recommended. Namely, for small servers SQLite "
@ -1233,7 +1233,7 @@ msg_to_el(#archive_msg{timestamp = TS, packet = El, nick = Nick,
{ok, #forwarded{sub_els = [Pkt3], delay = Delay}} {ok, #forwarded{sub_els = [Pkt3], delay = Delay}}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode raw element ~p from message " ?ERROR_MSG("Failed to decode raw element ~p from message "
"archive of user ~s: ~s", "archive of user ~ts: ~ts",
[El, jid:encode(JidArchive), xmpp:format_error(Why)]), [El, jid:encode(JidArchive), xmpp:format_error(Why)]),
{error, invalid_xml} {error, invalid_xml}
end. end.

View File

@ -127,7 +127,7 @@ delete_old_user_messages(User, TimeStamp, Type) ->
{atomic, ok} -> {atomic, ok} ->
delete_old_user_messages(NextRecord, TimeStamp, Type); delete_old_user_messages(NextRecord, TimeStamp, Type);
{aborted, Err} -> {aborted, Err} ->
?ERROR_MSG("Cannot delete old MAM messages: ~s", [Err]), ?ERROR_MSG("Cannot delete old MAM messages: ~ts", [Err]),
Err Err
end. end.
@ -138,7 +138,7 @@ store(Pkt, _, {LUser, LServer}, Type, Peer, Nick, _Dir, TS) ->
case {mnesia:table_info(archive_msg, disc_only_copies), case {mnesia:table_info(archive_msg, disc_only_copies),
mnesia:table_info(archive_msg, memory)} of mnesia:table_info(archive_msg, memory)} of
{[_|_], TableSize} when TableSize > ?TABLE_SIZE_LIMIT -> {[_|_], TableSize} when TableSize > ?TABLE_SIZE_LIMIT ->
?ERROR_MSG("MAM archives too large, won't store message for ~s@~s", ?ERROR_MSG("MAM archives too large, won't store message for ~ts@~ts",
[LUser, LServer]), [LUser, LServer]),
{error, overflow}; {error, overflow};
_ -> _ ->
@ -158,7 +158,7 @@ store(Pkt, _, {LUser, LServer}, Type, Peer, Nick, _Dir, TS) ->
{atomic, ok} -> {atomic, ok} ->
ok; ok;
{aborted, Err} -> {aborted, Err} ->
?ERROR_MSG("Cannot add message to MAM archive of ~s@~s: ~s", ?ERROR_MSG("Cannot add message to MAM archive of ~ts@~ts: ~ts",
[LUser, LServer, Err]), [LUser, LServer, Err]),
Err Err
end end

View File

@ -515,21 +515,21 @@ make_archive_el(User, TS, XML, Peer, Kind, Nick, MsgType, JidRequestor, JidArchi
MsgType, JidRequestor, JidArchive) MsgType, JidRequestor, JidArchive)
catch _:{bad_jid, _} -> catch _:{bad_jid, _} ->
?ERROR_MSG("Malformed 'peer' field with value " ?ERROR_MSG("Malformed 'peer' field with value "
"'~s' detected for user ~s in table " "'~ts' detected for user ~ts in table "
"'archive': invalid JID", "'archive': invalid JID",
[Peer, jid:encode(JidArchive)]), [Peer, jid:encode(JidArchive)]),
{error, invalid_jid} {error, invalid_jid}
end end
catch _:_ -> catch _:_ ->
?ERROR_MSG("Malformed 'timestamp' field with value '~s' " ?ERROR_MSG("Malformed 'timestamp' field with value '~ts' "
"detected for user ~s in table 'archive': " "detected for user ~ts in table 'archive': "
"not an integer", "not an integer",
[TS, jid:encode(JidArchive)]), [TS, jid:encode(JidArchive)]),
{error, invalid_timestamp} {error, invalid_timestamp}
end; end;
{error, {_, Reason}} -> {error, {_, Reason}} ->
?ERROR_MSG("Malformed 'xml' field with value '~s' detected " ?ERROR_MSG("Malformed 'xml' field with value '~ts' detected "
"for user ~s in table 'archive': ~s", "for user ~ts in table 'archive': ~ts",
[XML, jid:encode(JidArchive), Reason]), [XML, jid:encode(JidArchive), Reason]),
{error, invalid_xml} {error, invalid_xml}
end. end.

View File

@ -173,7 +173,7 @@ get_socket(N) ->
get_socket(N-1) get_socket(N-1)
end; end;
{error, Reason} = Err -> {error, Reason} = Err ->
?ERROR_MSG("Can not open udp socket to grapherl: ~s", ?ERROR_MSG("Can not open udp socket to grapherl: ~ts",
[inet:format_error(Reason)]), [inet:format_error(Reason)]),
Err Err
end; end;

View File

@ -110,7 +110,7 @@ route(#message{type = groupchat, id = ID, lang = Lang,
process_mix_message(Msg) process_mix_message(Msg)
end; end;
route(Pkt) -> route(Pkt) ->
?DEBUG("Dropping packet:~n~s", [xmpp:pp(Pkt)]). ?DEBUG("Dropping packet:~n~ts", [xmpp:pp(Pkt)]).
-spec process_disco_info(iq()) -> iq(). -spec process_disco_info(iq()) -> iq().
process_disco_info(#iq{type = set, lang = Lang} = IQ) -> process_disco_info(#iq{type = set, lang = Lang} = IQ) ->
@ -281,7 +281,7 @@ handle_info({route, Packet}, State) ->
try route(Packet) try route(Packet)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end, end,

View File

@ -110,5 +110,5 @@ del_channels(User) ->
%%%=================================================================== %%%===================================================================
-spec report_corrupted(#sql_query{}) -> ok. -spec report_corrupted(#sql_query{}) -> ok.
report_corrupted(SQL) -> report_corrupted(SQL) ->
?ERROR_MSG("Corrupted values returned by SQL request: ~s", ?ERROR_MSG("Corrupted values returned by SQL request: ~ts",
[SQL#sql_query.hash]). [SQL#sql_query.hash]).

View File

@ -231,5 +231,5 @@ unsubscribe(LServer, Channel, Service, JID, Nodes) ->
%%%=================================================================== %%%===================================================================
-spec report_corrupted(atom(), #sql_query{}) -> ok. -spec report_corrupted(atom(), #sql_query{}) -> ok.
report_corrupted(Column, SQL) -> report_corrupted(Column, SQL) ->
?ERROR_MSG("Corrupted value of '~s' column returned by " ?ERROR_MSG("Corrupted value of '~ts' column returned by "
"SQL request: ~s", [Column, SQL#sql_query.hash]). "SQL request: ~ts", [Column, SQL#sql_query.hash]).

View File

@ -271,7 +271,7 @@ route(Mod, LServer, Pkt, ExpiryTime, Continuation, Num) ->
when Pid == self() -> when Pid == self() ->
route(Mod, LServer, Pkt, ExpiryTime, Continuation1, Num); route(Mod, LServer, Pkt, ExpiryTime, Continuation1, Num);
{ok, {Pid, SubOpts, ID}, Continuation1} -> {ok, {Pid, SubOpts, ID}, Continuation1} ->
?DEBUG("Route to ~p: ~s", [Pid, Pkt#publish.topic]), ?DEBUG("Route to ~p: ~ts", [Pid, Pkt#publish.topic]),
MinQoS = min(SubOpts#sub_opts.qos, Pkt#publish.qos), MinQoS = min(SubOpts#sub_opts.qos, Pkt#publish.qos),
Retain = case SubOpts#sub_opts.retain_as_published of Retain = case SubOpts#sub_opts.retain_as_published of
false -> false; false -> false;
@ -520,7 +520,7 @@ init_topic_cache(Mod, Host) ->
catch ets:new(?MQTT_TOPIC_CACHE, catch ets:new(?MQTT_TOPIC_CACHE,
[named_table, ordered_set, public, [named_table, ordered_set, public,
{heir, erlang:group_leader(), none}]), {heir, erlang:group_leader(), none}]),
?INFO_MSG("Building MQTT cache for ~s, this may take a while", [Host]), ?INFO_MSG("Building MQTT cache for ~ts, this may take a while", [Host]),
case Mod:list_topics(Host) of case Mod:list_topics(Host) of
{ok, Topics} -> {ok, Topics} ->
lists:foreach( lists:foreach(

View File

@ -174,7 +174,7 @@ open_session(USR) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, _} -> ok; {atomic, _} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
db_fail("Failed to register MQTT session for ~s", db_fail("Failed to register MQTT session for ~ts",
Reason, [jid:encode(USR)]) Reason, [jid:encode(USR)])
end. end.
@ -218,7 +218,7 @@ subscribe({U, S, R} = USR, TopicFilter, SubOpts, ID) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, _} -> ok; {atomic, _} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
db_fail("Failed to subscribe ~s to ~s", db_fail("Failed to subscribe ~ts to ~ts",
Reason, [jid:encode(USR), TopicFilter]) Reason, [jid:encode(USR), TopicFilter])
end. end.
@ -237,7 +237,7 @@ unsubscribe({U, S, R} = USR, Topic) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, _} -> ok; {atomic, _} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
db_fail("Failed to unsubscribe ~s from ~s", db_fail("Failed to unsubscribe ~ts from ~ts",
Reason, [jid:encode(USR), Topic]) Reason, [jid:encode(USR), Topic])
end. end.
@ -287,7 +287,7 @@ close_session(USR, Pid) ->
case mnesia:transaction(F) of case mnesia:transaction(F) of
{atomic, _} -> ok; {atomic, _} -> ok;
{aborted, Reason} -> {aborted, Reason} ->
db_fail("Failed to unregister MQTT session for ~s", db_fail("Failed to unregister MQTT session for ~ts",
Reason, [jid:encode(USR)]) Reason, [jid:encode(USR)])
end. end.

View File

@ -129,26 +129,26 @@ format_error({payload_format_invalid, will}) ->
format_error({payload_format_invalid, publish}) -> format_error({payload_format_invalid, publish}) ->
"PUBLISH payload format doesn't match its indicator"; "PUBLISH payload format doesn't match its indicator";
format_error({peer_disconnected, Code, <<>>}) -> format_error({peer_disconnected, Code, <<>>}) ->
format("Peer disconnected with reason: ~s", format("Peer disconnected with reason: ~ts",
[mqtt_codec:format_reason_code(Code)]); [mqtt_codec:format_reason_code(Code)]);
format_error({peer_disconnected, Code, Reason}) -> format_error({peer_disconnected, Code, Reason}) ->
format("Peer disconnected with reason: ~s (~s)", [Reason, Code]); format("Peer disconnected with reason: ~ts (~ts)", [Reason, Code]);
format_error({replaced, Pid}) -> format_error({replaced, Pid}) ->
format("Replaced by ~p at ~s", [Pid, node(Pid)]); format("Replaced by ~p at ~ts", [Pid, node(Pid)]);
format_error({resumed, Pid}) -> format_error({resumed, Pid}) ->
format("Resumed by ~p at ~s", [Pid, node(Pid)]); format("Resumed by ~p at ~ts", [Pid, node(Pid)]);
format_error({unexpected_packet, Name}) -> format_error({unexpected_packet, Name}) ->
format("Unexpected ~s packet", [string:to_upper(atom_to_list(Name))]); format("Unexpected ~ts packet", [string:to_upper(atom_to_list(Name))]);
format_error({tls, Reason}) -> format_error({tls, Reason}) ->
format("TLS failed: ~s", [format_tls_error(Reason)]); format("TLS failed: ~ts", [format_tls_error(Reason)]);
format_error({socket, A}) -> format_error({socket, A}) ->
format("Connection failed: ~s", [format_inet_error(A)]); format("Connection failed: ~ts", [format_inet_error(A)]);
format_error({code, Code}) -> format_error({code, Code}) ->
format("Protocol error: ~s", [mqtt_codec:format_reason_code(Code)]); format("Protocol error: ~ts", [mqtt_codec:format_reason_code(Code)]);
format_error({auth, Code}) -> format_error({auth, Code}) ->
format("Authentication failed: ~s", [mqtt_codec:format_reason_code(Code)]); format("Authentication failed: ~ts", [mqtt_codec:format_reason_code(Code)]);
format_error({codec, CodecError}) -> format_error({codec, CodecError}) ->
format("Protocol error: ~s", [mqtt_codec:format_error(CodecError)]); format("Protocol error: ~ts", [mqtt_codec:format_error(CodecError)]);
format_error(A) when is_atom(A) -> format_error(A) when is_atom(A) ->
atom_to_list(A); atom_to_list(A);
format_error(Reason) -> format_error(Reason) ->
@ -175,7 +175,7 @@ handle_call({get_state, Pid}, From, State) ->
{stop, Status, State1} -> {stop, Status, State1} ->
{stop, Status, State1#state{stop_reason = {replaced, Pid}}}; {stop, Status, State1#state{stop_reason = {replaced, Pid}}};
{noreply, State1, _} -> {noreply, State1, _} ->
?DEBUG("Transferring MQTT session state to ~p at ~s", [Pid, node(Pid)]), ?DEBUG("Transferring MQTT session state to ~p at ~ts", [Pid, node(Pid)]),
Q1 = p1_queue:file_to_ram(State1#state.queue), Q1 = p1_queue:file_to_ram(State1#state.queue),
p1_server:reply(From, {ok, State1#state{queue = Q1}}), p1_server:reply(From, {ok, State1#state{queue = Q1}}),
SessionExpiry = State1#state.session_expiry, SessionExpiry = State1#state.session_expiry,
@ -214,7 +214,7 @@ handle_cast(Msg, State) ->
handle_info(Msg, #state{stop_reason = {resumed, Pid} = Reason} = State) -> handle_info(Msg, #state{stop_reason = {resumed, Pid} = Reason} = State) ->
case Msg of case Msg of
{#publish{}, _} -> {#publish{}, _} ->
?DEBUG("Relaying delayed publish to ~p at ~s", [Pid, node(Pid)]), ?DEBUG("Relaying delayed publish to ~p at ~ts", [Pid, node(Pid)]),
ejabberd_cluster:send(Pid, Msg), ejabberd_cluster:send(Pid, Msg),
noreply(State); noreply(State);
timeout -> timeout ->
@ -237,7 +237,7 @@ handle_info({tcp, TCPSock, TCPData},
{ok, Data} -> {ok, Data} ->
case mqtt_codec:decode(Codec, Data) of case mqtt_codec:decode(Codec, Data) of
{ok, Pkt, Codec1} -> {ok, Pkt, Codec1} ->
?DEBUG("Got MQTT packet:~n~s", [pp(Pkt)]), ?DEBUG("Got MQTT packet:~n~ts", [pp(Pkt)]),
State1 = State#state{codec = Codec1}, State1 = State#state{codec = Codec1},
case handle_packet(Pkt, State1) of case handle_packet(Pkt, State1) of
{ok, State2} -> {ok, State2} ->
@ -260,7 +260,7 @@ handle_info({tcp_closed, _Sock}, State) ->
?DEBUG("MQTT connection reset by peer", []), ?DEBUG("MQTT connection reset by peer", []),
stop(State, {socket, closed}); stop(State, {socket, closed});
handle_info({tcp_error, _Sock, Reason}, State) -> handle_info({tcp_error, _Sock, Reason}, State) ->
?DEBUG("MQTT connection error: ~s", [format_inet_error(Reason)]), ?DEBUG("MQTT connection error: ~ts", [format_inet_error(Reason)]),
stop(State, {socket, Reason}); stop(State, {socket, Reason});
handle_info(timeout, #state{socket = Socket} = State) -> handle_info(timeout, #state{socket = Socket} = State) ->
case Socket of case Socket of
@ -291,13 +291,13 @@ handle_packet(#publish{} = Pkt, State) ->
handle_packet(#puback{id = ID}, #state{in_flight = #publish{qos = 1, id = ID}} = State) -> handle_packet(#puback{id = ID}, #state{in_flight = #publish{qos = 1, id = ID}} = State) ->
resend(State#state{in_flight = undefined}); resend(State#state{in_flight = undefined});
handle_packet(#puback{id = ID, code = Code}, State) -> handle_packet(#puback{id = ID, code = Code}, State) ->
?DEBUG("Ignoring unexpected PUBACK with id=~B and code '~s'", [ID, Code]), ?DEBUG("Ignoring unexpected PUBACK with id=~B and code '~ts'", [ID, Code]),
{ok, State}; {ok, State};
handle_packet(#pubrec{id = ID, code = Code}, handle_packet(#pubrec{id = ID, code = Code},
#state{in_flight = #publish{qos = 2, id = ID}} = State) -> #state{in_flight = #publish{qos = 2, id = ID}} = State) ->
case mqtt_codec:is_error_code(Code) of case mqtt_codec:is_error_code(Code) of
true -> true ->
?DEBUG("Got PUBREC with error code '~s', " ?DEBUG("Got PUBREC with error code '~ts', "
"aborting acknowledgement", [Code]), "aborting acknowledgement", [Code]),
resend(State#state{in_flight = undefined}); resend(State#state{in_flight = undefined});
false -> false ->
@ -307,13 +307,13 @@ handle_packet(#pubrec{id = ID, code = Code},
handle_packet(#pubrec{id = ID, code = Code}, State) -> handle_packet(#pubrec{id = ID, code = Code}, State) ->
case mqtt_codec:is_error_code(Code) of case mqtt_codec:is_error_code(Code) of
true -> true ->
?DEBUG("Ignoring unexpected PUBREC with id=~B and code '~s'", ?DEBUG("Ignoring unexpected PUBREC with id=~B and code '~ts'",
[ID, Code]), [ID, Code]),
{ok, State}; {ok, State};
false -> false ->
Code1 = 'packet-identifier-not-found', Code1 = 'packet-identifier-not-found',
?DEBUG("Unexpected PUBREC with id=~B, " ?DEBUG("Unexpected PUBREC with id=~B, "
"sending PUBREL with error code '~s'", [ID, Code1]), "sending PUBREL with error code '~ts'", [ID, Code1]),
send(State, #pubrel{id = ID, code = Code1}) send(State, #pubrel{id = ID, code = Code1})
end; end;
handle_packet(#pubcomp{id = ID}, #state{in_flight = #pubrel{id = ID}} = State) -> handle_packet(#pubcomp{id = ID}, #state{in_flight = #pubrel{id = ID}} = State) ->
@ -329,7 +329,7 @@ handle_packet(#pubrel{id = ID}, State) ->
error -> error ->
Code = 'packet-identifier-not-found', Code = 'packet-identifier-not-found',
?DEBUG("Unexpected PUBREL with id=~B, " ?DEBUG("Unexpected PUBREL with id=~B, "
"sending PUBCOMP with error code '~s'", [ID, Code]), "sending PUBCOMP with error code '~ts'", [ID, Code]),
Pubcomp = #pubcomp{id = ID, code = Code}, Pubcomp = #pubcomp{id = ID, code = Code},
send(State, Pubcomp) send(State, Pubcomp)
end; end;
@ -357,7 +357,7 @@ handle_packet(#disconnect{code = Code, properties = Props},
end, end,
{error, State2, {peer_disconnected, Code, Reason}}; {error, State2, {peer_disconnected, Code, Reason}};
handle_packet(Pkt, State) -> handle_packet(Pkt, State) ->
?WARNING_MSG("Unexpected packet:~n~s~n** when state:~n~s", ?WARNING_MSG("Unexpected packet:~n~ts~n** when state:~n~ts",
[pp(Pkt), pp(State)]), [pp(Pkt), pp(State)]),
{error, State, {unexpected_packet, element(1, Pkt)}}. {error, State, {unexpected_packet, element(1, Pkt)}}.
@ -462,13 +462,13 @@ open_session(State, JID, _CleanStart = false) ->
subscriptions = State2#state.subscriptions, subscriptions = State2#state.subscriptions,
id = State2#state.id, id = State2#state.id,
in_flight = State2#state.in_flight}, in_flight = State2#state.in_flight},
?DEBUG("Resumed state from ~p at ~s:~n~s", ?DEBUG("Resumed state from ~p at ~ts:~n~ts",
[Pid, node(Pid), pp(State3)]), [Pid, node(Pid), pp(State3)]),
register_session(State3, JID, Pid); register_session(State3, JID, Pid);
{error, Why} -> {error, Why} ->
{error, State, Why} {error, State, Why}
catch exit:{Why, {p1_server, _, _}} -> catch exit:{Why, {p1_server, _, _}} ->
?WARNING_MSG("Failed to copy session state from ~p at ~s: ~s", ?WARNING_MSG("Failed to copy session state from ~p at ~ts: ~ts",
[Pid, node(Pid), format_exit_reason(Why)]), [Pid, node(Pid), format_exit_reason(Why)]),
register_session(State, JID, undefined) register_session(State, JID, undefined)
end; end;
@ -488,7 +488,7 @@ register_session(#state{peername = IP} = State, JID, Parent) ->
ok -> ok ->
case resubscribe(USR, State#state.subscriptions) of case resubscribe(USR, State#state.subscriptions) of
ok -> ok ->
?INFO_MSG("~s for ~s from ~s", ?INFO_MSG("~ts for ~ts from ~ts",
[if is_pid(Parent) -> [if is_pid(Parent) ->
io_lib:format( io_lib:format(
"Reopened MQTT session via ~p", "Reopened MQTT session via ~p",
@ -511,14 +511,14 @@ register_session(#state{peername = IP} = State, JID, Parent) ->
{error, State#state{session_expiry = 0}, Why} {error, State#state{session_expiry = 0}, Why}
end; end;
{error, Reason} -> {error, Reason} ->
?ERROR_MSG("Failed to register MQTT session for ~s from ~s: ~s", ?ERROR_MSG("Failed to register MQTT session for ~ts from ~ts: ~ts",
err_args(JID, IP, Reason)), err_args(JID, IP, Reason)),
{error, State, Reason} {error, State, Reason}
end. end.
-spec unregister_session(state(), error_reason()) -> ok. -spec unregister_session(state(), error_reason()) -> ok.
unregister_session(#state{jid = #jid{} = JID, peername = IP} = State, Reason) -> unregister_session(#state{jid = #jid{} = JID, peername = IP} = State, Reason) ->
Msg = "Closing MQTT session for ~s from ~s: ~s", Msg = "Closing MQTT session for ~ts from ~ts: ~ts",
case Reason of case Reason of
{Tag, _} when Tag == replaced; Tag == resumed -> {Tag, _} when Tag == replaced; Tag == resumed ->
?DEBUG(Msg, err_args(JID, IP, Reason)); ?DEBUG(Msg, err_args(JID, IP, Reason));
@ -540,7 +540,7 @@ unregister_session(#state{jid = #jid{} = JID, peername = IP} = State, Reason) ->
ok -> ok; ok -> ok;
{error, Why} -> {error, Why} ->
?ERROR_MSG( ?ERROR_MSG(
"Failed to close MQTT session for ~s from ~s: ~s", "Failed to close MQTT session for ~ts from ~ts: ~ts",
err_args(JID, IP, Why)) err_args(JID, IP, Why))
end; end;
unregister_session(_, _) -> unregister_session(_, _) ->
@ -823,7 +823,7 @@ send(State, #publish{} = Pkt) ->
State1 = State#state{in_flight = Dup}, State1 = State#state{in_flight = Dup},
{ok, do_send(State1, Pkt1)}; {ok, do_send(State1, Pkt1)};
false -> false ->
?DEBUG("Queueing packet:~n~s~n** when state:~n~s", ?DEBUG("Queueing packet:~n~ts~n** when state:~n~ts",
[pp(Pkt), pp(State)]), [pp(Pkt), pp(State)]),
try p1_queue:in(Pkt, State#state.queue) of try p1_queue:in(Pkt, State#state.queue) of
Q -> Q ->
@ -863,7 +863,7 @@ resend(#state{in_flight = Pkt} = State) ->
-spec do_send(state(), mqtt_packet()) -> state(). -spec do_send(state(), mqtt_packet()) -> state().
do_send(#state{socket = {SockMod, Sock} = Socket} = State, Pkt) -> do_send(#state{socket = {SockMod, Sock} = Socket} = State, Pkt) ->
?DEBUG("Send MQTT packet:~n~s", [pp(Pkt)]), ?DEBUG("Send MQTT packet:~n~ts", [pp(Pkt)]),
Data = mqtt_codec:encode(State#state.version, Pkt), Data = mqtt_codec:encode(State#state.version, Pkt),
Res = SockMod:send(Sock, Data), Res = SockMod:send(Sock, Data),
check_sock_result(Socket, Res), check_sock_result(Socket, Res),
@ -1121,7 +1121,7 @@ is_expired(#publish{meta = Meta, properties = Props} = Pkt) ->
Props1 = Props#{message_expiry_interval => Left}, Props1 = Props#{message_expiry_interval => Left},
{false, Pkt#publish{properties = Props1}}; {false, Pkt#publish{properties = Props1}};
true -> true ->
?DEBUG("Dropping expired packet:~n~s", [pp(Pkt)]), ?DEBUG("Dropping expired packet:~n~ts", [pp(Pkt)]),
true true
end end
end. end.
@ -1176,8 +1176,8 @@ authenticate(#connect{password = Pass} = Pkt, IP) ->
LUser, <<>>, LServer, Pass) of LUser, <<>>, LServer, Pass) of
{true, AuthModule} -> {true, AuthModule} ->
?INFO_MSG( ?INFO_MSG(
"Accepted MQTT authentication for ~s " "Accepted MQTT authentication for ~ts "
"by ~s backend from ~s", "by ~ts backend from ~ts",
[jid:encode(JID), [jid:encode(JID),
ejabberd_auth:backend_type(AuthModule), ejabberd_auth:backend_type(AuthModule),
ejabberd_config:may_hide_data(misc:ip_to_list(IP))]), ejabberd_config:may_hide_data(misc:ip_to_list(IP))]),
@ -1277,10 +1277,10 @@ publish_will(#state{will = #publish{} = Will,
jid = #jid{} = JID} = State) -> jid = #jid{} = JID} = State) ->
case publish(State, Will) of case publish(State, Will) of
{ok, _} -> {ok, _} ->
?DEBUG("Will of ~s has been published to ~s", ?DEBUG("Will of ~ts has been published to ~ts",
[jid:encode(JID), Will#publish.topic]); [jid:encode(JID), Will#publish.topic]);
{error, Why} -> {error, Why} ->
?WARNING_MSG("Failed to publish will of ~s to ~s: ~s", ?WARNING_MSG("Failed to publish will of ~ts to ~ts: ~ts",
[jid:encode(JID), Will#publish.topic, [jid:encode(JID), Will#publish.topic,
format_error(Why)]) format_error(Why)])
end, end,
@ -1321,8 +1321,8 @@ err_args(JID, IP, Reason) ->
-spec log_disconnection(state(), error_reason()) -> ok. -spec log_disconnection(state(), error_reason()) -> ok.
log_disconnection(#state{jid = JID, peername = IP}, Reason) -> log_disconnection(#state{jid = JID, peername = IP}, Reason) ->
Msg = case JID of Msg = case JID of
undefined -> "Rejected MQTT connection from ~s: ~s"; undefined -> "Rejected MQTT connection from ~ts: ~ts";
_ -> "Closing MQTT connection for ~s from ~s: ~s" _ -> "Closing MQTT connection for ~ts from ~ts: ~ts"
end, end,
case Reason of case Reason of
{Tag, _} when Tag == replaced; Tag == resumed; Tag == socket -> {Tag, _} when Tag == replaced; Tag == resumed; Tag == socket ->

View File

@ -92,12 +92,12 @@ lookup_published({_, LServer, _}, Topic) ->
{ok, {Payload, QoS, Props, Expiry}} {ok, {Payload, QoS, Props, Expiry}}
catch _:badarg -> catch _:badarg ->
?ERROR_MSG("Malformed value of 'payload_format' column " ?ERROR_MSG("Malformed value of 'payload_format' column "
"for topic '~s'", [Topic]), "for topic '~ts'", [Topic]),
{error, db_failure} {error, db_failure}
end end
catch _:badarg -> catch _:badarg ->
?ERROR_MSG("Malformed value of 'user_properties' column " ?ERROR_MSG("Malformed value of 'user_properties' column "
"for topic '~s'", [Topic]), "for topic '~ts'", [Topic]),
{error, db_failure} {error, db_failure}
end; end;
{selected, []} -> {selected, []} ->

View File

@ -245,7 +245,7 @@ route(Pkt, Host, ServerHost) ->
Pid when Pid == self() -> Pid when Pid == self() ->
route_to_room(Pkt, ServerHost); route_to_room(Pkt, ServerHost);
Pid when is_pid(Pid) -> Pid when is_pid(Pid) ->
?DEBUG("Routing to MUC worker ~p:~n~s", [Proc, xmpp:pp(Pkt)]), ?DEBUG("Routing to MUC worker ~p:~n~ts", [Proc, xmpp:pp(Pkt)]),
?GEN_SERVER:cast(Pid, {route_to_room, Pkt}); ?GEN_SERVER:cast(Pid, {route_to_room, Pkt});
undefined -> undefined ->
?DEBUG("MUC worker ~p is dead", [Proc]), ?DEBUG("MUC worker ~p is dead", [Proc]),
@ -380,7 +380,7 @@ handle_call(stop, _From, State) ->
{stop, normal, ok, State}; {stop, normal, ok, State};
handle_call({create, Room, Host, From, Nick, Opts}, _From, handle_call({create, Room, Host, From, Nick, Opts}, _From,
#{server_host := ServerHost} = State) -> #{server_host := ServerHost} = State) ->
?DEBUG("MUC: create new room '~s'~n", [Room]), ?DEBUG("MUC: create new room '~ts'~n", [Room]),
NewOpts = case Opts of NewOpts = case Opts of
default -> mod_muc_opt:default_room_options(ServerHost); default -> mod_muc_opt:default_room_options(ServerHost);
_ -> Opts _ -> Opts
@ -399,7 +399,7 @@ handle_cast({route_to_room, Packet}, #{server_host := ServerHost} = State) ->
try route_to_room(Packet, ServerHost) try route_to_room(Packet, ServerHost)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end, end,
@ -428,7 +428,7 @@ handle_info({route, Packet}, #{server_host := ServerHost} = State) ->
try route(Packet, ServerHost) try route(Packet, ServerHost)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end, end,
@ -785,7 +785,7 @@ load_permanent_rooms(Hosts, ServerHost, Opts) ->
RMod = gen_mod:ram_db_mod(Opts, ?MODULE), RMod = gen_mod:ram_db_mod(Opts, ?MODULE),
lists:foreach( lists:foreach(
fun(Host) -> fun(Host) ->
?DEBUG("Loading rooms at ~s", [Host]), ?DEBUG("Loading rooms at ~ts", [Host]),
lists:foreach( lists:foreach(
fun(R) -> fun(R) ->
{Room, _} = R#muc_room.name_host, {Room, _} = R#muc_room.name_host,
@ -817,10 +817,10 @@ load_room(RMod, Host, ServerHost, Room) ->
Opts0 -> Opts0 ->
case proplists:get_bool(persistent, Opts0) of case proplists:get_bool(persistent, Opts0) of
true -> true ->
?DEBUG("Restore room: ~s", [Room]), ?DEBUG("Restore room: ~ts", [Room]),
start_room(RMod, Host, ServerHost, Room, Opts0); start_room(RMod, Host, ServerHost, Room, Opts0);
_ -> _ ->
?DEBUG("Restore hibernated non-persistent room: ~s", [Room]), ?DEBUG("Restore hibernated non-persistent room: ~ts", [Room]),
Res = start_room(RMod, Host, ServerHost, Room, Opts0), Res = start_room(RMod, Host, ServerHost, Room, Opts0),
Mod = gen_mod:db_mod(ServerHost, mod_muc), Mod = gen_mod:db_mod(ServerHost, mod_muc),
case erlang:function_exported(Mod, get_subscribed_rooms, 3) of case erlang:function_exported(Mod, get_subscribed_rooms, 3) of
@ -834,7 +834,7 @@ load_room(RMod, Host, ServerHost, Room) ->
end. end.
start_new_room(RMod, Host, ServerHost, Room, Pass, From, Nick) -> start_new_room(RMod, Host, ServerHost, Room, Pass, From, Nick) ->
?DEBUG("Open new room: ~s", [Room]), ?DEBUG("Open new room: ~ts", [Room]),
DefRoomOpts = mod_muc_opt:default_room_options(ServerHost), DefRoomOpts = mod_muc_opt:default_room_options(ServerHost),
DefRoomOpts2 = add_password_options(Pass, DefRoomOpts), DefRoomOpts2 = add_password_options(Pass, DefRoomOpts),
start_room(RMod, Host, ServerHost, Room, DefRoomOpts2, From, Nick). start_room(RMod, Host, ServerHost, Room, DefRoomOpts2, From, Nick).

View File

@ -677,7 +677,7 @@ create_room_with_opts(Name1, Host1, ServerHost, CustomRoomOpts) ->
%% Create the room only in the database. %% Create the room only in the database.
%% It is required to restart the MUC service for the room to appear. %% It is required to restart the MUC service for the room to appear.
muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) -> muc_create_room(ServerHost, {Name, Host, _}, DefRoomOpts) ->
io:format("Creating room ~s@~s~n", [Name, Host]), io:format("Creating room ~ts@~ts~n", [Name, Host]),
mod_muc:store_room(ServerHost, Host, Name, DefRoomOpts). mod_muc:store_room(ServerHost, Host, Name, DefRoomOpts).
%% @spec (Name::binary(), Host::binary()) -> %% @spec (Name::binary(), Host::binary()) ->
@ -694,7 +694,7 @@ destroy_room(Name, Service) ->
end. end.
destroy_room({N, H, SH}) -> destroy_room({N, H, SH}) ->
io:format("Destroying room: ~s@~s - vhost: ~s~n", [N, H, SH]), io:format("Destroying room: ~ts@~ts - vhost: ~ts~n", [N, H, SH]),
destroy_room(N, H). destroy_room(N, H).
@ -726,7 +726,7 @@ read_room(F) ->
case io:get_line(F, "") of case io:get_line(F, "") of
eof -> eof; eof -> eof;
String -> String ->
case io_lib:fread("~s", String) of case io_lib:fread("~ts", String) of
{ok, [RoomJID], _} -> split_roomjid(list_to_binary(RoomJID)); {ok, [RoomJID], _} -> split_roomjid(list_to_binary(RoomJID));
{error, What} -> {error, What} ->
io:format("Parse error: what: ~p~non the line: ~p~n~n", [What, String]) io:format("Parse error: what: ~p~non the line: ~p~n~n", [What, String])
@ -778,7 +778,7 @@ rooms_empty_destroy(Service) ->
rooms_report(Method, Action, Service, Days) -> rooms_report(Method, Action, Service, Days) ->
{NA, NP, RP} = muc_unused(Method, Action, Service, Days), {NA, NP, RP} = muc_unused(Method, Action, Service, Days),
io:format("rooms ~s: ~p out of ~p~n", [Method, NP, NA]), io:format("rooms ~ts: ~p out of ~p~n", [Method, NP, NA]),
[<<R/binary, "@", H/binary>> || {R, H, _SH, _P} <- RP]. [<<R/binary, "@", H/binary>> || {R, H, _SH, _P} <- RP].
muc_unused(Method, Action, Service, Last_allowed) -> muc_unused(Method, Action, Service, Last_allowed) ->
@ -886,7 +886,7 @@ act_on_rooms(Method, Action, Rooms) ->
act_on_room(Method, destroy, {N, H, SH, Pid}) -> act_on_room(Method, destroy, {N, H, SH, Pid}) ->
Message = iolist_to_binary(io_lib:format( Message = iolist_to_binary(io_lib:format(
<<"Room destroyed by rooms_~s_destroy.">>, [Method])), <<"Room destroyed by rooms_~ts_destroy.">>, [Method])),
mod_muc_room:destroy(Pid, Message), mod_muc_room:destroy(Pid, Message),
mod_muc:room_destroyed(H, N, Pid, SH), mod_muc:room_destroyed(H, N, Pid, SH),
mod_muc:forget_room(SH, H, N); mod_muc:forget_room(SH, H, N);

View File

@ -257,26 +257,26 @@ write_last_lines(F, Images_dir, _FileFormat) ->
fw(F, <<"<div class=\"legend\">">>), fw(F, <<"<div class=\"legend\">">>),
fw(F, fw(F,
<<" <a href=\"http://www.ejabberd.im\"><img " <<" <a href=\"http://www.ejabberd.im\"><img "
"style=\"border:0\" src=\"~s/powered-by-ejabbe" "style=\"border:0\" src=\"~ts/powered-by-ejabbe"
"rd.png\" alt=\"Powered by ejabberd - robust, scalable and extensible XMPP server\"/></a>">>, "rd.png\" alt=\"Powered by ejabberd - robust, scalable and extensible XMPP server\"/></a>">>,
[Images_dir]), [Images_dir]),
fw(F, fw(F,
<<" <a href=\"http://www.erlang.org/\"><img " <<" <a href=\"http://www.erlang.org/\"><img "
"style=\"border:0\" src=\"~s/powered-by-erlang" "style=\"border:0\" src=\"~ts/powered-by-erlang"
".png\" alt=\"Powered by Erlang\"/></a>">>, ".png\" alt=\"Powered by Erlang\"/></a>">>,
[Images_dir]), [Images_dir]),
fw(F, <<"<span class=\"w3c\">">>), fw(F, <<"<span class=\"w3c\">">>),
fw(F, fw(F,
<<" <a href=\"http://validator.w3.org/check?uri" <<" <a href=\"http://validator.w3.org/check?uri"
"=referer\"><img style=\"border:0;width:88px;h" "=referer\"><img style=\"border:0;width:88px;h"
"eight:31px\" src=\"~s/valid-xhtml10.png\" " "eight:31px\" src=\"~ts/valid-xhtml10.png\" "
"alt=\"Valid XHTML 1.0 Transitional\" " "alt=\"Valid XHTML 1.0 Transitional\" "
"/></a>">>, "/></a>">>,
[Images_dir]), [Images_dir]),
fw(F, fw(F,
<<" <a href=\"http://jigsaw.w3.org/css-validato" <<" <a href=\"http://jigsaw.w3.org/css-validato"
"r/\"><img style=\"border:0;width:88px;height:" "r/\"><img style=\"border:0;width:88px;height:"
"31px\" src=\"~s/vcss.png\" alt=\"Valid " "31px\" src=\"~ts/vcss.png\" alt=\"Valid "
"CSS!\"/></a>">>, "CSS!\"/></a>">>,
[Images_dir]), [Images_dir]),
fw(F, <<"</span></div></body></html>">>). fw(F, <<"</span></div></body></html>">>).
@ -345,7 +345,7 @@ add_message_to_log(Nick1, Message, RoomJID, Opts,
RoomConfig = roomconfig_to_string(Room#room.config, RoomConfig = roomconfig_to_string(Room#room.config,
Lang, FileFormat), Lang, FileFormat),
put_room_config(F, RoomConfig, Lang, FileFormat), put_room_config(F, RoomConfig, Lang, FileFormat),
io_lib:format("<font class=\"mrcm\">~s</font><br/>", io_lib:format("<font class=\"mrcm\">~ts</font><br/>",
[tr(Lang, ?T("Chatroom configuration modified"))]); [tr(Lang, ?T("Chatroom configuration modified"))]);
{roomconfig_change, Occupants} -> {roomconfig_change, Occupants} ->
RoomConfig = roomconfig_to_string(Room#room.config, RoomConfig = roomconfig_to_string(Room#room.config,
@ -354,70 +354,70 @@ add_message_to_log(Nick1, Message, RoomJID, Opts,
RoomOccupants = roomoccupants_to_string(Occupants, RoomOccupants = roomoccupants_to_string(Occupants,
FileFormat), FileFormat),
put_room_occupants(F, RoomOccupants, Lang, FileFormat), put_room_occupants(F, RoomOccupants, Lang, FileFormat),
io_lib:format("<font class=\"mrcm\">~s</font><br/>", io_lib:format("<font class=\"mrcm\">~ts</font><br/>",
[tr(Lang, ?T("Chatroom configuration modified"))]); [tr(Lang, ?T("Chatroom configuration modified"))]);
join -> join ->
io_lib:format("<font class=\"mj\">~s ~s</font><br/>", io_lib:format("<font class=\"mj\">~ts ~ts</font><br/>",
[Nick, tr(Lang, ?T("joins the room"))]); [Nick, tr(Lang, ?T("joins the room"))]);
leave -> leave ->
io_lib:format("<font class=\"ml\">~s ~s</font><br/>", io_lib:format("<font class=\"ml\">~ts ~ts</font><br/>",
[Nick, tr(Lang, ?T("leaves the room"))]); [Nick, tr(Lang, ?T("leaves the room"))]);
{leave, Reason} -> {leave, Reason} ->
io_lib:format("<font class=\"ml\">~s ~s: ~s</font><br/>", io_lib:format("<font class=\"ml\">~ts ~ts: ~ts</font><br/>",
[Nick, tr(Lang, ?T("leaves the room")), [Nick, tr(Lang, ?T("leaves the room")),
htmlize(Reason, NoFollow, FileFormat)]); htmlize(Reason, NoFollow, FileFormat)]);
{kickban, 301, <<"">>} -> {kickban, 301, <<"">>} ->
io_lib:format("<font class=\"mb\">~s ~s</font><br/>", io_lib:format("<font class=\"mb\">~ts ~ts</font><br/>",
[Nick, tr(Lang, ?T("has been banned"))]); [Nick, tr(Lang, ?T("has been banned"))]);
{kickban, 301, Reason} -> {kickban, 301, Reason} ->
io_lib:format("<font class=\"mb\">~s ~s: ~s</font><br/>", io_lib:format("<font class=\"mb\">~ts ~ts: ~ts</font><br/>",
[Nick, tr(Lang, ?T("has been banned")), [Nick, tr(Lang, ?T("has been banned")),
htmlize(Reason, FileFormat)]); htmlize(Reason, FileFormat)]);
{kickban, 307, <<"">>} -> {kickban, 307, <<"">>} ->
io_lib:format("<font class=\"mk\">~s ~s</font><br/>", io_lib:format("<font class=\"mk\">~ts ~ts</font><br/>",
[Nick, tr(Lang, ?T("has been kicked"))]); [Nick, tr(Lang, ?T("has been kicked"))]);
{kickban, 307, Reason} -> {kickban, 307, Reason} ->
io_lib:format("<font class=\"mk\">~s ~s: ~s</font><br/>", io_lib:format("<font class=\"mk\">~ts ~ts: ~ts</font><br/>",
[Nick, tr(Lang, ?T("has been kicked")), [Nick, tr(Lang, ?T("has been kicked")),
htmlize(Reason, FileFormat)]); htmlize(Reason, FileFormat)]);
{kickban, 321, <<"">>} -> {kickban, 321, <<"">>} ->
io_lib:format("<font class=\"mk\">~s ~s</font><br/>", io_lib:format("<font class=\"mk\">~ts ~ts</font><br/>",
[Nick, [Nick,
tr(Lang, ?T("has been kicked because of an affiliation " tr(Lang, ?T("has been kicked because of an affiliation "
"change"))]); "change"))]);
{kickban, 322, <<"">>} -> {kickban, 322, <<"">>} ->
io_lib:format("<font class=\"mk\">~s ~s</font><br/>", io_lib:format("<font class=\"mk\">~ts ~ts</font><br/>",
[Nick, [Nick,
tr(Lang, ?T("has been kicked because the room has " tr(Lang, ?T("has been kicked because the room has "
"been changed to members-only"))]); "been changed to members-only"))]);
{kickban, 332, <<"">>} -> {kickban, 332, <<"">>} ->
io_lib:format("<font class=\"mk\">~s ~s</font><br/>", io_lib:format("<font class=\"mk\">~ts ~ts</font><br/>",
[Nick, [Nick,
tr(Lang, ?T("has been kicked because of a system " tr(Lang, ?T("has been kicked because of a system "
"shutdown"))]); "shutdown"))]);
{nickchange, OldNick} -> {nickchange, OldNick} ->
io_lib:format("<font class=\"mnc\">~s ~s ~s</font><br/>", io_lib:format("<font class=\"mnc\">~ts ~ts ~ts</font><br/>",
[htmlize(OldNick, FileFormat), [htmlize(OldNick, FileFormat),
tr(Lang, ?T("is now known as")), Nick]); tr(Lang, ?T("is now known as")), Nick]);
{subject, T} -> {subject, T} ->
io_lib:format("<font class=\"msc\">~s~s~s</font><br/>", io_lib:format("<font class=\"msc\">~ts~ts~ts</font><br/>",
[Nick, tr(Lang, ?T(" has set the subject to: ")), [Nick, tr(Lang, ?T(" has set the subject to: ")),
htmlize(T, NoFollow, FileFormat)]); htmlize(T, NoFollow, FileFormat)]);
{body, T} -> {body, T} ->
case {ejabberd_regexp:run(T, <<"^/me ">>), Nick} of case {ejabberd_regexp:run(T, <<"^/me ">>), Nick} of
{_, <<"">>} -> {_, <<"">>} ->
io_lib:format("<font class=\"msm\">~s</font><br/>", io_lib:format("<font class=\"msm\">~ts</font><br/>",
[htmlize(T, NoFollow, FileFormat)]); [htmlize(T, NoFollow, FileFormat)]);
{match, _} -> {match, _} ->
io_lib:format("<font class=\"mne\">~s ~s</font><br/>", io_lib:format("<font class=\"mne\">~ts ~ts</font><br/>",
[Nick, [Nick,
str:substr(htmlize(T, FileFormat), 5)]); str:substr(htmlize(T, FileFormat), 5)]);
{nomatch, _} -> {nomatch, _} ->
io_lib:format("<font class=\"mn\">~s</font> ~s<br/>", io_lib:format("<font class=\"mn\">~ts</font> ~ts<br/>",
[Nick2, htmlize(T, NoFollow, FileFormat)]) [Nick2, htmlize(T, NoFollow, FileFormat)])
end; end;
{room_existence, RoomNewExistence} -> {room_existence, RoomNewExistence} ->
io_lib:format("<font class=\"mrcm\">~s</font><br/>", io_lib:format("<font class=\"mrcm\">~ts</font><br/>",
[get_room_existence_string(RoomNewExistence, [get_room_existence_string(RoomNewExistence,
Lang)]) Lang)])
end, end,
@ -425,12 +425,12 @@ add_message_to_log(Nick1, Message, RoomJID, Opts,
STime = io_lib:format("~2..0w:~2..0w:~2..0w", STime = io_lib:format("~2..0w:~2..0w:~2..0w",
[Hour, Minute, Second]), [Hour, Minute, Second]),
{_, _, Microsecs} = Now, {_, _, Microsecs} = Now,
STimeUnique = io_lib:format("~s.~w", STimeUnique = io_lib:format("~ts.~w",
[STime, Microsecs]), [STime, Microsecs]),
catch fw(F, catch fw(F,
list_to_binary( list_to_binary(
io_lib:format("<a id=\"~s\" name=\"~s\" href=\"#~s\" " io_lib:format("<a id=\"~ts\" name=\"~ts\" href=\"#~ts\" "
"class=\"ts\">[~s]</a> ", "class=\"ts\">[~ts]</a> ",
[STimeUnique, STimeUnique, STimeUnique, STime]) [STimeUnique, STimeUnique, STimeUnique, STime])
++ Text), ++ Text),
FileFormat), FileFormat),
@ -477,12 +477,12 @@ get_dateweek(Date, Lang) ->
list_to_binary( list_to_binary(
case Lang of case Lang of
<<"en">> -> <<"en">> ->
io_lib:format("~s, ~s ~w, ~w", [Weekday, Month, D, Y]); io_lib:format("~ts, ~ts ~w, ~w", [Weekday, Month, D, Y]);
<<"es">> -> <<"es">> ->
io_lib:format("~s ~w de ~s de ~w", io_lib:format("~ts ~w de ~ts de ~w",
[Weekday, D, Month, Y]); [Weekday, D, Month, Y]);
_ -> _ ->
io_lib:format("~s, ~w ~s ~w", [Weekday, D, Month, Y]) io_lib:format("~ts, ~w ~ts ~w", [Weekday, D, Month, Y])
end). end).
make_dir_rec(Dir) -> make_dir_rec(Dir) ->
@ -504,7 +504,7 @@ create_image_files(Images_dir) ->
case file:copy(Src, Dst) of case file:copy(Src, Dst) of
{ok, _} -> ok; {ok, _} -> ok;
{error, Why} -> {error, Why} ->
?ERROR_MSG("Failed to copy ~s to ~s: ~s", ?ERROR_MSG("Failed to copy ~ts to ~ts: ~ts",
[Src, Dst, file:format_error(Why)]) [Src, Dst, file:format_error(Why)])
end end
end, Filenames). end, Filenames).
@ -537,13 +537,13 @@ put_header(F, Room, Date, CSSFile, Lang, Hour_offset,
"org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">">>), "org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">">>),
fw(F, fw(F,
<<"<html xmlns=\"http://www.w3.org/1999/xhtml\" " <<"<html xmlns=\"http://www.w3.org/1999/xhtml\" "
"xml:lang=\"~s\" lang=\"~s\">">>, "xml:lang=\"~ts\" lang=\"~ts\">">>,
[Lang, Lang]), [Lang, Lang]),
fw(F, <<"<head>">>), fw(F, <<"<head>">>),
fw(F, fw(F,
<<"<meta http-equiv=\"Content-Type\" content=\"t" <<"<meta http-equiv=\"Content-Type\" content=\"t"
"ext/html; charset=utf-8\" />">>), "ext/html; charset=utf-8\" />">>),
fw(F, <<"<title>~s - ~s</title>">>, fw(F, <<"<title>~ts - ~ts</title>">>,
[htmlize(Room#room.title), Date]), [htmlize(Room#room.title), Date]),
put_header_css(F, CSSFile), put_header_css(F, CSSFile),
put_header_script(F), put_header_script(F),
@ -554,19 +554,19 @@ put_header(F, Room, Date, CSSFile, Lang, Hour_offset,
<<"<div style=\"text-align: right;\"><a " <<"<div style=\"text-align: right;\"><a "
"style=\"color: #AAAAAA; font-family: " "style=\"color: #AAAAAA; font-family: "
"monospace; text-decoration: none; font-weight" "monospace; text-decoration: none; font-weight"
": bold;\" href=\"~s\">~s</a></div>">>, ": bold;\" href=\"~ts\">~ts</a></div>">>,
[Top_url, Top_text]), [Top_url, Top_text]),
fw(F, <<"<div class=\"roomtitle\">~s</div>">>, fw(F, <<"<div class=\"roomtitle\">~ts</div>">>,
[htmlize(Room#room.title)]), [htmlize(Room#room.title)]),
fw(F, fw(F,
<<"<a class=\"roomjid\" href=\"xmpp:~s?join\">~s" <<"<a class=\"roomjid\" href=\"xmpp:~ts?join\">~ts"
"</a>">>, "</a>">>,
[Room#room.jid, Room#room.jid]), [Room#room.jid, Room#room.jid]),
fw(F, fw(F,
<<"<div class=\"logdate\">~s<span class=\"w3c\">" <<"<div class=\"logdate\">~ts<span class=\"w3c\">"
"<a class=\"nav\" href=\"~s\">&lt;</a> " "<a class=\"nav\" href=\"~ts\">&lt;</a> "
"<a class=\"nav\" href=\"./\">^</a> <a " "<a class=\"nav\" href=\"./\">^</a> <a "
"class=\"nav\" href=\"~s\">&gt;</a></span></di" "class=\"nav\" href=\"~ts\">&gt;</a></span></di"
"v>">>, "v>">>,
[Date, Date_prev, Date_next]), [Date, Date_prev, Date_next]),
case {htmlize(Room#room.subject_author), case {htmlize(Room#room.subject_author),
@ -574,7 +574,7 @@ put_header(F, Room, Date, CSSFile, Lang, Hour_offset,
of of
{<<"">>, <<"">>} -> ok; {<<"">>, <<"">>} -> ok;
{SuA, Su} -> {SuA, Su} ->
fw(F, <<"<div class=\"roomsubject\">~s~s~s</div>">>, fw(F, <<"<div class=\"roomsubject\">~ts~ts~ts</div>">>,
[SuA, tr(Lang, ?T(" has set the subject to: ")), Su]) [SuA, tr(Lang, ?T(" has set the subject to: ")), Su])
end, end,
RoomConfig = roomconfig_to_string(Room#room.config, RoomConfig = roomconfig_to_string(Room#room.config,
@ -588,7 +588,7 @@ put_header(F, Room, Date, CSSFile, Lang, Hour_offset,
true -> io_lib:format("~p", [Hour_offset]); true -> io_lib:format("~p", [Hour_offset]);
false -> io_lib:format("+~p", [Hour_offset]) false -> io_lib:format("+~p", [Hour_offset])
end, end,
fw(F, <<"<br/><a class=\"ts\">GMT~s</a><br/>">>, fw(F, <<"<br/><a class=\"ts\">GMT~ts</a><br/>">>,
[Time_offset_str]). [Time_offset_str]).
put_header_css(F, {file, Path}) -> put_header_css(F, {file, Path}) ->
@ -603,7 +603,7 @@ put_header_css(F, {file, Path}) ->
put_header_css(F, {url, URL}) -> put_header_css(F, {url, URL}) ->
fw(F, fw(F,
<<"<link rel=\"stylesheet\" type=\"text/css\" " <<"<link rel=\"stylesheet\" type=\"text/css\" "
"href=\"~s\" media=\"all\">">>, "href=\"~ts\" media=\"all\">">>,
[URL]). [URL]).
put_header_script(F) -> put_header_script(F) ->
@ -621,11 +621,11 @@ put_room_config(F, RoomConfig, Lang, _FileFormat) ->
fw(F, <<"<div class=\"rc\">">>), fw(F, <<"<div class=\"rc\">">>),
fw(F, fw(F,
<<"<div class=\"rct\" onclick=\"sh('a~p');return " <<"<div class=\"rct\" onclick=\"sh('a~p');return "
"false;\">~s</div>">>, "false;\">~ts</div>">>,
[Now2, tr(Lang, ?T("Room Configuration"))]), [Now2, tr(Lang, ?T("Room Configuration"))]),
fw(F, fw(F,
<<"<div class=\"rcos\" id=\"a~p\" style=\"displa" <<"<div class=\"rcos\" id=\"a~p\" style=\"displa"
"y: none;\" ><br/>~s</div>">>, "y: none;\" ><br/>~ts</div>">>,
[Now2, RoomConfig]), [Now2, RoomConfig]),
fw(F, <<"</div>">>). fw(F, <<"</div>">>).
@ -641,11 +641,11 @@ put_room_occupants(F, RoomOccupants, Lang,
fw(F, <<"<div class=\"rc\">">>), fw(F, <<"<div class=\"rc\">">>),
fw(F, fw(F,
<<"<div class=\"rct\" onclick=\"sh('o~p');return " <<"<div class=\"rct\" onclick=\"sh('o~p');return "
"false;\">~s</div>">>, "false;\">~ts</div>">>,
[Now2, tr(Lang, ?T("Room Occupants"))]), [Now2, tr(Lang, ?T("Room Occupants"))]),
fw(F, fw(F,
<<"<div class=\"rcos\" id=\"o~p\" style=\"displa" <<"<div class=\"rcos\" id=\"o~p\" style=\"displa"
"y: none;\" ><br/>~s</div>">>, "y: none;\" ><br/>~ts</div>">>,
[Now2, RoomOccupants]), [Now2, RoomOccupants]),
fw(F, <<"</div>">>). fw(F, <<"</div>">>).

View File

@ -276,7 +276,7 @@ init([Host, ServerHost, Access, Room, HistorySize,
room_shaper = Shaper}), room_shaper = Shaper}),
State1 = set_opts(DefRoomOpts, State), State1 = set_opts(DefRoomOpts, State),
store_room(State1), store_room(State1),
?INFO_MSG("Created MUC room ~s@~s by ~s", ?INFO_MSG("Created MUC room ~ts@~ts by ~ts",
[Room, Host, jid:encode(Creator)]), [Room, Host, jid:encode(Creator)]),
add_to_log(room_existence, created, State1), add_to_log(room_existence, created, State1),
add_to_log(room_existence, started, State1), add_to_log(room_existence, started, State1),
@ -371,8 +371,8 @@ normal_state({route, <<"">>,
case is_user_online(From, StateData) of case is_user_online(From, StateData) of
true -> true ->
ErrorText = ?T("It is not allowed to send error messages to the" ErrorText = ?T("It is not allowed to send error messages to the"
" room. The participant (~s) has sent an error " " room. The participant (~ts) has sent an error "
"message (~s) and got kicked from the room"), "message (~ts) and got kicked from the room"),
NewState = expulse_participant(Packet, From, StateData, NewState = expulse_participant(Packet, From, StateData,
translate:translate(Lang, translate:translate(Lang,
ErrorText)), ErrorText)),
@ -517,8 +517,8 @@ normal_state({route, ToNick,
{expulse_sender, Reason} -> {expulse_sender, Reason} ->
?DEBUG(Reason, []), ?DEBUG(Reason, []),
ErrorText = ?T("It is not allowed to send error messages to the" ErrorText = ?T("It is not allowed to send error messages to the"
" room. The participant (~s) has sent an error " " room. The participant (~ts) has sent an error "
"message (~s) and got kicked from the room"), "message (~ts) and got kicked from the room"),
NewState = expulse_participant(Packet, From, StateData, NewState = expulse_participant(Packet, From, StateData,
translate:translate(Lang, ErrorText)), translate:translate(Lang, ErrorText)),
{next_state, normal_state, NewState}; {next_state, normal_state, NewState};
@ -623,7 +623,7 @@ normal_state(hibernate, StateData) ->
case maps:size(StateData#state.users) of case maps:size(StateData#state.users) of
0 -> 0 ->
store_room_no_checks(StateData, []), store_room_no_checks(StateData, []),
?INFO_MSG("Hibernating room ~s@~s", [StateData#state.room, StateData#state.host]), ?INFO_MSG("Hibernating room ~ts@~ts", [StateData#state.room, StateData#state.host]),
{stop, normal, StateData#state{hibernate_timer = hibernating}}; {stop, normal, StateData#state{hibernate_timer = hibernating}};
_ -> _ ->
{next_state, normal_state, StateData} {next_state, normal_state, StateData}
@ -646,13 +646,13 @@ handle_event({service_message, Msg}, _StateName,
handle_event({destroy, Reason}, _StateName, handle_event({destroy, Reason}, _StateName,
StateData) -> StateData) ->
_ = destroy_room(#muc_destroy{xmlns = ?NS_MUC_OWNER, reason = Reason}, StateData), _ = destroy_room(#muc_destroy{xmlns = ?NS_MUC_OWNER, reason = Reason}, StateData),
?INFO_MSG("Destroyed MUC room ~s with reason: ~p", ?INFO_MSG("Destroyed MUC room ~ts with reason: ~p",
[jid:encode(StateData#state.jid), Reason]), [jid:encode(StateData#state.jid), Reason]),
add_to_log(room_existence, destroyed, StateData), add_to_log(room_existence, destroyed, StateData),
Conf = StateData#state.config, Conf = StateData#state.config,
{stop, shutdown, StateData#state{config = Conf#config{persistent = false}}}; {stop, shutdown, StateData#state{config = Conf#config{persistent = false}}};
handle_event(destroy, StateName, StateData) -> handle_event(destroy, StateName, StateData) ->
?INFO_MSG("Destroyed MUC room ~s", ?INFO_MSG("Destroyed MUC room ~ts",
[jid:encode(StateData#state.jid)]), [jid:encode(StateData#state.jid)]),
handle_event({destroy, <<"">>}, StateName, StateData); handle_event({destroy, <<"">>}, StateName, StateData);
handle_event({set_affiliations, Affiliations}, handle_event({set_affiliations, Affiliations},
@ -866,7 +866,7 @@ handle_info(_Info, StateName, StateData) ->
terminate(Reason, _StateName, terminate(Reason, _StateName,
#state{server_host = LServer, host = Host, room = Room} = StateData) -> #state{server_host = LServer, host = Host, room = Room} = StateData) ->
try try
?INFO_MSG("Stopping MUC room ~s@~s", [Room, Host]), ?INFO_MSG("Stopping MUC room ~ts@~ts", [Room, Host]),
ReasonT = case Reason of ReasonT = case Reason of
shutdown -> shutdown ->
?T("You are being removed from the room " ?T("You are being removed from the room "
@ -909,7 +909,7 @@ terminate(Reason, _StateName,
catch ?EX_RULE(E, R, St) -> catch ?EX_RULE(E, R, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
mod_muc:room_destroyed(Host, Room, self(), LServer), mod_muc:room_destroyed(Host, Room, self(), LServer),
?ERROR_MSG("Got exception on room termination:~n** ~s", ?ERROR_MSG("Got exception on room termination:~n** ~ts",
[misc:format_exception(2, E, R, StackTrace)]) [misc:format_exception(2, E, R, StackTrace)])
end. end.
@ -918,7 +918,7 @@ terminate(Reason, _StateName,
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-spec route(pid(), stanza()) -> ok. -spec route(pid(), stanza()) -> ok.
route(Pid, Packet) -> route(Pid, Packet) ->
?DEBUG("Routing to MUC room ~p:~n~s", [Pid, xmpp:pp(Packet)]), ?DEBUG("Routing to MUC room ~p:~n~ts", [Pid, xmpp:pp(Packet)]),
#jid{lresource = Nick} = xmpp:get_to(Packet), #jid{lresource = Nick} = xmpp:get_to(Packet),
p1_fsm:send_event(Pid, {route, Nick, Packet}). p1_fsm:send_event(Pid, {route, Nick, Packet}).
@ -1291,8 +1291,8 @@ do_process_presence(Nick, #presence{from = From, type = unavailable} = Packet,
do_process_presence(_Nick, #presence{from = From, type = error, lang = Lang} = Packet, do_process_presence(_Nick, #presence{from = From, type = error, lang = Lang} = Packet,
StateData) -> StateData) ->
ErrorText = ?T("It is not allowed to send error messages to the" ErrorText = ?T("It is not allowed to send error messages to the"
" room. The participant (~s) has sent an error " " room. The participant (~ts) has sent an error "
"message (~s) and got kicked from the room"), "message (~ts) and got kicked from the room"),
expulse_participant(Packet, From, StateData, expulse_participant(Packet, From, StateData,
translate:translate(Lang, ErrorText)). translate:translate(Lang, ErrorText)).
@ -1312,7 +1312,7 @@ close_room_if_temporary_and_empty(StateData1) ->
andalso maps:size(StateData1#state.users) == 0 andalso maps:size(StateData1#state.users) == 0
andalso maps:size(StateData1#state.subscribers) == 0 of andalso maps:size(StateData1#state.subscribers) == 0 of
true -> true ->
?INFO_MSG("Destroyed MUC room ~s because it's temporary " ?INFO_MSG("Destroyed MUC room ~ts because it's temporary "
"and empty", "and empty",
[jid:encode(StateData1#state.jid)]), [jid:encode(StateData1#state.jid)]),
add_to_log(room_existence, destroyed, StateData1), add_to_log(room_existence, destroyed, StateData1),
@ -1383,7 +1383,7 @@ decide_fate_message(#message{type = error} = Msg,
%% If this is an error stanza and its condition matches a criteria %% If this is an error stanza and its condition matches a criteria
true -> true ->
Reason = str:format("This participant is considered a ghost " Reason = str:format("This participant is considered a ghost "
"and is expulsed: ~s", "and is expulsed: ~ts",
[jid:encode(From)]), [jid:encode(From)]),
{expulse_sender, Reason}; {expulse_sender, Reason};
false -> continue_delivery false -> continue_delivery
@ -2873,8 +2873,8 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
Items, Lang, StateData, []) Items, Lang, StateData, [])
of of
{result, Res} -> {result, Res} ->
?INFO_MSG("Processing MUC admin query from ~s in " ?INFO_MSG("Processing MUC admin query from ~ts in "
"room ~s:~n ~p", "room ~ts:~n ~p",
[jid:encode(UJID), [jid:encode(UJID),
jid:encode(StateData#state.jid), Res]), jid:encode(StateData#state.jid), Res]),
case lists:foldl(process_item_change(UJID), case lists:foldl(process_item_change(UJID),
@ -2959,7 +2959,7 @@ process_item_change(Item, SD, UJID) ->
undefined -> undefined ->
<<"">> <<"">>
end, end,
?ERROR_MSG("Failed to set item ~p~s:~n** ~s", ?ERROR_MSG("Failed to set item ~p~ts:~n** ~ts",
[Item, FromSuffix, [Item, FromSuffix,
misc:format_exception(2, E, R, StackTrace)]), misc:format_exception(2, E, R, StackTrace)]),
{error, xmpp:err_internal_server_error()} {error, xmpp:err_internal_server_error()}
@ -2991,7 +2991,7 @@ find_changed_items(UJID, UAffiliation, URole,
Nick /= <<"">> -> Nick /= <<"">> ->
case find_jids_by_nick(Nick, StateData) of case find_jids_by_nick(Nick, StateData) of
[] -> [] ->
ErrText = {?T("Nickname ~s does not exist in the room"), ErrText = {?T("Nickname ~ts does not exist in the room"),
[Nick]}, [Nick]},
throw({error, xmpp:err_not_acceptable(ErrText, Lang)}); throw({error, xmpp:err_not_acceptable(ErrText, Lang)});
JIDList -> JIDList ->
@ -3343,7 +3343,7 @@ process_iq_owner(From, #iq{type = set, lang = Lang,
ErrText = ?T("Owner privileges required"), ErrText = ?T("Owner privileges required"),
{error, xmpp:err_forbidden(ErrText, Lang)}; {error, xmpp:err_forbidden(ErrText, Lang)};
Destroy /= undefined, Config == undefined, Items == [] -> Destroy /= undefined, Config == undefined, Items == [] ->
?INFO_MSG("Destroyed MUC room ~s by the owner ~s", ?INFO_MSG("Destroyed MUC room ~ts by the owner ~ts",
[jid:encode(StateData#state.jid), jid:encode(From)]), [jid:encode(StateData#state.jid), jid:encode(From)]),
add_to_log(room_existence, destroyed, StateData), add_to_log(room_existence, destroyed, StateData),
destroy_room(Destroy, StateData); destroy_room(Destroy, StateData);
@ -3486,7 +3486,7 @@ get_config(Lang, StateData, From) ->
Config = StateData#state.config, Config = StateData#state.config,
MaxUsersRoom = get_max_users(StateData), MaxUsersRoom = get_max_users(StateData),
Title = str:format( Title = str:format(
translate:translate(Lang, ?T("Configuration of room ~s")), translate:translate(Lang, ?T("Configuration of room ~ts")),
[jid:encode(StateData#state.jid)]), [jid:encode(StateData#state.jid)]),
Fs = [{roomname, Config#config.title}, Fs = [{roomname, Config#config.title},
{roomdesc, Config#config.description}, {roomdesc, Config#config.description},
@ -3628,8 +3628,8 @@ set_config(Opts, Config, ServerHost, Lang) ->
[Opt, Lang]) of [Opt, Lang]) of
{0, undefined} -> {0, undefined} ->
?ERROR_MSG("set_room_option hook failed for " ?ERROR_MSG("set_room_option hook failed for "
"option '~s' with value ~p", [O, V]), "option '~ts' with value ~p", [O, V]),
Txt = {?T("Failed to process option '~s'"), [O]}, Txt = {?T("Failed to process option '~ts'"), [O]},
{error, xmpp:err_internal_server_error(Txt, Lang)}; {error, xmpp:err_internal_server_error(Txt, Lang)};
{Pos, Val} -> {Pos, Val} ->
setelement(Pos, C, Val) setelement(Pos, C, Val)
@ -4452,7 +4452,7 @@ route_invitation(From, Pkt, Invitation, Lang, StateData) ->
[io_lib:format( [io_lib:format(
translate:translate( translate:translate(
Lang, Lang,
?T("~s invites you to the room ~s")), ?T("~ts invites you to the room ~ts")),
[jid:encode(From), [jid:encode(From),
jid:encode({StateData#state.room, StateData#state.host, <<"">>})]), jid:encode({StateData#state.room, StateData#state.host, <<"">>})]),
case (StateData#state.config)#config.password_protected of case (StateData#state.config)#config.password_protected of

View File

@ -97,7 +97,7 @@ change_room(Host, Room, {del_subscription, JID}) ->
ejabberd_sql:sql_query_t(?SQL("delete from muc_room_subscribers where " ejabberd_sql:sql_query_t(?SQL("delete from muc_room_subscribers where "
"room=%(Room)s and host=%(Host)s and jid=%(SJID)s")); "room=%(Room)s and host=%(Host)s and jid=%(SJID)s"));
change_room(Host, Room, Change) -> change_room(Host, Room, Change) ->
?ERROR_MSG("Unsupported change on room ~s@~s: ~p", [Room, Host, Change]). ?ERROR_MSG("Unsupported change on room ~ts@~ts: ~p", [Room, Host, Change]).
restore_room(LServer, Host, Name) -> restore_room(LServer, Host, Name) ->
case catch ejabberd_sql:sql_query( case catch ejabberd_sql:sql_query(

View File

@ -495,7 +495,7 @@ report_not_jid(From, Packet, Dests) ->
|| Dest <- Dests], || Dest <- Dests],
[route_error( [route_error(
xmpp:set_from_to(Packet, From, From), jid_malformed, xmpp:set_from_to(Packet, From, From), jid_malformed,
str:format(?T("This service can not process the address: ~s"), [D])) str:format(?T("This service can not process the address: ~ts"), [D]))
|| D <- Dests2]. || D <- Dests2].
%%%------------------------- %%%-------------------------

View File

@ -761,7 +761,7 @@ offline_msg_to_route(LServer, #offline_msg{from = From, to = To} = R) ->
Pkt2 = add_delay_info(Pkt1, LServer, R#offline_msg.timestamp), Pkt2 = add_delay_info(Pkt1, LServer, R#offline_msg.timestamp),
{route, Pkt2} {route, Pkt2}
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode packet ~p of user ~s: ~s", ?ERROR_MSG("Failed to decode packet ~p of user ~ts: ~ts",
[R#offline_msg.packet, jid:encode(To), [R#offline_msg.packet, jid:encode(To),
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
error error
@ -801,7 +801,7 @@ read_db_messages(LUser, LServer) ->
[{Node, Pkt2}] [{Node, Pkt2}]
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode packet ~p " ?ERROR_MSG("Failed to decode packet ~p "
"of user ~s: ~s", "of user ~ts: ~ts",
[El, jid:encode(To), [El, jid:encode(To),
xmpp:format_error(Why)]), xmpp:format_error(Why)]),
[] []
@ -994,7 +994,7 @@ user_queue(User, Server, Query, Lang) ->
end, end,
Hdrs = get_messages_subset(User, Server, HdrsAll), Hdrs = get_messages_subset(User, Server, HdrsAll),
FMsgs = format_user_queue(Hdrs), FMsgs = format_user_queue(Hdrs),
PageTitle = str:format(translate:translate(Lang, ?T("~s's Offline Messages Queue")), [us_to_list(US)]), PageTitle = str:format(translate:translate(Lang, ?T("~ts's Offline Messages Queue")), [us_to_list(US)]),
(?H1GL(PageTitle, <<"mod-offline">>, <<"mod_offline">>)) (?H1GL(PageTitle, <<"mod-offline">>, <<"mod_offline">>))
++ [?XREST(?T("Submitted"))] ++ ++ [?XREST(?T("Submitted"))] ++
[?XAE(<<"form">>, [?XAE(<<"form">>,
@ -1098,7 +1098,7 @@ webadmin_user_parse_query(_, <<"removealloffline">>,
User, Server, _Query) -> User, Server, _Query) ->
case delete_all_msgs(User, Server) of case delete_all_msgs(User, Server) of
{atomic, ok} -> {atomic, ok} ->
?INFO_MSG("Removed all offline messages for ~s@~s", ?INFO_MSG("Removed all offline messages for ~ts@~ts",
[User, Server]), [User, Server]),
{stop, ok}; {stop, ok};
Err -> Err ->

View File

@ -219,7 +219,7 @@ export(_Server) ->
"server_host=%(LServer)s", "server_host=%(LServer)s",
"xml=%(XML)s"])] "xml=%(XML)s"])]
catch _:{xmpp_codec, Why} -> catch _:{xmpp_codec, Why} ->
?ERROR_MSG("Failed to decode packet ~p of user ~s@~s: ~s", ?ERROR_MSG("Failed to decode packet ~p of user ~ts@~ts: ~ts",
[El, LUser, LServer, xmpp:format_error(Why)]), [El, LUser, LServer, xmpp:format_error(Why)]),
[] []
end; end;
@ -238,7 +238,7 @@ xml_to_offline_msg(XML) ->
#xmlel{} = El -> #xmlel{} = El ->
el_to_offline_msg(El); el_to_offline_msg(El);
Err -> Err ->
?ERROR_MSG("Got ~p when parsing XML packet ~s", ?ERROR_MSG("Got ~p when parsing XML packet ~ts",
[Err, XML]), [Err, XML]),
Err Err
end. end.

View File

@ -98,14 +98,14 @@ update(Server, JID, Dir) ->
write(Dir, R#pres_counter{logged = true}), write(Dir, R#pres_counter{logged = true}),
case Dir of case Dir of
in -> in ->
?WARNING_MSG("User ~s is being flooded, ignoring received " ?WARNING_MSG("User ~ts is being flooded, ignoring received "
"presence subscriptions", "presence subscriptions",
[jid:encode(JID)]); [jid:encode(JID)]);
out -> out ->
IP = ejabberd_sm:get_user_ip(JID#jid.luser, IP = ejabberd_sm:get_user_ip(JID#jid.luser,
JID#jid.lserver, JID#jid.lserver,
JID#jid.lresource), JID#jid.lresource),
?WARNING_MSG("Flooder detected: ~s, on IP: ~s ignoring " ?WARNING_MSG("Flooder detected: ~ts, on IP: ~ts ignoring "
"sent presence subscriptions~n", "sent presence subscriptions~n",
[jid:encode(JID), [jid:encode(JID),
misc:ip_to_list(IP)]) misc:ip_to_list(IP)])

View File

@ -416,7 +416,7 @@ update_c2s_state_with_privacy_list(#iq{type = set,
#privacy_query{default = undefined, active = Active} -> #privacy_query{default = undefined, active = Active} ->
case Active of case Active of
none -> none ->
?DEBUG("Removing active privacy list for user: ~s", ?DEBUG("Removing active privacy list for user: ~ts",
[jid:encode(To)]), [jid:encode(To)]),
State#{privacy_active_list => none}; State#{privacy_active_list => none};
undefined -> undefined ->
@ -424,7 +424,7 @@ update_c2s_state_with_privacy_list(#iq{type = set,
_ -> _ ->
case get_user_list(U, S, Active) of case get_user_list(U, S, Active) of
{ok, _} -> {ok, _} ->
?DEBUG("Setting active privacy list '~s' for user: ~s", ?DEBUG("Setting active privacy list '~ts' for user: ~ts",
[Active, jid:encode(To)]), [Active, jid:encode(To)]),
State#{privacy_active_list => Active}; State#{privacy_active_list => Active};
_ -> _ ->
@ -548,8 +548,8 @@ check_packet(Acc, #{jid := JID} = State, Packet, Dir) ->
{ok, {_, List}} -> {ok, {_, List}} ->
do_check_packet(JID, List, Packet, Dir); do_check_packet(JID, List, Packet, Dir);
_ -> _ ->
?DEBUG("Non-existing active list '~s' is set " ?DEBUG("Non-existing active list '~ts' is set "
"for user '~s'", [ListName, jid:encode(JID)]), "for user '~ts'", [ListName, jid:encode(JID)]),
check_packet(Acc, JID, Packet, Dir) check_packet(Acc, JID, Packet, Dir)
end end
end; end;

View File

@ -134,7 +134,7 @@ parse_element(LUser, LServer, XML) ->
{ok, El}; {ok, El};
_ -> _ ->
?ERROR_MSG("Malformed XML element in SQL table " ?ERROR_MSG("Malformed XML element in SQL table "
"'private_storage' for user ~s@~s: ~s", "'private_storage' for user ~ts@~ts: ~ts",
[LUser, LServer, XML]), [LUser, LServer, XML]),
error error
end. end.

View File

@ -236,8 +236,8 @@ handle_cast({component_connected, Host}, State) ->
#privilege_perm{access = presence, #privilege_perm{access = presence,
type = PresencePerm}]}, type = PresencePerm}]},
?INFO_MSG("Granting permissions to external " ?INFO_MSG("Granting permissions to external "
"component '~s': roster = ~s, presence = ~s, " "component '~ts': roster = ~ts, presence = ~ts, "
"message = ~s", "message = ~ts",
[Host, RosterPerm, PresencePerm, MessagePerm]), [Host, RosterPerm, PresencePerm, MessagePerm]),
Msg = #message{from = From, to = To, sub_els = [Priv]}, Msg = #message{from = From, to = To, sub_els = [Priv]},
ejabberd_router:route(Msg), ejabberd_router:route(Msg),
@ -248,7 +248,7 @@ handle_cast({component_connected, Host}, State) ->
ets:insert(?MODULE, {ServerHost, Permissions}), ets:insert(?MODULE, {ServerHost, Permissions}),
{noreply, State}; {noreply, State};
true -> true ->
?INFO_MSG("Granting no permissions to external component '~s'", ?INFO_MSG("Granting no permissions to external component '~ts'",
[Host]), [Host]),
{noreply, State} {noreply, State}
end; end;

View File

@ -95,7 +95,7 @@ register_stream(SID, Pid) ->
end), end),
ok; ok;
_:badarg -> _:badarg ->
?ERROR_MSG("Malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~ts'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end
@ -128,7 +128,7 @@ unregister_stream(SID) ->
catch _:badarg when Val == undefined -> catch _:badarg when Val == undefined ->
ok; ok;
_:badarg -> _:badarg ->
?ERROR_MSG("Malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~ts'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end
@ -163,7 +163,7 @@ activate_stream(SID, IJID, MaxConnections, _Node) ->
catch _:badarg when Val == undefined -> catch _:badarg when Val == undefined ->
{error, notfound}; {error, notfound};
_:badarg -> _:badarg ->
?ERROR_MSG("Malformed data in redis (key = '~s'): ~p", ?ERROR_MSG("Malformed data in redis (key = '~ts'): ~p",
[SIDKey, Val]), [SIDKey, Val]),
{error, db_failure} {error, db_failure}
end end

View File

@ -88,7 +88,7 @@ handle_info({route, Packet}, State) ->
try route(Packet) try route(Packet)
catch ?EX_RULE(Class, Reason, St) -> catch ?EX_RULE(Class, Reason, St) ->
StackTrace = ?EX_STACK(St), StackTrace = ?EX_STACK(St),
?ERROR_MSG("Failed to route packet:~n~s~n** ~s", ?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
[xmpp:pp(Packet), [xmpp:pp(Packet),
misc:format_exception(2, Class, Reason, StackTrace)]) misc:format_exception(2, Class, Reason, StackTrace)])
end, end,
@ -237,7 +237,7 @@ process_bytestreams(#iq{type = set, lang = Lang, from = InitiatorJID, to = To,
Txt = ?T("Bytestream already activated"), Txt = ?T("Bytestream already activated"),
xmpp:make_error(IQ, xmpp:err_conflict(Txt, Lang)); xmpp:make_error(IQ, xmpp:err_conflict(Txt, Lang));
{error, Err} -> {error, Err} ->
?ERROR_MSG("Failed to activate bytestream from ~s to ~s: ~p", ?ERROR_MSG("Failed to activate bytestream from ~ts to ~ts: ~p",
[Initiator, Target, Err]), [Initiator, Target, Err]),
Txt = ?T("Database failure"), Txt = ?T("Database failure"),
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang)) xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))

Some files were not shown because too many files have changed in this diff Show More