ejabberd - Comments for "Using mod_pubsub via console"
https://www.ejabberd.im/forum/28713/using-modpubsub-console
enOkay, so i just figured out
https://www.ejabberd.im/forum/28713/using-modpubsub-console#comment-67391
<p>Okay, so i just figured out in get_items/2 case:<br />
The args type in the ejabberd_commands declaration must be binary: </p>
<div class="codeblock"><code>args = [{host, binary}, {node, binary}],</code></div>
<p>And a native call for get_items/2 looks like this: </p>
<div class="codeblock"><code>mod_pubsub:get_items(<<"pubsub.mydomain">>, <<"NodeName">>)</code></div>
<p>If the node got string instead of binary, it wont run in error or warning, just simply will not found the node.</p>
Thu, 30 Mar 2017 12:08:50 +0000Dywelcomment 67391 at https://www.ejabberd.imYea i got this idea too, but
https://www.ejabberd.im/forum/28713/using-modpubsub-console#comment-67390
<p>Yea i got this idea too, but after compile pubsub (either without changes) the ejabberd wont start and return with this error:</p>
<div class="codeblock"><code>[critical] <0.38.0>@gen_mod:start_module:162 Problem starting the module mod_pubsub for host <<"myhost.hu">> <br /> options: [{access_createnode,all},<br /> {ignore_pep_from_offline,true},<br /> {last_item_cache,false},<br /> {plugins,[<<"flat">>,<<"hometree">>,<<"pep">>]}]<br /> error: undef<br />[{gen_mod,start_child,<br /> [mod_pubsub,<<"myhost.hu">>,<br /> [{access_createnode,all},<br /> {ignore_pep_from_offline,true},<br /> {last_item_cache,false},<br /> {plugins,[<<"flat">>,<<"hometree">>,<<"pep">>]}]],<br /> []},<br /> {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,154}]},<br /> {lists,foreach,2,[{file,"lists.erl"},{line,1337}]},<br /> {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,77}]},<br /> {application_master,start_it_old,4,<br /> [{file,"application_master.erl"},{line,273}]}]<br />2017-03-29 07:05:33.466 [critical] <0.38.0>@gen_mod:maybe_halt_ejabberd:170 ejabberd initialization was aborted because a module start failed.</code></div>
<p>I found the same error in forums with other modules, but can't solve this problem. And this is not a priority problem for me.</p>
Wed, 29 Mar 2017 11:12:22 +0000Dywelcomment 67390 at https://www.ejabberd.im> a native erlang call
https://www.ejabberd.im/forum/28713/using-modpubsub-console#comment-67388
<p>> a native erlang call example for get_items/2 and create_node/5.</p>
<p>You can know what arguments, and in what format they are expected, if you add some debug lines like this one, recompile, install, then trigger the code with a normal client, and see the log lines in the ejabberd log:</p>
<pre>
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -2137,6 +2137,7 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) ->
end.
get_items(Host, Node) ->
+ ?INFO_MSG("get_items, Host: ~p, Node: ~p.", [Host, Node]),
Action = fun (#pubsub_node{type = Type, id = Nidx}) ->
node_call(Host, Type, get_items, [Nidx, service_jid(Host), undefined])
end,
</pre>Wed, 29 Mar 2017 09:51:58 +0000badlopcomment 67388 at https://www.ejabberd.im