Jabber Bot
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Jabber Bot

on

  • 3,592 views

 

Statistics

Views

Total Views
3,592
Views on SlideShare
3,587
Embed Views
5

Actions

Likes
5
Downloads
41
Comments
0

2 Embeds 5

http://www.slideshare.net 3
http://www.linkedin.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Jabber Bot Presentation Transcript

  • 1. Jabber Bot By Ezwan Aizat bin Abdullah Faiz aizat.faiz@gmail.com http://aizatto.com http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  • 2. http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  • 3. http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  • 4. http://flickr.com/photos/warmnfuzzy/466382464/
  • 5. Who Am I? Go by many names Student ezwan aizat bin abdullah faiz Web Developer aizatto That out of shape zatto guy trying to climb a mountain
  • 6. Warning! http://tango.freedesktop.org
  • 7. There will be CODE http://tango.freedesktop.org
  • 8. a persons ability to type/code is greatly impaired when presenting http://tango.freedesktop.org
  • 9. BDD Behavior Driven Development http://behaviour-driven.org/ http://en.wikipedia.org/wiki/Behavior_Driven_Development http://flickr.com/photos/baboon/3946055/
  • 10. What is Jabber?
  • 11. What is XMPP? eXtensible Messaging and Presence Protocol http://en.wikipedia.org/wiki/XMPP
  • 12. why? http://flickr.com/photos/genewolf/147722495/
  • 13. fun http://flickr.com/photos/evank750i/306288390/
  • 14. services built on top of
  • 15. Straw Poll http://strawpollnow.com
  • 16. foamee http://foamee.com
  • 17. under construction...
  • 18. monitoring http://flickr.com/photos/parl/3231111/
  • 19. any other ideas? http://flickr.com/photos/genewolf/147722495/
  • 20. Lets start CODING! http://flickr.com/photos/warmnfuzzy/466382456/
  • 21. RubyGems Execute: sudo gem install xmpp4r ZenTest rspec daemons Optional: sudo gem install hpricot http://flickr.com/photos/mikeleary83/1729114228/
  • 22. Setup Directory Structure Execute: mkdir -p xmpp/{autotest,bin,db,config,lib,spec/sample} http://flickr.com/photos/mikeleary83/1729114228/
  • 23. Setup Autotest File: ./autotest/discover.rb Contents: Autotest.add_discovery do quot;rspecquot; end Execute: autotest http://flickr.com/photos/mikeleary83/1729114228/
  • 24. Create Spec for Client#apply_rules(message) File: ./spec/client_spec.rb http://flickr.com/photos/mikeleary83/1729114228/
  • 25. Implement Client#apply_rules(message) File: ./lib/client.rb http://flickr.com/photos/mikeleary83/1729114228/
  • 26. We would like to use actual XMPP messages We would like to use actual XMPP messages, serialized Need to capture them somehow Create Daemon to serialize messages, easier to recreate messages http://flickr.com/photos/mikeleary83/1729114228/
  • 27. Create Daemon File: ./config/jabber.yml File: ./bin/daemon.rb http://flickr.com/photos/mikeleary83/1729114228/
  • 28. Create Daemon Start: ruby bin/daemon.rb start Stop: ruby bin/daemon.rb stop http://flickr.com/photos/mikeleary83/1729114228/
  • 29. Wait for Tweets to come in and serialize http://flickr.com/photos/mikeleary83/1729114228/
  • 30. or use sample ones... http://flickr.com/photos/mikeleary83/1729114228/
  • 31. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:2877533quot; to=quot;aizat.faiz@gmail.comquot;> <body>seanx2: @strawpoll cat KITTIES FTW!!!</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / seanx2</title> <link href=quot;http://twitter.com/seanx2quot;/> <link href=quot;http://twitter.com/statuses/user_timeline/seanx2.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>seanx2</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/24969932/ seanx2_normal.png</icon> </source> <title>seanx2: @strawpoll cat KITTIES FTW!!!</title> <summary>seanx2: @strawpoll cat KITTIES FTW!!!</summary> <link href=quot;http://twitter.com/seanx2/statuses/777710064quot; rel=quot;alternatequot; type=quot;text/ htmlquot;/> <id>tag:twitter.com,2008-03-27T01:10:41+00:00:/statuses/777710064</id> <published>2008-03-27T01:10:41+00:00</published> <updated>2008-03-27T01:10:41+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  • 32. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:2877533quot; to=quot;aizat.faiz@gmail.comquot;> <body>seanx2: @strawpoll cat KITTIES FTW!!!</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / seanx2</title> <link href=quot;http://twitter.com/seanx2quot;/> <link href=quot;http://twitter.com/statuses/user_timeline/seanx2.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>seanx2</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/24969932/ seanx2_normal.png</icon> </source> <title>seanx2: @strawpoll cat KITTIES FTW!!!</title> <summary>seanx2: @strawpoll cat KITTIES FTW!!!</summary> <link href=quot;http://twitter.com/seanx2/statuses/777710064quot; rel=quot;alternatequot; type=quot;text/ htmlquot;/> <id>tag:twitter.com,2008-03-27T01:10:41+00:00:/statuses/777710064</id> <published>2008-03-27T01:10:41+00:00</published> <updated>2008-03-27T01:10:41+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  • 33. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:952601quot; to=quot;aizat.faiz@gmail.comquot;> <body>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / rajaseelan</title> <link href=quot;http://twitter.com/rajaseelanquot;/> <link href=quot;http://twitter.com/statuses/user_timeline/rajaseelan.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>rajaseelan</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/36242282/raja- profile_normal.png</icon> </source> <title>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</title> <summary>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</summary> <link href=quot;http://twitter.com/rajaseelan/statuses/777649976quot; rel=quot;alternatequot; type=quot;text/htmlquot;/> <id>tag:twitter.com,2008-03-26T22:48:10+00:00:/statuses/777649976</id> <published>2008-03-26T22:48:10+00:00</published> <updated>2008-03-26T22:48:10+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  • 34. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:952601quot; to=quot;aizat.faiz@gmail.comquot;> <body>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / rajaseelan</title> <link href=quot;http://twitter.com/rajaseelanquot;/> <link href=quot;http://twitter.com/statuses/user_timeline/rajaseelan.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>rajaseelan</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/36242282/raja- profile_normal.png</icon> </source> <title>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</title> <summary>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</summary> <link href=quot;http://twitter.com/rajaseelan/statuses/777649976quot; rel=quot;alternatequot; type=quot;text/htmlquot;/> <id>tag:twitter.com,2008-03-26T22:48:10+00:00:/statuses/777649976</id> <published>2008-03-26T22:48:10+00:00</published> <updated>2008-03-26T22:48:10+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  • 35. Hpricot A Fast, Enjoyable HTML Parser for Ruby http://code.whytheluckystiff.net/hpricot/ http://flickr.com/photos/mikeleary83/1729114228/
  • 36. i hpricot http://flickr.com/photos/mikeleary83/1729114228/
  • 37. I can use the serialized Tweets in the spec now File: ./spec/client_spec.rb http://flickr.com/photos/mikeleary83/1729114228/
  • 38. Flesh out my Bot File: ./spec/client_spec.rb File: ./lib/client.rb http://flickr.com/photos/mikeleary83/1729114228/
  • 39. Build your own bot Army! http://flickr.com/photos/dystopos/8921528/
  • 40. http://flickr.com/photos/dystopos/8921528/
  • 41. any other ideas? http://flickr.com/photos/genewolf/147722495/
  • 42. kthxbai aizat.faiz@gmail.com http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382466/