From 5c27f1deb53d8ceff6a14b478e64e87b396b1a4c Mon Sep 17 00:00:00 2001 From: dms Date: Fri, 1 Sep 2000 13:18:45 +0000 Subject: [PATCH] prevent dupes to be added; added debugging info if bot is not permitted to add topics (+t/-o). git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@66 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/Modules/Topic.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Modules/Topic.pl b/src/Modules/Topic.pl index 59ce3a8..04ed03e 100644 --- a/src/Modules/Topic.pl +++ b/src/Modules/Topic.pl @@ -24,8 +24,6 @@ sub topicDecipher { return; } - &DEBUG("Topic: hrm => '$topic{$chan}{'Current'}'."); - foreach (split /\|\|/, $topic{$chan}{'Current'}) { s/^\s+//; s/\s+$//; @@ -43,6 +41,11 @@ sub topicDecipher { $owner = $2; } + if (grep /^$subtopic\|\|$owner$/, @results) { + &DEBUG("topic: we have found a dupe in the topic, not adding."); + next; + } + push(@results, "$subtopic||$owner"); } @@ -76,6 +79,11 @@ sub topicNew { my ($chan, $topic, $updateMsg, $topicUpdate) = @_; my $maxlen = 470; + &DEBUG("topic: chan{$chan} is +t.") if ($channels{$chan}{t}); + &DEBUG("topic: chan{$chan} is -t.") unless ($channels{$chan}{t}); + &DEBUG("topic: I have +o.") if ($channels{$chan}{o}{$ident}); + &DEBUG("topic: I don't have +o.") unless ($channels{$chan}{o}{$ident}); + if ($channels{$chan}{t} and !$channels{$chan}{o}{$ident}) { &msg($who, "error: cannot change topic without ops. (channel is +t) :("); return 0; -- 2.39.5