From: dms Date: Fri, 1 Sep 2000 13:18:45 +0000 (+0000) Subject: prevent dupes to be added; added debugging info if bot is not permitted to add topics... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f83f28c3970bf4b263bed9fa0a6706e24e1b3f27;p=infobot.git 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@66 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/Modules/Topic.pl b/blootbot/src/Modules/Topic.pl index 59ce3a8..04ed03e 100644 --- a/blootbot/src/Modules/Topic.pl +++ b/blootbot/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;