ircyrano

reenact cyrano de bergerac on an IRC server
git clone https://a3nm.net/git/ircyrano/
Log | Files | Refs | README

prefix.pl (371B)


      1 #!/usr/bin/perl
      2 
      3 my $prefix;
      4 my $skip;
      5 
      6 while (<>) {
      7   if (/^([^ a-z(][^a-z(]*)(( \(|:).*)$/) {
      8     $prefix = $1;
      9     if ($2 =~ / \((.*)/) {
     10       print "<$prefix> /me $1\n";
     11     }
     12     $skip = 1;
     13   }
     14   $prefix = "" if /^$/;
     15   if (!$skip) {
     16     if ($prefix) {
     17       print "<$prefix>$_";
     18     } else {
     19       print "<ER> $_" if (!/^$/);
     20     }
     21   } else {
     22     $skip = 0;
     23   }
     24 }