From Mexico.purplecow.org

Revision as of 00:14, 27 May 2009 by Mexicowiki (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

This jabber send script is pure cargo-cult mess, but it works most of the time. The sleep is there because sometimes ruby will "run off the end" and die before delivering the messages without it. Ruby, huh?

#!/opt/coolstack/bin/ruby
require 'rubygems'
require 'xmpp4r-simple'
require 'optparse'
require 'ostruct'


taddr = nil
tmsg = nil

opts = OptionParser.new do |opts|
        opts.on("-a [ADDR]") do 
                |a|
                taddr = a
        end
        opts.on("-m [MSG]") do
                |m|
                tmsg = m
        end
end

opts.parse!(ARGV)

silly = Jabber::Simple.new('jid@domain', 'password')

silly.status(nil, 'On the job')

silly.deliver(taddr,tmsg)



sleep 2
silly.disconnect