--- /dev/null
+#!/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