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