Support Forums
Perl & xChat: Highlight Logger with On/Off option - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Perl Programming Support (https://www.supportforums.net/forumdisplay.php?fid=31)
+---- Thread: Perl & xChat: Highlight Logger with On/Off option (/showthread.php?tid=1390)



Perl & xChat: Highlight Logger with On/Off option - jolttz - 10-13-2009

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


RE: Perl & xChat: Highlight Logger with On/Off option - p0w3r0fchr1st - 10-13-2009

nice! that is useful! good job.


RE: Perl & xChat: Highlight Logger with On/Off option - Extasey - 10-13-2009

Pro!

Thanks!


RE: Perl & xChat: Highlight Logger with On/Off option - Akshay* - 10-13-2009

Thanks bro nice tut


RE: Perl & xChat: Highlight Logger with On/Off option - Socrates - 10-14-2009

This is why php is my next language. lol. Tongue


RE: Perl & xChat: Highlight Logger with On/Off option - chinaman7x7 - 10-15-2009

thank you!
sir!


RE: Perl & xChat: Highlight Logger with On/Off option - bsdpunk - 10-21-2009

I started using this on my mac....Thanks, it is particularly helpful at work.


RE: Perl & xChat: Highlight Logger with On/Off option - nextlive - 12-25-2009

very useful.... thanks!! :-)