{"type":"rich","version":"1.0","provider_name":"phorkie","provider_url":"https:\/\/p.cweiske.de\/","title":"ejabberd: script to send-muc-message","author_name":"Christian Weiske","cache_age":86400,"width":900,"height":900,"html":"<!-- embedding all files of https:\/\/p.cweiske.de\/242 -->\n<link rel=\"stylesheet\" href=\"https:\/\/p.cweiske.de\/css\/embed.css\"\/>\n<div class=\"phork\" id=\"242\">\n    <div class=\"phork-file\">\n <div class=\"phork-content\">\n  <style type=\"text\/css\"><\/style><div class=\"code\"><table class=\"erl\"><tbody><tr class=\"li1\"><td class=\"ln\"><pre class=\"de1\">1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n<\/pre><\/td><td class=\"de1\"><pre class=\"de1\">#!\/usr\/bin\/env escript\r\n%%! -sname sender@localhost\r\n%%\r\n%% Written by Holger Weiss &lt;holger@zedat.fu-berlin.de&gt;.\r\n%%\r\n&#160;\n%\r\n% If the node name of your server is not 'ejabberd@localhost' (see the\r\n% &quot;ejabberdctl status&quot; output), you must change the @localhost part of\r\n% the node names above and below.\r\n%\r\n% Apart from that, you must set Room and Host to the desired values\r\n% below.\r\n%\r\n&#160;\nmain(Args) -&gt;\r\n&#160; &#160; Room = &lt;&lt;&quot;test&quot;&gt;&gt;,\r\n&#160; &#160; Host = &lt;&lt;&quot;conference.example.com&quot;&gt;&gt;,\r\n&#160; &#160; Node = 'ejabberd@localhost',\r\n&#160; &#160; Usage = &quot;send-muc-message &lt;message&gt; ...&quot;,\r\n&#160;\n&#160; &#160; Message =\r\n&#160; &#160; &#160; &#160; case string:join(Args, &quot; &quot;) of\r\n&#160; &#160; &#160; &#160; &#160; &#160; [] -&gt;\r\n&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; io:format(standard_error, &quot;Usage: ~s~n&quot;, [Usage]),\r\n&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; halt(2);\r\n&#160; &#160; &#160; &#160; &#160; &#160; Joined -&gt;\r\n&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; list_to_binary(Joined)\r\n&#160; &#160; &#160; &#160; end,\r\n&#160;\n&#160; &#160; case rpc:call(Node, mnesia, dirty_read, [muc_online_room, {Room, Host}]) of\r\n&#160; &#160; &#160; &#160; [R] -&gt;\r\n&#160; &#160; &#160; &#160; &#160; &#160; Pid = element(3, R),\r\n&#160; &#160; &#160; &#160; &#160; &#160; gen_fsm:send_all_state_event(Pid, {service_message, Message});\r\n&#160; &#160; &#160; &#160; [] -&gt;\r\n&#160; &#160; &#160; &#160; &#160; &#160; io:format(standard_error, &quot;Room ~s@~s unavailable~n&quot;, [Room, Host]),\r\n&#160; &#160; &#160; &#160; &#160; &#160; halt(1)\r\n&#160; &#160; end.\r\n&#160;\n% vim:set filetype=erlang tabstop=4 expandtab:\r\n&#160;<\/pre><\/td><\/tr><\/tbody><\/table><\/div>\n <\/div>\n <div class=\"phork-meta\">\n  <a href=\"https:\/\/p.cweiske.de\/242\/rev-raw\/41d58a68d95f5117f48886400e8d09d3f815ceb7\/phork0.erl\" style=\"float: right\">view raw source<\/a>\n  <a href=\"https:\/\/p.cweiske.de\/242#phork0.erl\">phork0.erl<\/a>\n <\/div>\n<\/div>\n<\/div>\n"}
