Guest User

Untitled

a guest
Oct 26th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. # Name: channel_highlight-0.3.pl
  2. # Version: 0.3
  3. # Author: LifeIsPain < idontlikespam (at) orvp [dot] net >
  4. # Date: 2010-06-26
  5. # Description: Specify additional highlight words on a per channel basis
  6.  
  7. # Version History
  8. # 0.1 2008-11-14 Initial Version
  9. # 0.2 2008-11-14 Cleanup
  10. # 0.3 2010-06-26 Highlights now more highlighty (change tab color)
  11.  
  12.  
  13. use warnings;
  14. use strict;
  15. use Xchat qw( :all );
  16.  
  17. #$FH = "home";
  18. #$FilePath = "/home/default/.xchat2/sounds/Home.mp3";
  19.  
  20.  
  21.  
  22. my $name = 'Channel Highlight';
  23. my $version = '0.3';
  24.  
  25. register($name, $version, 'Allow for a per-channel based highlight list');
  26. prnt("Loading $name $version");
  27.  
  28. for ('Channel Message', 'Channel Action') {
  29. hook_print($_, \&channel_highlight, { priority => PRI_HIGHEST, data => $_ });
  30. }
  31.  
  32. # todo: among other things, escape extra characters like ( ) { } [ ] ' | when importing and building this list, perhaps , separate?
  33.  
  34. my %chan_highlights = (
  35. '#alliance' => '(--\> My Country)'
  36. # '#chan2' => '(peppers)'
  37. );
  38.  
  39. sub channel_highlight {
  40.  
  41. if (exists $chan_highlights{lc get_info('channel')} && $_[0][1] =~ m/(?:^|\W)$chan_highlights{lc get_info('channel')}(?:$|\W)/i)
  42. {
  43. my $event = $_[1];
  44.  
  45. if ($event eq 'Channel Message') { $event = 'Channel Msg Hilight'; }
  46. else { $event = 'Channel Action Hilight'; }
  47.  
  48. command ('gui color 3');
  49. # system('vlc /home/default/.xchat2/sounds/Home.mp3');
  50. command('splay "/home/default/.xchat2/sounds/Home.mp3"');
  51.  
  52.  
  53. emit_print( $event, @{$_[0]} );
  54. return EAT_ALL;
  55. }
  56. return EAT_NONE;
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment