From: dondelelcaro Date: Sat, 3 Jun 2006 01:32:15 +0000 (+0000) Subject: * no seen flushing and other dpkg specific hacks X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=cb0061b7a994d92c9190dcbfa3c262bdb547913b;p=infobot.git * no seen flushing and other dpkg specific hacks git-svn-id: https://svn.code.sf.net/p/infobot/code/branches/don/dpkg@1285 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index 8d8f9e2..9064fe2 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -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..."); } }