Guest User

Untitled

a guest
Apr 14th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. require "jabberjaw" #I need a new name, since I am decoupling this from XMPP...
  2.  
  3. setup do
  4. add_transport :xmpp,
  5. :username => 'something',
  6. :password => '*****',
  7. :server => 'goteamfun.com'
  8.  
  9. add_transport :email,
  10. :class => JabberJaw::Examples::POPJaw
  11. :username => 'arragh',
  12. :password => '********',
  13. :server => 'goteamfun.com'
  14. end
  15.  
  16. commands do
  17. echo do
  18. message
  19. end
  20.  
  21. md5 do |encode_string|
  22. send sender, MD5.hexdigest(encode_string)
  23. end
  24.  
  25. subscribe :transports => [:email] do |list_names|
  26. list_names.each {|list| lists[list] << sender}
  27. "Subscribed to #{list_names.join(', ')}!"
  28. end
  29. end
  30.  
  31. command /(.+) command in the middle (.+)/ do |beginning, ending|
  32. "This command does nothing."
  33. end.help = "A useless command."
  34.  
  35. # manually invoking echo
  36. JabberJaw::Commands::Echo.new(:email,
  37. :from => 'chris@chrisrhoden.com', :message => "will send this to me in email")
  38. # one can also use
  39. # JabberJaw.invoke('echo', :email, :from ...
  40. # Note that this should be a responder primarily, there are far better systems for just sending.
Add Comment
Please, Sign In to add comment