Code update: Ruby-IRC SSL Hack

on January 13, 2007

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

1 Response to “Code update: Ruby-IRC SSL Hack”

  1. fry says:

    "Detected Socket Close" always have that output and bot doesn't join irc where is the problem?

Leave a Reply