From b9433127d1f00f0316f6680c2432d206c45c916a Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 31 May 2014 01:08:01 +0000 Subject: [PATCH] Improve wildcard handling --- PBot/MessageHistory_SQLite.pm | 6 ++---- PBot/Quotegrabs_SQLite.pm | 10 +++++++--- PBot/VERSION.pm | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/PBot/MessageHistory_SQLite.pm b/PBot/MessageHistory_SQLite.pm index 119b2fef..a540845c 100644 --- a/PBot/MessageHistory_SQLite.pm +++ b/PBot/MessageHistory_SQLite.pm @@ -472,10 +472,8 @@ sub recall_message_by_count { sub recall_message_by_text { my ($self, $id, $channel, $text, $ignore_command) = @_; - $text =~ s/\.\*\?/%/g; - $text =~ s/\.\*/%/g; - $text =~ s/\*/%/g; - $text =~ s/\?/_/g; + $text =~ s/\.?\*\??/%/g; + $text =~ s/\./_/g; my $messages; diff --git a/PBot/Quotegrabs_SQLite.pm b/PBot/Quotegrabs_SQLite.pm index a3024603..2c095e32 100644 --- a/PBot/Quotegrabs_SQLite.pm +++ b/PBot/Quotegrabs_SQLite.pm @@ -101,9 +101,13 @@ sub get_quotegrab { sub get_random_quotegrab { my ($self, $nick, $channel, $text) = @_; - $nick =~ s/\.?\*/%/g if defined $nick; - $channel =~ s/\.?\*/%/g if defined $channel; - $text =~ s/\.?\*/%/g if defined $text; + $nick =~ s/\.?\*\??/%/g if defined $nick; + $channel =~ s/\.?\*\??/%/g if defined $channel; + $text =~ s/\.?\*\??/%/g if defined $text; + + $nick =~ s/\./_/g if defined $nick; + $channel =~ s/\./_/g if defined $channel; + $text =~ s/\./_/g if defined $text; my $quotegrab = eval { my $sql = 'SELECT * FROM Quotegrabs '; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 9ddc4efe..cb1ac9d0 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 606, + BUILD_REVISION => 607, BUILD_DATE => "2014-05-30", };