Skip to content

Instantly share code, notes, and snippets.

@lysol
Created September 9, 2010 16:52
Show Gist options
  • Save lysol/572163 to your computer and use it in GitHub Desktop.
Save lysol/572163 to your computer and use it in GitHub Desktop.
# Redact the seditious statements of your chosen list of nicks with easily
# cracked encryption.
#
# /set redact_nicks nick1 ... nickn
#
# Their stuff still gets logged,
# but you don't have to see them unless you want to,
# in which case you can select the text with yr mouse.
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (
authors => "rupa",
name => "redact",
description => "redact the words of those tiresome or officious.",
license => "BSD",
);
sub redact_it {
my ($server, $data, $nick, $mask, $target) = @_;
my $result = 0;
foreach (split(' ', Irssi::settings_get_str('redact_words')))
{
$result = 1 if ($data =~ /$_/);
}
if( grep(/^$nick$/, split(' ', Irssi::settings_get_str('redact_nicks')))
|| $result == 1)
{
# black on black
$data = "\0031,1" . $data;
}
Irssi::signal_continue($server, $data, $nick, $mask, $target);
}
Irssi::signal_add('message public', 'redact_it');
Irssi::signal_add('message irc action', 'redact_it');
Irssi::settings_add_str('ministryoftruth', 'redact_nicks', 'redubious');
Irssi::settings_add_str('ministryoftruth', 'redact_words', 'WoW');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment