if (!defined $chan or $chan =~ /^$/) {
&WARN("chanServCheck: chan == NULL.");
- return;
+ return 0;
}
if ($chan =~ tr/A-Z/a-z/) {
}
if (! &IsChanConf("chanServ_ops") ) {
- return;
+ return 0;
}
&DEBUG("chanServCheck($chan) called.");
if ( &IsParam("nickServ_pass") and !$nickserv) {
&DEBUG("chanServ_ops($chan): nickserv enabled but not alive? (ircCheck)");
- return;
+ return 0;
}
- return if (exists $channels{$chan}{'o'}{$ident});
+ return 0 if (exists $channels{$chan}{'o'}{$ident});
&status("ChanServ ==> Requesting ops for $chan. (chanServCheck)");
&rawout("PRIVMSG ChanServ :OP $chan $ident");
+ return 1;
}
1;
# sync time should be done in on_endofwho like in BitchX
if (exists $cache{jointime}{$chan}) {
- my $delta_time = sprintf("%.03f", &gettimeofday() - $cache{jointime}{$chan});
+ my $delta_time = sprintf("%.03f", &timeget() - $cache{jointime}{$chan});
$delta_time = 0 if ($delta_time < 0);
&status("$b_blue$chan$ob: sync in ${delta_time}s.");
}
### TODO: move this to &joinchan()?
- $cache{jointime}{$chan} = &gettimeofday();
+ $cache{jointime}{$chan} = &timeget();
rawout("WHO $chan");
return;
# password accepted.
if ($args =~ /^Password a/i) {
+ my $done = 0;
+
+ foreach ( &ChanConfList("chanServ_ops") ) {
+ next unless &chanServCheck($_);
+ next if ($done);
+ &DEBUG("nickserv activated or restarted; doing chanserv check.");
+ $done++;
+ }
+
$nickserv++;
}
} elsif ($nick =~ /^ChanServ$/i) { # chanserv.
if (scalar @fm) { #1: perfect match of name.
my $retval;
- $retval = "$fm[0] \002(\002$fm[11]\002)\002, ";
- $retval .= "section $fm[3], ";
- $retval .= "is $fm[4]. ";
- $retval .= "Stable: \002$fm[1]\002, ";
- $retval .= "Development: \002$fm[2]\002. ";
- $retval .= $fm[5] || $fm[6]; # fallback to 'download'.
- $retval .= " deb: ".$fm[8] if ($fm[8] ne ""); # 'deb'.
+ $retval = "$fm[0] \002(\002$fm[5]\002)\002, ";
+# $retval .= "section $fm[3], ";
+ $retval .= "is $fm[2]. ";
+ $retval .= "Version: \002$fm[1]\002, ";
+# $retval .= "Development: \002$fm[2]\002. ";
+ $retval .= $fm[4];
+### ???
+# $retval .= " deb: ".$fm[3] if ($fm[3] ne ""); # 'deb'.
return $retval;
} else {
@cols = &::dbGetColInfo("freshmeat");
$locktime = time();
- # todo: prevent severe memory usage whilst opening this file!!!
- $p->parse(*IN, ProtocolEncoding => 'ISO-8859-1');
+
+ # this mess is to not dump IN to memory.
+ $_ = <IN>;
+ $_ = <IN>;
+ $_ = <IN>;
+
+ my $str;
+ while (<IN>) {
+ chop;
+
+ $str .= $_;
+
+ next unless (/<\/project>/);
+
+ # XML::Parser's parse() doesn't like the following.
+ # but parsefile() does... why!
+ for ($str) {
+ s/®/_/g;
+ s/ô//g;
+ s/"//g;
+ s/é/e/g;
+ s/à/a/g;
+ s/í/i/g;
+ s/­/_/g; # ???
+ s/´/a/g;
+ s/»/_/g; # ???
+ s/«/_/g; # ???
+ s/©/[C]/g;
+ s/°/deg/g;
+ s/Æ/A/g;
+ s/\cN//g; # fucking openbsd morons.
+ s/ /-/g;
+ s/ö/o/g;
+ s/¶//g; # ???
+ s/ã//g;
+ s/\cM/ /g; # stupid windows morons
+ s/²/square/g;
+ s/ü/?/g;
+ s/µ/u/g;
+ s/æ/a/g;
+ s/ø/o/g;
+ s/ð/e/g;
+ }
+
+ $p->parse($str, ProtocolEncoding => 'ISO-8859-1');
+ $str = "";
+ }
close IN;
- &::DEBUG("FM: data ".scalar(@data) );
&::dbRaw("UNLOCK", "UNLOCK TABLES");
my $delta_time = &::timedelta($start_time);
return "Freshmeat update: ".join(" \002::\002 ", @new);
}
+
sub xml_text {
- my($expat,$text) = @_;
- return if ($text =~ /^\s+$/);
+ my ($e,$t) = @_;
+ return if ($t =~ /^\s*$/);
- $string = $text;
+ $string = $t;
}
sub xml_end {
$pkg{$text} = $string;
- if ($expat->depth == 1) {
+ if ($expat->depth == 0) {
for (my $j=0; $j<scalar @cols; $j++) {
$data[$j] = $pkg{ $cols[$j] };
}
&::Time2String( time() - $locktime ) );
$locktime = time();
+ # I think the following leaks 120k of memory each time it's
+ # called... the wonders of libmysql-perl leaking!
+
&::dbRaw("UNLOCK", "UNLOCK TABLES");
### another lame hack to "prevent" errors.
select(undef, undef, undef, 0.2);