]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/Irc.pl
* Add vim formatting comments ( # vim:ts=4:sw=4:expandtab:tw=80 )
[infobot.git] / src / IRC / Irc.pl
index 5159832125a9b11e8063db6aabab8e4c303ce8a1..c89c0db41616a95abce9df3a0a9564d9612d509c 100644 (file)
@@ -23,7 +23,11 @@ use vars qw(@ircServers);
 #use open ':std';
 
 $nickserv      = 0;
-my $maxlinelen = 400;
+# It's probably closer to 510, but let's be cautious until we calculate it extensively.
+my $maxlinelen = 490;
+
+# Keep track of last time we displayed Chans: to avoid spam in logs
+my $lastChansTime = 0;
 
 sub ircloop {
     my $error  = 0;
@@ -212,7 +216,8 @@ sub say {
        return;
     }
 
-    if (&getChanConf('silent', $talkchannel)) {
+    if (&getChanConf('silent', $talkchannel) and not
+      (&IsFlag("s") and &verifyUser($who,$nuh{lc $who}))) {
        &DEBUG("say: silent in $talkchannel, not saying $msg");
        return;
     }
@@ -271,7 +276,8 @@ sub msg {
     }
 
     # some say() end up here (eg +help)
-    if (&getChanConf('silent', $nick)) {
+    if (&getChanConf('silent', $nick) and not
+       (&IsFlag("s") and &verifyUser($who,$nuh{lc $who}))) {
        &DEBUG("msg: silent in $nick, not saying $msg");
        return;
     }
@@ -312,7 +318,8 @@ sub action {
        return;
     }
 
-    if (&getChanConf('silent', $target)) {
+    if (&getChanConf('silent', $target) and not
+       (&IsFlag("s") and &verifyUser($who,$nuh{lc $who}))) {
        &DEBUG("action: silent in $target, not doing $txt");
        return;
     }
@@ -835,12 +842,21 @@ sub clearIRCVars {
 }
 
 sub getJoinChans {
-    my($show)  = @_;
+    # $show should contain the min number of seconds between display
+    # of the Chans: status line. Use 0 to disable
+    my $show = shift;
 
     my @in;
     my @skip;
     my @join;
 
+    # Display "Chans:" only if more than $show seconds since last display
+    if (time() - $lastChansTime > $show) {
+       $lastChansTime = time();
+    } else {
+       $show = 0; # Don't display since < 15min since last
+    }
+
     # can't join any if not connected
     return @join if (!$conn);
 
@@ -876,8 +892,8 @@ sub getJoinChans {
     }
 
     my $str;
-    #$str .= ' in:' . join(',', sort @in) if scalar @in;
-    #$str .= ' skip:' . join(',', sort @skip) if scalar @skip;
+    $str .= ' in:' . join(',', sort @in) if scalar @in;
+    $str .= ' skip:' . join(',', sort @skip) if scalar @skip;
     $str .= ' join:' . join(',', sort @join) if scalar @join;
 
     &status("Chans: ($nick)$str") if ($show);
@@ -975,3 +991,5 @@ sub getHostMask {
 }
 
 1;
+
+# vim:ts=4:sw=4:expandtab:tw=80