Skip to content

Instantly share code, notes, and snippets.

@cqr
Created August 11, 2009 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cqr/166044 to your computer and use it in GitHub Desktop.
Save cqr/166044 to your computer and use it in GitHub Desktop.
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