]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/News.pl
really support negative booleans and and return -1 for IsChanConf() when they are...
[infobot.git] / src / Modules / News.pl
index a2d7c3eab88b997ed0e5154a0f311a45fcf157ee..25b049c28d5fb1f4aa4a4a47d0706700a933a4d1 100644 (file)
@@ -118,8 +118,8 @@ sub Parse {
     } elsif ($what =~ /^(un)?notify$/i) {
        my $state = ($1) ? 0 : 1;
 
-       # TODO: don't notify even if "news" is called.
-       if (!&::IsChanConf("newsNotifyAll")) {
+       # TODO: don't notify even if "News" is called.
+       if (&::IsChanConf("newsNotifyAll") <= 0) {
            &::DEBUG("news: chan => $chan, ::chan => $::chan.");
            &::notice($who, "not available for this channel or disabled altogether.");
            return;
@@ -281,7 +281,7 @@ sub add {
     }
 
     $::news{$chan}{$str}{Time} = time();
-    my $expire = &::getChanConfDefault("newsDefaultExpire",7);
+    my $expire = &::getChanConfDefault("newsDefaultExpire",7, $chan);
     $::news{$chan}{$str}{Expire}       = time() + $expire*60*60*24;
     $::news{$chan}{$str}{Author}       = $::who;       # case!
 
@@ -371,7 +371,7 @@ sub list {
        return;
     }
 
-    if (&::IsChanConf("newsKeepRead")) {
+    if (&::IsChanConf("newsKeepRead") > 0) {
        my $x = $::newsuser{$chan}{$who};
 
        if (defined $x and ($x == 0 or $x == -1)) {
@@ -751,8 +751,7 @@ sub latest {
     }
 
     $::chan    = $chan;
-    my $x = &::IsChanConf("newsNotifyAll");
-    return if (!$x);
+    return if (&::IsChanConf("newsNotifyAll") <= 0);
 
     # I don't understand this code ;)
     $t = 1 if (!defined $t);
@@ -792,7 +791,7 @@ sub latest {
     # scalar @new, !$flag
     my $unread = scalar @new;
     my $total  = scalar keys %{ $::news{$chan} };
-    if (!$flag && !&::IsChanConf("newsTellUnread")) {
+    if (!$flag && &::IsChanConf("newsTellUnread") <= 0) {
        return;
     }