(no commit message)
authorChristian Weiske <cweiske@cweiske.de>
Mon, 2 Nov 2015 13:04:47 +0000 (14:04 +0100)
committerwww-cweiske <www-cweiske@localhost.localdomain>
Mon, 2 Nov 2015 13:04:47 +0000 (14:04 +0100)
phork0.txt [new file with mode: 0644]

diff --git a/phork0.txt b/phork0.txt
new file mode 100644 (file)
index 0000000..61f6088
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env escript\r
+%%! -sname sender@localhost\r
+%%\r
+%% Written by Holger Weiss <holger@zedat.fu-berlin.de>.\r
+%%\r
+\r
+%\r
+% If the node name of your server is not 'ejabberd@localhost' (see the\r
+% "ejabberdctl status" output), you must change the @localhost part of\r
+% the node names above and below.\r
+%\r
+% Apart from that, you must set Room and Host to the desired values\r
+% below.\r
+%\r
+\r
+main(Args) ->\r
+    Room = <<"test">>,\r
+    Host = <<"conference.example.com">>,\r
+    Node = 'ejabberd@localhost',\r
+    Usage = "send-muc-message <message> ...",\r
+\r
+    Message =\r
+        case string:join(Args, " ") of\r
+            [] ->\r
+                io:format(standard_error, "Usage: ~s~n", [Usage]),\r
+                halt(2);\r
+            Joined ->\r
+                list_to_binary(Joined)\r
+        end,\r
+\r
+    case rpc:call(Node, mnesia, dirty_read, [muc_online_room, {Room, Host}]) of\r
+        [R] ->\r
+            Pid = element(3, R),\r
+            gen_fsm:send_all_state_event(Pid, {service_message, Message});\r
+        [] ->\r
+            io:format(standard_error, "Room ~s@~s unavailable~n", [Room, Host]),\r
+            halt(1)\r
+    end.\r
+\r
+% vim:set filetype=erlang tabstop=4 expandtab:\r