Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Xchat ':all';
- use warnings;
- use strict;
- Xchat::register('xHilight', '0.1', 'Script made for Tabibibles', &init);
- Xchat::hook_print('Channel Message', 'chanhook');
- my %hilights = ();
- sub init {
- Xchat::print('K');
- open my $fh, '<', (Xchat::get_info('xchatdir') . '/.xhilight');
- my $scope;
- while (<$fh>) {
- chomp;
- my $scope;
- if (/^\[(.+?)\]/) {
- my $result = $1;
- $result =~ s/\s+|\t+//g;
- $scope = $result;
- $hilights{$scope} = {};
- Xchat::print($scope);
- next;
- }
- m/^(.+?)=(.+?)/ or next;
- $1 =~ s/\s+|\t+//g;
- $hilights{$scope}{$1} = $2;
- }
- }
- sub chanhook {
- foreach my $key (keys(%hilights)) {
- if($_[0][1] eq $key) {
- my $format = $hilights{$key}{CHANNEL};
- $format =~ s/\%C/\x03/g;
- $format =~ s/\%prefix\%/$_[0][3]/g;
- $format =~ s/\%nick\%/$_[0][1]/g;
- $format =~ s/\%div\%/\t/g;
- $format =~ s/\%msg\%/$_[0][2]/g;
- Xchat::print( $format );
- return Xchat::EAT_ALL;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement