1 #!/usr/bin/env escript
\r
2 %%! -sname sender@localhost
\r
4 %% Written by Holger Weiss <holger@zedat.fu-berlin.de>.
\r
8 % If the node name of your server is not 'ejabberd@localhost' (see the
\r
9 % "ejabberdctl status" output), you must change the @localhost part of
\r
10 % the node names above and below.
\r
12 % Apart from that, you must set Room and Host to the desired values
\r
18 Host = <<"conference.example.com">>,
\r
19 Node = 'ejabberd@localhost',
\r
20 Usage = "send-muc-message <message> ...",
\r
23 case string:join(Args, " ") of
\r
25 io:format(standard_error, "Usage: ~s~n", [Usage]),
\r
28 list_to_binary(Joined)
\r
31 case rpc:call(Node, mnesia, dirty_read, [muc_online_room, {Room, Host}]) of
\r
33 Pid = element(3, R),
\r
34 gen_fsm:send_all_state_event(Pid, {service_message, Message});
\r
36 io:format(standard_error, "Room ~s@~s unavailable~n", [Room, Host]),
\r
40 % vim:set filetype=erlang tabstop=4 expandtab:
\r