Support Forums

Full Version: Perl & xChat: Highlight Logger with On/Off option
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
nice! that is useful! good job.
Pro!

Thanks!
Thanks bro nice tut
This is why php is my next language. lol. Tongue
thank you!
sir!
I started using this on my mac....Thanks, it is particularly helpful at work.
very useful.... thanks!! :-)