Update IRC parsing to avoid errors
[electrum-server.git] / backends / irc / __init__.py
index b401462..6dfdc5d 100644 (file)
@@ -120,12 +120,12 @@ class IrcThread(threading.Thread):
                         line = line.split()
                         if line[0] == 'PING':
                             out_msg.append('PONG ' + line[1] + '\n')
-                        elif '353' in line:  # answer to /names
+                        elif '353' in line[1]:  # answer to /names
                             k = line.index('353')
                             for item in line[k+1:]:
                                 if item.startswith(self.prepend):
                                     out_msg.append('WHO %s\n' % item)
-                        elif '352' in line:  # answer to /who
+                        elif '352' in line[1]:  # answer to /who
                             # warning: this is a horrible hack which apparently works
                             k = line.index('352')
                             try:
@@ -137,6 +137,11 @@ class IrcThread(threading.Thread):
                             host = line[k+9]
                             ports = line[k+10:]
                             self.peers[name] = (ip, host, ports)
+                        elif 'KICK' in line[1]:
+                            try:
+                                print_log("KICK", line[3] + line[4])
+                            except:
+                                print_log("KICK", "error")
 
                     if time.time() - t > 5*60:
                         #self.processor.push_response({'method': 'server.peers', 'params': [self.get_peers()]})