1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 09:49:18 +02:00

Fix call to atom_to_binary/1 for Erlang/OTP older than 23

This commit is contained in:
Badlop 2024-06-25 11:11:17 +02:00
parent eceb9b729f
commit f28e7b37bc
3 changed files with 5 additions and 2 deletions

View file

@ -869,7 +869,7 @@ join_cluster_here(_Node, _IsNodes, true, _Ping) ->
join_cluster_here(_Node, _IsNodes, _IsKnownNodes, pang) ->
{error, "This node cannot reach that node."};
join_cluster_here(Node, false, false, pong) ->
case ejabberd_cluster:call(Node, ejabberd_admin, join_cluster, [atom_to_binary(node())]) of
case ejabberd_cluster:call(Node, ejabberd_admin, join_cluster, [misc:atom_to_binary(node())]) of
{ok, _} ->
{ok, "Trying to join node to this cluster, wait a few seconds and check the list of nodes."};
Error ->

View file

@ -1607,7 +1607,7 @@ make_login_items(#request{us = {Username, Host}} = R, Level) ->
?LI([?C(unicode:characters_to_binary("🏭")),
make_command(echo,
R,
[{<<"sentence">>, atom_to_binary(node())}],
[{<<"sentence">>, misc:atom_to_binary(node())}],
[{only, value},
{result_links, [{sentence, node, Level, <<"">>}]}])]),
?LI([?C(unicode:characters_to_binary("📤")),

View file

@ -316,6 +316,9 @@ binary_to_atom(Bin) ->
tuple_to_binary(T) ->
iolist_to_binary(tuple_to_list(T)).
%% erlang:atom_to_binary/1 is available since OTP 23
%% https://www.erlang.org/doc/apps/erts/erlang#atom_to_binary/1
%% Let's use /2 for backwards compatibility.
atom_to_binary(A) ->
erlang:atom_to_binary(A, utf8).