Dominiek web, technology and startups
about 1 year ago
Tweet this Bookmark and Share

Code update: Ruby-IRC SSL Hack

I haven’t been doing much programming lately since I had to write my final thesis. Sometimes however, I cannot resist coding a little piece :]

Ruby-IRC is an IRC Framework which is still in the BETA stage (what isn’t?). I wanted to write a little piece of code to connect with my IRC server: irc.darkwired.org. Fortunatle, Darkwired IRC requires SSL connection, so I had to hack the Framework a little.

Example code (
ssl_irc_example.rb )

 
require 'rubygems'
require 'IRC'
require 'IRCSSLConnection'

$IRC_DEBUG = true
bot = IRC.new("irc20", "irc.darkwired.org", "9999", "irc20")
IRCEvent.add_callback('endofmotd') { 
	|event| bot.add_channel('#rtest') 
}
IRCEvent.add_callback('join') { |event|
    bot.send_message(event.channel, "Bonjour! Ik ben #{event.from}")
}

bot.connect
 

How to use?

1. download IRCSSLConnection.rb from one of my junk archives. 2. EITHER: You can replace the FrameWork’s IRCConnection.rb file with this new one (eg cp IRCSSLConnection.rb /usr/lib/ruby/gems/1.8/gems/Ruby-IRC-1.0.7/lib/IRCConnection.rb) 2. OR: Just leave it in the directory of your script and include it

blog comments powered by Disqus

About

I'm a 22 year old Web Developer who is currently engaged in RubyOnRails consulting. Apart from obsessing about many technology related topics, I enjoy traveling and international life. In the coming months I intend to boost up my entrepreneurial activities, so stay tuned!

Creative Commons License

All content on this blog is available under the Creative Commons Attribution 3.0 License. Dominiek.com is running Kakuteru a new Semantic-Web enabled lifestreamer. Design and interaction inspired by Yonfook's Sweetcron. Most icons used are by Joseph North.