swarley

Untitled

Jan 30th, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. use Xchat ':all';
  2. use warnings;
  3. use strict;
  4.  
  5. Xchat::register('xHilight', '0.1', 'Script made for Tabibibles', &init);
  6. Xchat::hook_print('Channel Message', 'chanhook');
  7.  
  8. my %hilights = ();
  9.  
  10. sub init {
  11. Xchat::print('K');
  12. open my $fh, '<', (Xchat::get_info('xchatdir') . '/.xhilight');
  13. my $scope;
  14.  
  15. while (<$fh>) {
  16. chomp;
  17. my $scope;
  18. if (/^\[(.+?)\]/) {
  19. my $result = $1;
  20. $result =~ s/\s+|\t+//g;
  21. $scope = $result;
  22. $hilights{$scope} = {};
  23. Xchat::print($scope);
  24. next;
  25. }
  26. m/^(.+?)=(.+?)/ or next;
  27. $1 =~ s/\s+|\t+//g;
  28. $hilights{$scope}{$1} = $2;
  29.  
  30. }
  31. }
  32. sub chanhook {
  33. foreach my $key (keys(%hilights)) {
  34. if($_[0][1] eq $key) {
  35. my $format = $hilights{$key}{CHANNEL};
  36. $format =~ s/\%C/\x03/g;
  37. $format =~ s/\%prefix\%/$_[0][3]/g;
  38. $format =~ s/\%nick\%/$_[0][1]/g;
  39. $format =~ s/\%div\%/\t/g;
  40. $format =~ s/\%msg\%/$_[0][2]/g;
  41. Xchat::print( $format );
  42. return Xchat::EAT_ALL;
  43. }
  44. }
  45. }
Add Comment
Please, Sign In to add comment