<commit_before>#!/usr/bin/perl
#
# bzirc.pl - A script that echoes messages from a bzflag server to an IRC
#            channel and from the channel to the server.
#
# Use it like this:
# bzirc.pl <IRCNICK> <IRCHOST>:<PORT> <CHANNEL> <BZADMINOPTS> <BZNICK>@<BZHOST>
#
# Inspired by ircbot.pl by <EMAIL> (http://www.metalshell.com).
#
# This script uses the POE and POE::Component::IRC modules.
# A simple way to get these is using the cpan module.
# perl -MCPAN -eshell
# cpan> install POE
# cpan> install POE::Component::IRC



#FIXME: Why not make this available as a bzfs command? something like /irc irc.freenode.net #bzflag Hello world!
use strict;
use IPC::Open2;
use POE;
use POE::Component::IRC;


# some global variables
my ($nick, $host, $port, $channel, $callsign, $bzopts,
    $bzadminpid, $bzin, $bzout, $c);
$nick = @ARGV[0];
$host = @ARGV[1];
$c = index($host, ':');
if ($c != -1) {
  $port = substr($host, $c + 1, length($host));
  $host = substr($host, 0, $c);
}
else {
  $port = 6667;
}
$channel = @ARGV[2];
$callsign = '@' . substr($ARGV[$#ARGV], 0, index($ARGV[$#ARGV], '@'));
$bzopts = join ' ', @ARGV[3..$#ARGV];
$bzadminpid;
$bzin;
$bzout;


# do some POE magic
POE::Component::IRC->new("irc_client");
POE::Session->new(_start     => \&irc_start,
		  irc_join   => \&irc_join,
		  irc_quit   => \&irc_quit,
		  irc_376    => \&irc_connect,
		  irc_public => \&irc_pub_msg,
		  bzreadable => \&readfrombz);


# a handler that is called once when this session is started
sub irc_start {
  my $kernel = $_[KERNEL];
  my $heap = $_[HEAP];<commit_msg>Fix the script to work with newer versions of the POE module.<commit_after>#!/usr/bin/perl
#
# bzirc.pl - A script that echoes messages from a bzflag server to an IRC
#            channel and from the channel to the server.
#
# Use it like this:
# bzirc.pl <IRCNICK> <IRCHOST>:<PORT> <CHANNEL> <BZADMINOPTS> <BZNICK>@<BZHOST>
#
# Inspired by ircbot.pl by <EMAIL> (http://www.metalshell.com).
#
# This script uses the POE and POE::Component::IRC modules.
# A simple way to get these is using the cpan module.
# perl -MCPAN -eshell
# cpan> install POE
# cpan> install POE::Component::IRC



#FIXME: Why not make this available as a bzfs command? something like /irc irc.freenode.net #bzflag Hello world!
use strict;
use IPC::Open2;
use POE;
use POE::Component::IRC;


# some global variables
my ($nick, $host, $port, $channel, $callsign, $bzopts,
    $bzadminpid, $bzin, $bzout, $c);
$nick = @ARGV[0];
$host = @ARGV[1];
$c = index($host, ':');
if ($c != -1) {
  $port = substr($host, $c + 1, length($host));
  $host = substr($host, 0, $c);
}
else {
  $port = 6667;
}
$channel = @ARGV[2];
$callsign = '@' . substr($ARGV[$#ARGV], 0, index($ARGV[$#ARGV], '@'));
$bzopts = join ' ', @ARGV[3..$#ARGV];
$bzadminpid;
$bzin;
$bzout;


# do some POE magic
POE::Component::IRC->spawn(alias => "irc_client");
POE::Session->create(
	inline_states => {
		  _start     => \&irc_start,
		  irc_join   => \&irc_join,
		  irc_quit   => \&irc_quit,
		  irc_376    => \&irc_connect,
		  irc_public => \&irc_pub_msg,
		  bzreadable => \&readfrombz
	}
);


# a handler that is called once when this session is started
sub irc_start {
  my $kernel = $_[KERNEL];
  my $heap = $_[HEAP];
{'fraction_non_alphanumeric': 0.17559615980179621, 'fraction_numerical': 0.009910188912976153, 'mean_word_length': 3.871794871794872, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6221669', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1258, 'n_words': 361}