Advertisement
Guest User

Untitled

a guest
Nov 20th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Simple script for removing colours in public channels :)
  2.  
  3. use strict;
  4. use Irssi;
  5. use vars qw($VERSION %IRSSI);
  6.  
  7. # Dev. info ^_^
  8. $VERSION = "0.3";
  9. %IRSSI = (
  10. authors => "Jørgen Tjernø",
  11. contact => "darkthorne\@samsen.com",
  12. name => "CleanPublic",
  13. description => "Simple script that removes colors and other formatting (bold, etc) from public channels",
  14. license => "GPL",
  15. url => "http://mental.mine.nu",
  16. changed => "Wed Sep 24 13:17:15 CEST 2003"
  17. );
  18.  
  19. # All the works
  20. sub strip_formatting {
  21. my ($server, $data, $nick, $mask, $target) = @_;
  22. # Channel *allowed* to be colorful?
  23. foreach my $chan (split(' ', Irssi::settings_get_str('colored_channels'))) {
  24. if ($target eq $chan) { return }
  25. }
  26.  
  27. # Ruthlessly_ripped_from_Garion {
  28. my $twin = Irssi::window_find_name($target);
  29. # Beam it to window 1 if we cant find any other suitable target.
  30. if (!defined($twin)) { $twin = Irssi::window_find_refnum(1); }
  31. # }
  32.  
  33. # Remove formatting
  34. $data =~ s/\x03\d?\d?(,\d?\d?)?|\x02|\x1f|\x1d|\x16|\x06|\x07//g;
  35. # Let it flow
  36. Irssi::signal_continue($server, $data, $nick, $mask, $target);
  37. }
  38.  
  39. # Hook me up
  40. Irssi::signal_add('message public', 'strip_formatting');
  41. Irssi::settings_add_str('lookandfeel', 'colored_channels', '');
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement