(.+)<\/span>/).to_s
message[:message] = msg.scan(/(.+)<\/div>/).to_s
messages << message
end
end
end
end
if block_given?
messages.each do |msg|
yield msg
end
end
messages
end
def topic(message)
puts "Changing topic to #{message}" if @debug
res = @req.post("/room/#{@room_id}/change_topic", "commit=Save&room[topic]=#{CGI.escape(message.to_s)}", @headers)
puts res.body if @debug
end
def say(message, paste=false)
puts "Posting #{message}" if @debug
res = @req.post("/room/#{@room_id}/speak", "#{'paste=true&' if paste}message=#{CGI.escape(message.to_s)}", @headers)
puts res.body if @debug
end
end
if $0 == __FILE__
if ARGV.size != 3
puts "Usage: marshmallow https://username:password@domain.campfirenow.com/rooms/1234 [say|paste] 'Hello world!'"
else
print "Sending... "
$stdout.flush
to, how, what = *ARGV
Marshmallow.send(how, to, what)
puts "DONE!"
end
end