From ec5b3ad545aadb265d316f06bf6168eac23e846a Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <erdnaxeli@cervoi.se>
Date: Wed, 27 May 2015 20:02:11 +0200
Subject: [PATCH] Fixes #27: no more #t tag with #t=42m51s in youtube url

---
 lib/commands/parser.pm | 4 ++--
 lib/commands/tag.pm    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm
index 418ad73..5489c8c 100644
--- a/lib/commands/parser.pm
+++ b/lib/commands/parser.pm
@@ -134,10 +134,10 @@ sub exec {
 
 sub tag {
     my ($msg, $chan) = @_;
-    my @tags = ($msg =~ /#([a-zA-Z0-9_-]+)/g);
+    my @tags = ($msg =~ /(?:^| )#([a-zA-Z0-9_]+)/g);
 
     my $id = utils::id::get($chan);
-    commands::tag::exec($id, "@tags");
+    commands::tag::exec($id, $msg);
 }
 
 1;
diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm
index c345def..aba63b6 100644
--- a/lib/commands/tag.pm
+++ b/lib/commands/tag.pm
@@ -6,7 +6,7 @@ our $log;
 sub exec {
     my ($id, $msg) = @_;
 
-    while ($msg =~ /#?([a-zA-Z0-9_]+)/g) {
+    while ($msg =~ /(?:^| )#?([a-zA-Z0-9_]+)/g) {
         addTag($id, $1);
     }
 }
-- 
GitLab