Created
August 11, 2009 18:48
-
-
Save cqr/166044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "jabberjaw" #I need a new name, since I am decoupling this from XMPP... | |
setup do | |
add_transport :xmpp, | |
:username => 'something', | |
:password => '*****', | |
:server => 'goteamfun.com' | |
add_transport :email, | |
:class => JabberJaw::Examples::POPJaw | |
:username => 'arragh', | |
:password => '********', | |
:server => 'goteamfun.com' | |
end | |
commands do | |
echo do | |
message | |
end | |
md5 do |encode_string| | |
send sender, MD5.hexdigest(encode_string) | |
end | |
subscribe :transports => [:email] do |list_names| | |
list_names.each {|list| lists[list] << sender} | |
"Subscribed to #{list_names.join(', ')}!" | |
end | |
end | |
command /(.+) command in the middle (.+)/ do |beginning, ending| | |
"This command does nothing." | |
end.help = "A useless command." | |
# manually invoking echo | |
JabberJaw::Commands::Echo.new(:email, | |
:from => 'chris@chrisrhoden.com', :message => "will send this to me in email") | |
# one can also use | |
# JabberJaw.invoke('echo', :email, :from ... | |
# Note that this should be a responder primarily, there are far better systems for just sending. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment