From 947c02157e300a7a1e3a5b2fc5c4ec96544d69e1 Mon Sep 17 00:00:00 2001
From: David Phillips <david@sighup.nz>
Date: Mon, 10 Jul 2017 21:37:26 +1200
Subject: Make url_title and tittilate colour- and formatting-blind

---
 plugin/tittilate.pm | 2 ++
 plugin/url_title.pm | 3 +++
 2 files changed, 5 insertions(+)

(limited to 'plugin')

diff --git a/plugin/tittilate.pm b/plugin/tittilate.pm
index a1ea7f3..b7994c3 100644
--- a/plugin/tittilate.pm
+++ b/plugin/tittilate.pm
@@ -4,6 +4,7 @@ package plugin::tittilate;
 
 use strict;
 use warnings;
+use IRC::Utils qw(strip_color strip_formatting);
 
 my %config;
 
@@ -16,6 +17,7 @@ sub configure {
 
 sub message {
 	my ($self, $me, $who, $where, $what) = @_;
+	$what = strip_color(strip_formatting($what));
 	my $gathered = "";
 	my @expressions = (keys %{$config{triggers}});
 	my $expression = join '|', @expressions;
diff --git a/plugin/url_title.pm b/plugin/url_title.pm
index 5364677..654b2ae 100644
--- a/plugin/url_title.pm
+++ b/plugin/url_title.pm
@@ -6,6 +6,7 @@ use strict;
 use warnings;
 use HTTP::Tiny;
 use HTML::HeadParser;
+use IRC::Utils qw(strip_color strip_formatting);
 
 my %config;
 
@@ -21,6 +22,8 @@ sub message
 	my ($self, $me, $who, $where, $what) = @_;
 	my $url;
 
+	$what = strip_color(strip_formatting($what));
+
 	if ($what =~ /(https?:\/\/[^ ]+)/i) {
 		$url = $1;
 	}
-- 
cgit v1.1