Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perl & xChat: Highlight Logger with On/Off option
#1
Wrote another Perl script for xChat. It logs all Highlights to a query window while you are away so it's easy to see all of them when you're back. You can set it On or Off by just typing command "/hilight_on" or "/hilight_off".

I find it very useful because I usually leave my computer running for the night and with this script I can see all the highlights in the morning.

Code:
#!/usr/bin/perl

use strict;
use warnings;

# Highlight logger by B22stard
# Visit http://punkz0r.planet.ee

my $away = 0; # Automatically on = 1
Xchat::register("Highlight Logger", "1.0", "Highlight Logger");

Xchat::hook_print("Channel Msg Hilight", "highlight");
Xchat::hook_print("Channel Action Hilight", "actionhighlight");
Xchat::hook_command("hilight_on", "hilight_on");
Xchat::hook_command("hilight_off", "hilight_off");

Xchat::print("Loaded: Perl HighLight logger script by B22stard.");

sub hilight_on {
    $away = 1;
    Xchat::print("Will now log Highlights");
    return 1;
}

sub hilight_off {
    $away = 0;
    Xchat::print("Will no longer log Highlights");
    return 1;
}

sub highlight {
    if ($away) {
      my $whom = $_[0][0];
      my $text = $_[0][1];
      my $chan = Xchat::get_info('channel');
      my $serv = Xchat::get_info('server');

      Xchat::command("query (HighLights)", "", "$serv");
      Xchat::print("$whom\t$text (7$chan, 7$serv)", "(HighLights)", "$serv");
    return Xchat::EAT_NONE;
    }
}

sub actionhighlight {
  if ($away) {
    my $whom = $_[0][0];
    my $text = $_[0][1];
    my $chan = Xchat::get_info('channel');
    my $serv = Xchat::get_info('server');

    Xchat::command("query (HighLights)", "", "$serv");
    Xchat::print("$whom\t$text (7$chan, 7$serv)", "(HighLights)", "$serv");
  return Xchat::EAT_NONE;
  }
}

Pastebin: http://pastebin.com/f5bb602a3
Originally posted on Punkz0r Blog by me
Reply


Messages In This Thread
Perl & xChat: Highlight Logger with On/Off option - by jolttz - 10-13-2009, 06:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compile Error in Perl liveproject101 0 1,175 04-12-2013, 03:08 AM
Last Post: liveproject101
  [Perl] IRC Bot wchar_t 26 13,119 08-20-2012, 01:40 PM
Last Post: Trump
  Perl Ebook ven0m 2 1,661 05-04-2012, 08:14 AM
Last Post: ven0m
  Help with a program written in perl Rodman42866 1 1,557 03-09-2012, 03:16 AM
Last Post: AceInfinity
  HTML perl script AceInfinity 5 2,461 12-03-2011, 11:35 PM
Last Post: Closed Account

Forum Jump:


Users browsing this thread: 1 Guest(s)