From 6578b70b9ee61731484cf63ad2b344d5181a5257 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Tue, 28 Jun 2022 15:09:49 +0200
Subject: Update bad word filter
---
.weechat/perl/bad-word-filter.pl | 55 ----------------------------------------
.weechat/perl/bad_word_filter.pl | 55 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 55 deletions(-)
delete mode 100644 .weechat/perl/bad-word-filter.pl
create mode 100644 .weechat/perl/bad_word_filter.pl
(limited to '.weechat')
diff --git a/.weechat/perl/bad-word-filter.pl b/.weechat/perl/bad-word-filter.pl
deleted file mode 100644
index 4443479..0000000
--- a/.weechat/perl/bad-word-filter.pl
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use utf8;
-
-weechat::register("rizon_chat_filter", "tyil", "0.1", "AGPL-3.0", "Do your part in keeping Christian channels safe and friendly", "", "");
-weechat::hook_modifier("input_text_for_buffer", "catch_send", "");
-
-sub catch_send {
- my ($data, $modifier_name, $buffer, $msg) = @_;
- my $buffer_name = weechat::buffer_get_string($buffer, 'name');
-
- # These are the channels (or really, buffers) on which self-harm
- # protections should be enabled.
- my @christian_channels = (
- 'freenode.##t',
- 'rizon.#chat',
- 'rizon.#stew',
- );
-
- # These are the words that may not be spoken.
- my @bad_words = (
- 'cuck',
- 'fag',
- 'kike',
- 'negro',
- 'nigga',
- 'nigger',
- );
-
- # First, the message can be returned as is unless this message is sent
- # into a Christian channel.
- my $christian_context = 0;
-
- for my $channel (@christian_channels) {
- if ($channel eq $buffer_name) {
- $christian_context = 1;
- }
- }
-
- return $msg unless $christian_context;
-
- # Next, see if there are any bad words in this message.
- for my $bad_word (@bad_words) {
- next unless $msg =~ m/$bad_word/;
-
- # BAD WORD DETECTED
- weechat::print($buffer, 'The power word "'.$bad_word.'" is unfit for this channel.');
- return "";
- }
-
- # It's a safe message, just return it.
- return $msg;
-}
diff --git a/.weechat/perl/bad_word_filter.pl b/.weechat/perl/bad_word_filter.pl
new file mode 100644
index 0000000..8a3a6ee
--- /dev/null
+++ b/.weechat/perl/bad_word_filter.pl
@@ -0,0 +1,55 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use utf8;
+
+weechat::register("bad_word_filter", "tyil", "0.1", "AGPL-3.0", "Do your part in keeping Christian channels safe and friendly", "", "");
+weechat::hook_modifier("input_text_for_buffer", "catch_send", "");
+
+sub catch_send {
+ my ($data, $modifier_name, $buffer, $msg) = @_;
+ my $buffer_name = weechat::buffer_get_string($buffer, 'name');
+
+ # These are the channels (or really, buffers) on which self-harm
+ # protections should be enabled.
+ my @christian_channels = (
+ 'freenode.##t',
+ 'rizon.#chat',
+ 'rizon.#stew',
+ );
+
+ # These are the words that may not be spoken.
+ my @bad_words = (
+ 'cuck',
+ 'fag',
+ 'kike',
+ 'negro',
+ 'nigga',
+ 'nigger',
+ );
+
+ # First, the message can be returned as is unless this message is sent
+ # into a Christian channel.
+ my $christian_context = 0;
+
+ for my $channel (@christian_channels) {
+ if ($channel eq $buffer_name) {
+ $christian_context = 1;
+ }
+ }
+
+ return $msg unless $christian_context;
+
+ # Next, see if there are any bad words in this message.
+ for my $bad_word (@bad_words) {
+ next unless $msg =~ m/$bad_word/;
+
+ # BAD WORD DETECTED
+ weechat::print($buffer, 'The power word "'.$bad_word.'" is unfit for this channel.');
+ return "";
+ }
+
+ # It's a safe message, just return it.
+ return $msg;
+}
--
cgit v1.1