254 if self.verbose: |
254 if self.verbose: |
255 print "[%s] -> %s" % (self.name, line) |
255 print "[%s] -> %s" % (self.name, line) |
256 |
256 |
257 if line.startswith ("PING :"): |
257 if line.startswith ("PING :"): |
258 self.write ("PONG :%s" % line[6:]) |
258 self.write ("PONG :%s" % line[6:]) |
259 continue |
259 else: |
260 |
260 words = line.split(" ") |
261 words = line.split(" ") |
261 if len(words) >= 2: |
262 if len(words) >= 2: |
262 if words[1] == "001": |
263 if words[1] == "001": |
263 self.flags |= CLIF_CONNECTED |
264 self.flags |= CLIF_CONNECTED |
264 |
265 |
265 for channel in self.cfg['channels']: |
266 for channel in self.cfg['channels']: |
266 self.write ("JOIN %s %s" % (channel['name'], channel['password'] if 'password' in channel else '')) |
267 self.write ("JOIN %s %s" % (channel['name'], channel['password'] if 'password' in channel else '')) |
267 |
268 |
268 if 'umode' in self.cfg: |
269 if 'umode' in self.cfg: |
269 self.write ('MODE %s %s' % (self.mynick, self.cfg['umode'])) |
270 self.write ('MODE %s %s' % (self.mynick, self.cfg['umode'])) |
270 elif words[1] == "PRIVMSG": |
271 elif words[1] == "PRIVMSG": |
271 self.handle_privmsg (line) |
272 self.handle_privmsg (line) |
272 elif words[1] == 'QUIT': |
273 elif words[1] == 'QUIT': |
273 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT') |
274 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT') |
274 match = rex.match (line) |
275 match = rex.match (line) |
275 |
276 |
276 # Try reclaim our nickname if possible |
277 # Try reclaim our nickname if possible |
277 if match and match.group(1) == self.desired_name: |
278 if match and match.group(1) == self.desired_name: |
278 self.mynick = self.desired_name |
279 self.mynick = self.desired_name |
279 self.write ("NICK %s" % self.mynick) |
|
280 elif words[1] == "433": |
|
281 #:irc.localhost 433 * cobalt :Nickname is already in use. |
|
282 self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix']) |
280 self.write ("NICK %s" % self.mynick) |
283 self.write ("NICK %s" % self.mynick) |
281 elif words[1] == "433": |
|
282 #:irc.localhost 433 * cobalt :Nickname is already in use. |
|
283 self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix']) |
|
284 self.write ("NICK %s" % self.mynick) |
|
285 |
284 |
286 # Check for new issues on the bugtracker |
285 # Check for new issues on the bugtracker |
287 bt_checklatest() |
286 bt_checklatest() |
288 |
287 |
289 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
288 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |