Browse Source

Add config var 'verbose' so I can suppress that fucking \!ping l0l

Wazakindjes 1 year ago
parent
commit
0c66d152be
2 changed files with 6 additions and 3 deletions
  1. 3 3
      serbur/meqqy.pl
  2. 3 0
      serbur/muhconf.ini.example

+ 3 - 3
serbur/meqqy.pl

@@ -20,7 +20,7 @@ my $AUTHREGEX = "[A-Za-z0-9]{$AUTHLEN}";
 my $dirname = dirname(__FILE__);
 my $cfg = Config::IniFiles->new(-file => "$dirname/muhconf.ini");
 my %CONF;
-foreach my $ckey(('addy', 'port', 'backlog', 'accept_timeout', 'auth_timeout', 'client_timeout', 'cert', 'key', 'auth', 'debug')) {
+foreach my $ckey(('addy', 'port', 'backlog', 'accept_timeout', 'auth_timeout', 'client_timeout', 'cert', 'key', 'auth', 'debug', 'verbose')) {
 	$CONF{$ckey} = $cfg->val('main', $ckey);
 }
 
@@ -67,7 +67,7 @@ foreach my $k(keys(%CONF)) {
 			$gtfo = 1;
 		}
 	}
-	elsif($k eq 'debug') {
+	elsif($k =~ /^(debug|verbose)$/) {
 		$CONF{$k} = ((defined($v) && $v) ? 1 : 0);
 	}
 	else {
@@ -128,7 +128,7 @@ while(1) {
 					$read = 2 if($read == 0);
 					last;
 				}
-				printem("($ckey) '$buf'");
+				printem("($ckey) '$buf'") if($CONF{verbose} || $buf !~ /^!ping/i);
 				$read = 1; # Actually got some data lol
 
 				# Check if auth is (still) needed

+ 3 - 0
serbur/muhconf.ini.example

@@ -24,3 +24,6 @@ auth = abcdefghijklmnopqrstuvwwxyz1234567890ABCDEFGHIJKKLMNOPQRSTUVWXYZ
 
 # If set to 1 there's no authentication =]
 debug = 0
+
+# Difference with debug is that verbose doesn't alter functionality ;]
+verbose = 0