ejabberd 中对 mod_rest 的休息呼叫不起作用
Rest call for mod_rest in ejabberd not working
大家好,我的项目中有发送者和接收者的 JID 以及消息正文。我需要在不使用任何聊天客户端的情况下发送消息,因此我使用 mod_rest 以便我可以访问 mod_admin_extra。我用 Ejabberd 服务器 14.05 配置它并尝试 运行 下面的 rest 调用
[root@centos ~]# wget localhost:5280/rest/ --server-response --post-data 'registered_users localhost'
--2016-06-20 17:03:33-- http://localhost:5280/rest/
Connecting to <<proxy ip>>... connected.
Proxy request sent, awaiting response...
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1015
Connection: close
Date: Mon, 20 Jun 2016 11:33:33 GMT
Length: 1015 [text/html]
Saving to: “index.html.3”
其中 index.html.3 有以下消息,
Problem 'error function_clause' occurred executing the command.
Stacktrace: [{ejabberd_commands,'-check_access_commands/5-fun-0-',
[{rest,[{registered_users,[all]},{connected_users,[all]}]}],
[{file,"src/ejabberd_commands.erl"},{line,372}]},
{lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1284}]},
{ejabberd_commands,check_access_commands,5,
[{file,"src/ejabberd_commands.erl"},{line,371}]},
{ejabberd_commands,execute_command,4,
[{file,"src/ejabberd_commands.erl"},{line,308}]},
{ejabberd_ctl,call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,293}]},
{ejabberd_ctl,try_call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,269}]},
{ejabberd_ctl,process2,3,
[{file,"src/ejabberd_ctl.erl"},{line,218}]},
{mod_rest,maybe_post_request,3,
[{file,"src/mod_rest.erl"},{line,135}]}]
Mod_admin_extra 被添加到 ejabberd 配置中 file.Is 这是一个命令问题没有 identified.If 是的,请解释如何在 ejabberdctl 中添加 mod_Admin_extra 命令我是新手erlang 所以我很难调试因此任何帮助都会对我有益如果你们知道除了使用 mod_rest 之外还有更好的发送消息的方法请告诉我
非常感谢
我知道了。 ejabberd 14.05 的 ejabberd_commands.hrl 和 mod_admin_extra 模块不支持我需要的命令。因此我添加了两个模块的更新版本并且它开始工作
你甚至可以尝试使用命令 send__message
大家好,我的项目中有发送者和接收者的 JID 以及消息正文。我需要在不使用任何聊天客户端的情况下发送消息,因此我使用 mod_rest 以便我可以访问 mod_admin_extra。我用 Ejabberd 服务器 14.05 配置它并尝试 运行 下面的 rest 调用
[root@centos ~]# wget localhost:5280/rest/ --server-response --post-data 'registered_users localhost'
--2016-06-20 17:03:33-- http://localhost:5280/rest/
Connecting to <<proxy ip>>... connected.
Proxy request sent, awaiting response...
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1015
Connection: close
Date: Mon, 20 Jun 2016 11:33:33 GMT
Length: 1015 [text/html]
Saving to: “index.html.3”
其中 index.html.3 有以下消息,
Problem 'error function_clause' occurred executing the command.
Stacktrace: [{ejabberd_commands,'-check_access_commands/5-fun-0-',
[{rest,[{registered_users,[all]},{connected_users,[all]}]}],
[{file,"src/ejabberd_commands.erl"},{line,372}]},
{lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1284}]},
{ejabberd_commands,check_access_commands,5,
[{file,"src/ejabberd_commands.erl"},{line,371}]},
{ejabberd_commands,execute_command,4,
[{file,"src/ejabberd_commands.erl"},{line,308}]},
{ejabberd_ctl,call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,293}]},
{ejabberd_ctl,try_call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,269}]},
{ejabberd_ctl,process2,3,
[{file,"src/ejabberd_ctl.erl"},{line,218}]},
{mod_rest,maybe_post_request,3,
[{file,"src/mod_rest.erl"},{line,135}]}]
Mod_admin_extra 被添加到 ejabberd 配置中 file.Is 这是一个命令问题没有 identified.If 是的,请解释如何在 ejabberdctl 中添加 mod_Admin_extra 命令我是新手erlang 所以我很难调试因此任何帮助都会对我有益如果你们知道除了使用 mod_rest 之外还有更好的发送消息的方法请告诉我 非常感谢
我知道了。 ejabberd 14.05 的 ejabberd_commands.hrl 和 mod_admin_extra 模块不支持我需要的命令。因此我添加了两个模块的更新版本并且它开始工作
你甚至可以尝试使用命令 send__message