cobalt.py

changeset 27
ac59b5ae7a78
parent 26
580a2a9fd2e5
child 28
30257c78904f
equal deleted inserted replaced
26:580a2a9fd2e5 27:ac59b5ae7a78
226 226
227 for channel in self.channels: 227 for channel in self.channels:
228 if not 'logchannel' in channel: 228 if not 'logchannel' in channel:
229 channel['logchannel'] = False 229 channel['logchannel'] = False
230 channel['namesdone'] = True 230 channel['namesdone'] = True
231 channel['haslinkbot'] = False 231 #channel['haslinkbot'] = False
232 232
233 if not 'conflictsuffix' in self.cfg: 233 if not 'conflictsuffix' in self.cfg:
234 self.cfg['conflictsuffix'] = '`' 234 self.cfg['conflictsuffix'] = '`'
235 235
236 self.desired_name = self.cfg['nickname'] if 'nickname' in self.cfg else g_config['nickname'] 236 self.desired_name = self.cfg['nickname'] if 'nickname' in self.cfg else g_config['nickname']
306 self.handle_privmsg (line) 306 self.handle_privmsg (line)
307 elif words[1] == 'JOIN': 307 elif words[1] == 'JOIN':
308 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) JOIN :#(.+)') 308 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) JOIN :#(.+)')
309 match = rex.match (line) 309 match = rex.match (line)
310 310
311 if match and match.group(1).toLower() == 'linkbot': 311 #if match and match.group(1).toLower() == 'linkbot':
312 channel_by_name (match.group(4))['haslinkbot'] = True 312 #channel_by_name (match.group(4))['haslinkbot'] = True
313 elif words[1] == 'QUIT': 313 elif words[1] == 'QUIT':
314 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT') 314 rex = re.compile (r'^:([^!]+)!([^@]+)@([^ ]+) QUIT')
315 match = rex.match (line) 315 match = rex.match (line)
316 316
317 # Try reclaim our nickname if possible 317 # Try reclaim our nickname if possible
318 if match and match.group(1) == self.desired_name: 318 if match and match.group(1) == self.desired_name:
319 self.mynick = self.desired_name 319 self.mynick = self.desired_name
320 self.write ("NICK %s" % self.mynick) 320 self.write ("NICK %s" % self.mynick)
321 321
322 if match and match.group(1).toLower() == 'linkbot': 322 #if match and match.group(1).toLower() == 'linkbot':
323 for channel in self.channels: 323 #for channel in self.channels:
324 channels['haslinkbot'] = False 324 #channels['haslinkbot'] = False
325 elif words[1] == "433": 325 elif words[1] == "433":
326 #:irc.localhost 433 * cobalt :Nickname is already in use. 326 #:irc.localhost 433 * cobalt :Nickname is already in use.
327 self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix']) 327 self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix'])
328 self.write ("NICK %s" % self.mynick) 328 self.write ("NICK %s" % self.mynick)
329 329

mercurial