I'm a regular user of the excellent #catbox system. But I've long wanted it to appear like a proper irc channel. This would mean

  • No need to preface every utterance with "/msg catboxer SAY".
  • messages arriving from their real users, not from catboxer itself.
Proper integration! It'd be great!

Well, here's a bit of perl for X-Chat that does these things. Logon to #catbox, register with catboxer in the normal way, then run this. (NB- I use black-on-white colours. If you use something else, you might have to poke around with the colour codes near the start.)




#! /usr/bin/perl 

# The X-Chat #catbox integrator v1.1
# This script makes #catbox behave like a 'proper' irc channel.
# Incomming messages appear to be from [e2_user], and not <catboxer>
# Text you enter is sent to the Chatterbox, not #catbox

# Known limitations : will only work for the current #catbox setup
#                     Only tested by me, on my box, and my v1.8.9 X-Chat

# v1.0 - initial release
# v1.1 - now with coloured brackets!

IRC::register ("catbox integrator", "1.0", "finishup", ""); 
IRC::add_message_handler("PRIVMSG", "incomming"); 
IRC::add_command_handler("", "outgoing");

$blue = "\00302";
$black = "\00301"; 
$bra = $blue . "\[" .$black ;
$ket = $blue. "\]" . $black . "\t"; 
$prefix = $blue . "\*" . $black . "\t";

IRC::print($prefix); 
IRC::print($prefix . "Starting up the #catbox integrator"); 
IRC::print($prefix . "This script makes the #catbox channel behave in a more transparent way.");
IRC::print($prefix . "You need to register with catboxer in the normal way to send messages. Try '/msg catboxer HELP' for more info."); 
IRC::print($prefix . "To send actions (/me dances) or messages (/msg bones You Suck!), preface the '/' with a space"); 
IRC::print($prefix . "Send abuse to [spiregrain]."); 
IRC::print($prefix); 
IRC::print($prefix . "OK, lets go!"); 
IRC::print($prefix); 

sub finishup {
IRC::print($prefix); 
IRC::print($prefix . "OK, Bye!"); 
IRC::print($prefix); 
}

sub outgoing {
        
        $command = $_[0];
        
        if (IRC::get_info(2) eq "#catbox") { 
                IRC::print("{Sending...}\t" .  $command);
                IRC::command("/msg catboxer SAY " . $command);

                return 1;
        }
        
        return 0;
}

sub incomming {

        $msg = $_[0];

        if ($msg =~ /:catboxer!\S* PRIVMSG #catbox :([^:]*): (.*)/)
        {
                $e2speaker = $1; # should be noder's name
                $e2msg   = $2; # should be noder's text
        
                IRC::print($bra . $e2speaker . $ket . $e2msg);
                return 1;

        } 
        elsif ($msg =~ /:catboxer!\S* PRIVMSG #catbox :(.*)/)
        {
                $e2msg = $1; # should be full msg

                IRC::print($bra . "\*" . $ket . $e2msg);
                return 1;

        }

        return 0;
}





Todo:
  • It might be possible to manipulate the X-Chat list of other users to match the e2 other users list, or some constructed list of currently-chattering users. This would enable tab-completion of usernames, amongst other things.
  • Also it doesn't respond well to incomming action messages that contain a :. This is a weekness of the catboxer system. I can't think of any way round it.
  • I now know that it doesn't send messages correctly in X-Chat 2.0.0. I think this is a bug in X-Chat, and have filed a Bug Report. You can work around this by prefixing each line with a space.

Log in or registerto write something here or to contact authors.