]> git.donarmstrong.com Git - infobot.git/commitdiff
* no seen flushing and other dpkg specific hacks
authordondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jun 2006 01:32:15 +0000 (01:32 +0000)
committerdondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jun 2006 01:32:15 +0000 (01:32 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/branches/don/dpkg@1285 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/Schedulers.pl

index 8d8f9e24cc577c2170d38e9b986d6fbcf85edbdb..9064fe290bbd6f58390dbd96cf7b6d028e1951b6 100644 (file)
@@ -254,6 +254,8 @@ sub seenFlushOld {
        return if ($_[0] eq "2");       # defer.
     }
 
+    # NO SEEN FLUSHING!!!
+    return;
     # is this global-only?
     return unless (&IsChanConf("seen") > 0);
     return unless (&IsChanConf("seenFlushInterval") > 0);
@@ -557,12 +559,15 @@ sub seenFlush {
 
     if ($param{'DBType'} =~ /^(mysql|pgsql|sqlite(2)?)$/i) {
        foreach $nick (keys %seencache) {
+           my $lastcount = &sqlSelect('seen','messagecount',{nick=>lc $seencache{$nick}{'nick'}}) || 0;
            my $retval = &sqlReplace("seen", {
                        nick    => lc $seencache{$nick}{'nick'},
                        time    => $seencache{$nick}{'time'},
                        host    => $seencache{$nick}{'host'},
                        channel => $seencache{$nick}{'chan'},
                        message => $seencache{$nick}{'msg'},
+                       messagecount => $lastcount+$seencache{$nick}{'msgcount'},
+                                               
            } );
 
            delete $seencache{$nick};
@@ -687,7 +692,11 @@ sub ircCheck {
            &joinNextChan();
        }
 
-       # TODO: fix on_disconnect()
+    my @join = &getJoinChans(1);
+    if (scalar @join) {
+       &FIXME('ircCheck: found channels to join! ' . join(',',@join));
+       &joinNextChan();
+    }
 
        if (time() - $msgtime > 3600) {
            # TODO: shouldn't we use cache{connect} somewhere?
@@ -703,14 +712,23 @@ sub ircCheck {
                $cache{connect} = time();
            }
        }
+    }
 
-       if (grep /^\s*$/, keys %channels) {
-           &WARN('ircCheck: we have a NULL chan in hash channels? removing!');
-           if (!exists $channels{''}) {
-               &DEBUG('ircCheck: this should never happen!');
-           }
+       if (grep /^\s*$/, keys %channels) {
+           &WARN('ircCheck: we have a NULL chan in hash channels? removing!');
+           if (!exists $channels{''}) {
+               &DEBUG('ircCheck: this should never happen!');
+           }
+    if ($ident !~ /^\Q$param{ircNick}\E$/) {
+       # this does not work unfortunately.
+       &WARN("ircCheck: ident($ident) != param{ircNick}($param{ircNick}).");
 
-           delete $channels{''};
+       # this check is misleading... perhaps we should do a notify.
+       if (! &IsNickInAnyChan( $param{ircNick} ) ) {
+           &DEBUG("$param{ircNick} not in use... changing!");
+           &nick( $param{ircNick} );
+       } else {
+           &WARN("$param{ircNick} is still in use...");
        }
     }