- added verbosity setting

Fri, 13 Jun 2014 01:04:30 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 13 Jun 2014 01:04:30 +0300
changeset 9
0604f6b9f781
parent 8
dd467db4b18e
child 10
1b726db7b0ec

- added verbosity setting

cobalt.py file | annotate | diff | comparison | revisions
--- a/cobalt.py	Fri Jun 13 00:49:09 2014 +0300
+++ b/cobalt.py	Fri Jun 13 01:04:30 2014 +0300
@@ -145,6 +145,7 @@
 		self.umode = cfg['umode'] if 'umode' in cfg else ''
 		self.cfg = cfg
 		self.mynick = ''
+		self.verbose = cfg['verbose'] if 'verbose' in cfg else False
 
 		if not 'conflictsuffix' in self.cfg:
 			self.cfg['conflictsuffix'] = '`'
@@ -186,7 +187,8 @@
 
 	def send_all_now (self):
 		for line in self.send_buffer:
-			print "[%s] <- %s" % (self.name, line)
+			if self.verbose:
+				print "[%s] <- %s" % (self.name, line)
 			self.send ("%s\n" % line)
 		self.send_buffer = []
 
@@ -194,7 +196,8 @@
 		lines = self.recv (4096).splitlines()
 		for utfline in lines:
 			line = utfline.decode("utf-8").encode("ascii","ignore")
-			print "[%s] -> %s" % (self.name, line)
+			if self.verbose:
+				print "[%s] -> %s" % (self.name, line)
 
 			if line.startswith ("PING :"):
 				self.write ("PONG :%s" % line[6:])

mercurial