- heartbeat the issue announcer even if we just get a ping

Sat, 14 Jun 2014 16:24:03 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 14 Jun 2014 16:24:03 +0300
changeset 14
558379fd6d6a
parent 13
4da122a2f79f
child 15
e7999383db5a

- heartbeat the issue announcer even if we just get a ping

cobalt.py file | annotate | diff | comparison | revisions
--- a/cobalt.py	Sat Jun 14 16:13:16 2014 +0300
+++ b/cobalt.py	Sat Jun 14 16:24:03 2014 +0300
@@ -256,32 +256,31 @@
 
 			if line.startswith ("PING :"):
 				self.write ("PONG :%s" % line[6:])
-				continue
+			else:
+				words = line.split(" ")
+				if len(words) >= 2:
+					if words[1] == "001":
+						self.flags |= CLIF_CONNECTED
 
-			words = line.split(" ")
-			if len(words) >= 2:
-				if words[1] == "001":
-					self.flags |= CLIF_CONNECTED
-
-					for channel in self.cfg['channels']:
-						self.write ("JOIN %s %s" % (channel['name'], channel['password'] if 'password' in channel else ''))
+						for channel in self.cfg['channels']:
+							self.write ("JOIN %s %s" % (channel['name'], channel['password'] if 'password' in channel else ''))
 
-					if 'umode' in self.cfg:
-						self.write ('MODE %s %s' % (self.mynick, self.cfg['umode']))
-				elif words[1] == "PRIVMSG":
-					self.handle_privmsg (line)
-				elif words[1] == 'QUIT':
-					rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT')
-					match = rex.match (line)
+						if 'umode' in self.cfg:
+							self.write ('MODE %s %s' % (self.mynick, self.cfg['umode']))
+					elif words[1] == "PRIVMSG":
+						self.handle_privmsg (line)
+					elif words[1] == 'QUIT':
+						rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT')
+						match = rex.match (line)
 
-					# Try reclaim our nickname if possible
-					if match and match.group(1) == self.desired_name:
-						self.mynick = self.desired_name
+						# Try reclaim our nickname if possible
+						if match and match.group(1) == self.desired_name:
+							self.mynick = self.desired_name
+							self.write ("NICK %s" % self.mynick)
+					elif words[1] == "433":
+						#:irc.localhost 433 * cobalt :Nickname is already in use.
+						self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix'])
 						self.write ("NICK %s" % self.mynick)
-				elif words[1] == "433":
-					#:irc.localhost 433 * cobalt :Nickname is already in use.
-					self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix'])
-					self.write ("NICK %s" % self.mynick)
 
 			# Check for new issues on the bugtracker
 			bt_checklatest()

mercurial