143 self.flags = flags |
143 self.flags = flags |
144 self.send_buffer = list() |
144 self.send_buffer = list() |
145 self.umode = cfg['umode'] if 'umode' in cfg else '' |
145 self.umode = cfg['umode'] if 'umode' in cfg else '' |
146 self.cfg = cfg |
146 self.cfg = cfg |
147 self.mynick = '' |
147 self.mynick = '' |
|
148 |
|
149 if not 'conflictsuffix' in self.cfg: |
|
150 self.cfg['conflictsuffix'] = '`' |
|
151 |
148 self.desired_name = self.cfg['nickname'] if 'nickname' in self.cfg else g_config['nickname'] |
152 self.desired_name = self.cfg['nickname'] if 'nickname' in self.cfg else g_config['nickname'] |
149 g_clients.append (self) |
153 g_clients.append (self) |
150 asyncore.dispatcher.__init__ (self) |
154 asyncore.dispatcher.__init__ (self) |
151 self.create_socket (socket.AF_INET, socket.SOCK_STREAM) |
155 self.create_socket (socket.AF_INET, socket.SOCK_STREAM) |
152 self.connect ((self.host, self.port)) |
156 self.connect ((self.host, self.port)) |
216 if match and match.group(1) == self.desired_name: |
220 if match and match.group(1) == self.desired_name: |
217 self.mynick = self.desired_name |
221 self.mynick = self.desired_name |
218 self.write ("NICK %s" % self.mynick) |
222 self.write ("NICK %s" % self.mynick) |
219 elif words[1] == "433": |
223 elif words[1] == "433": |
220 #:irc.localhost 433 * cobalt :Nickname is already in use. |
224 #:irc.localhost 433 * cobalt :Nickname is already in use. |
221 self.mynick = '%s_' % self.mynick |
225 self.mynick = '%s%s' % (self.mynick, self.cfg['conflictsuffix']) |
222 self.write ("NICK %s" % self.mynick) |
226 self.write ("NICK %s" % self.mynick) |
223 |
227 |
224 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
228 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
225 # |
229 # |
226 # Handle a PRIVMSG line from the IRC server |
230 # Handle a PRIVMSG line from the IRC server |