Note to my female readers: Sorry, I’m addicted to programming

Because of my UNIX backgrounds I feel most comfortable working in the black (My girlfriends’ terminology of ‘a terminal’). Also, I’m a frequent IRC chat user. Actually, after booting up my computer, the first thing I do is re-attach my IRC session. Therefore I think it’s only adequate for me to make my personal manager available ‘in the black’.

This weekend I couldn’t resist taking a few hours to quick-and-dirty mashup these:

  • Backpack IRC interface (bot)
  • Backpack Command Line Interface (cli)

code: backpack_tt-290107.tar.gz (written in Ruby of course)

Since my domain darkwired.org is only used for IRC (chatting) I decided to write a web interface. The Web interface uses the EyeRC API and is built on RubyOnRails.

Currently, you can join our test channel on http://www.darkwired.org/ :

I have no intention to develop it any further, however, I might take some time to finish it off (sourcecode):

  • refactoring
  • unit test case

I hope this was the last IRC client I ever wrote :)

(related code: BASH IRC Client )

Code update: Ruby-EyeAreSee

on January 18, 2007

At the moment I’m working on a little web-IRC client. My intention was to use the Ruby-IRC Framework, but I’ve decided to write my own API for the following reasons:

  • It is impossible to establish multiple connections (multi-user) in the same process
  • Event-handlers can not be flexible.
  • After disconnecting it’s almost impossible to reconnect using the same instance or a new one.

Now I have a slim SSL capable IRC API that fulfills all my needs.

Click here to view examples and documentation

Click here to download the API (Beer-Ware Licensed)

example IRC client:

require 'EyeAreSee'

irc = EyeAreSee.new("EyeAreSee", "irc.darkwired.org", :ssl => true, :channel => "#test")

# catch all lines for debugging
irc.on_message { |line|
  puts "debug: "+line if $DEBUG
}

# catch all server messages, eg nickname already in use
irc.on_server_message { |event|
  next if event[:code] == 372
  puts event[:code].to_s+": "+event[:message]
}

# handle 372 messages (Message of the Day)
irc.on_server_message(372) { |event|
  puts "motd: "+event[:message]
}

# display all messages directed to the #test channel
irc.on_message("privmsg", :to => "#test") { |event|
  puts event[:from_nickname].to_s+" says: "+event[:message].to_s
}

# auto-response to private message from specific user
irc.on_message("privmsg", :to => "EyeAreSee", :from_nickname => "Drakonen") { |event|
  sleep(rand*10)
  responses = ["hmmmz", "boeiend", "interessant"]
  irc.message event[:from_nickname], responses[(rand*3).to_i]
}

# display all messages directed to the #test channel
irc.on_message("privmsg", :to => "#test", :message => "please go away EyeAreSee") { |event|
  irc.message("#test", "OK "+event[:from_nickname]+", bye everyone!") 
  irc.quit
}

irc.start
irc.start #reconnect once after a quit

Code update: Ruby XMMS Hack

on January 13, 2007

Control XMMS (nix audio player) without any third party libraries (No Ruby-XMMS, no libxmms).

Why? This might be useful for some specific cases. My case: I needed to know the low-level protocol in order to port it to a different language. This Ruby script is a quick hack to test my understanding of the protocol.

xmms_hack.rb

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