&ircCheck();
next;
}
- push(@array, "$_ (".scalar(keys %{ $channels{$_}{''} }).")");
+ next if (/^_default$/);
+
+ my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} }));
+ push(@array, $str);
}
- &pSReply($reply.": ".join(' ', @array));
+ &pSReply($reply.": ".join(', ', @array));
### total user count.
foreach $chan (keys %channels) {
push(@nicks, $_);
}
}
- &DEBUG("nicks => '".scalar(@nicks)."'...");
+
if (scalar @nicks != $uucount) {
&DEBUG("nicks != uucount...");
}
sub karma {
my $target = lc( shift || $who );
- my $karma = &dbGet("stats", "counter", "nick=".
- &dbQuote($target)." AND type='karma'") || 0;
+ my $karma = &sqlSelect("stats", "counter",
+ { nick => $target, type => "karma" }) || 0;
if ($karma != 0) {
&pSReply("$target has karma of $karma");
"Since $startString, there have been".
" \002$count{'Update'}\002 ".
&fixPlural("modification", $count{'Update'}).
- " and \002$count{'Question'}\002 ".
+ ", \002$count{'Question'}\002 ".
&fixPlural("question",$count{'Question'}).
- " and \002$count{'Dunno'}\002 ".
+ ", \002$count{'Dunno'}\002 ".
&fixPlural("dunno",$count{'Dunno'}).
- " and \002$count{'Moron'}\002 ".
+ ", \002$count{'Moron'}\002 ".
&fixPlural("moron",$count{'Moron'}).
" and \002$count{'Commands'}\002 ".
&fixPlural("command",$count{'Commands'}).
return;
- # todo: use dbGetColNiceHash().
my %hash = &sqlSelectColHash("stats", "nick,counter",
{ type => "cmdstats" }, 1);
-# does ORDER matter when used with a hash?
+# ORDER won't be retained in a hash
# " ORDER BY counter DESC", 1);
if (0) {
}
# wantNick. xk++
- if ($message =~ /^wantNick$/i) {
+ if ($message =~ /^wantNick(\+)?$/i) {
+ my ($force) = ($1) ? 1 : 0;
+ $force = 0 unless (&IsFlag("n"));
+
+ # cannot trust Net::IRC's nick()
if ($param{'ircNick'} eq $ident) {
&msg($who, "I hope you're right. I'll try anyway.");
+ &DEBUG("ircNick => $param{'ircNick'}");
+ &DEBUG("ident => $ident");
}
- &DEBUG("ircNick => $param{'ircNick'}");
- &DEBUG("ident => $ident");
- if (! &IsNickInAnyChan( $param{ircNick} ) ) {
+ # fallback check, I guess. needed?
+ if (! &IsNickInAnyChan( $param{'ircNick'} ) ) {
my $str = "attempting to change nick to $param{'ircNick'}";
&status($str);
&msg($who, $str);
- &nick($param{'ircNick'});
- } else {
- &msg($who, "hrm.. I shouldn't do it (BUG?) but doing it anyway!");
- &DEBUG("wN: nick is somewhere... should try later.");
- &nick($param{'ircNick'});
+ &nick($param{ 'ircNick' });
+ return;
+ }
+
+ # idea from dondelecarlo :)
+ # todo: use cache{nickserv}
+ if ($param{'nickServ_pass'}) {
+ return if ($param{'ircNick'} eq $ident or $force == 0);
+
+ &status("someone is using our nick; GHOSTing");
+ &msg($who, "using GHOST on $param{'ircNick'}.");
+ &msg("NickServ", "GHOST $param{'ircNick'} $param{'nickServ_pass'}");
+
+ $conn->schedule(5, sub {
+ &status("going to change nick after GHOST.");
+ &nick( $param{'ircNick'} );
+ } );
+
+ return;
}
return;