]> git.donarmstrong.com Git - infobot.git/commitdiff
prevent dupes to be added; added debugging info if bot is not permitted to add topics...
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 1 Sep 2000 13:18:45 +0000 (13:18 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 1 Sep 2000 13:18:45 +0000 (13:18 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@66 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/Topic.pl

index 59ce3a84f8452184a07fc7b316843ba6d1185bdc..04ed03e19396652be38a747cc9956dfe5d45ecd6 100644 (file)
@@ -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;