X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=backends%2Firc%2F__init__.py;h=d8f2e15c9d5fdce4d957c9692fc808987152c3a7;hb=HEAD;hp=1f58f77f11675625f26607e1f5ad990d23711671;hpb=5fc9625300ebde3d56a89c6d2f72a599aa0c8d1d;p=electrum-server.git diff --git a/backends/irc/__init__.py b/backends/irc/__init__.py index 1f58f77..d8f2e15 100644 --- a/backends/irc/__init__.py +++ b/backends/irc/__init__.py @@ -57,7 +57,7 @@ class IrcThread(threading.Thread): s += 'p' + self.pruning_limit + ' ' def add_port(letter, number): - DEFAULT_PORTS = {'t':'50001', 's':'50002', 'h':'8081', 'g':'8082'} + DEFAULT_PORTS = {'t':'40001', 's':'40002', 'h':'7081', 'g':'7082'} if not number: return '' if DEFAULT_PORTS[letter] == number: return letter + ' ' @@ -78,7 +78,7 @@ class IrcThread(threading.Thread): try: s = socket.socket() s.connect(('irc.freenode.net', 6667)) - s.settimeout(0.1) + s.settimeout(0.3) except: s.close() print_log("IRC: reconnect in 10 s") @@ -120,24 +120,21 @@ 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 - k = line.index('353') - for item in line[k+1:]: + elif line[1] == '353': # answer to /names + for item in line[2:]: if item.startswith(self.prepend): out_msg.append('WHO %s\n' % item) - elif '352' in line: # answer to /who - # warning: this is a horrible hack which apparently works - k = line.index('352') + elif line[1] == '352': # answer to /who try: - ip = socket.gethostbyname(line[k+4]) + ip = socket.gethostbyname(line[5]) except: - print_log("gethostbyname error", line[k+4]) + print_log("gethostbyname error", line[5]) continue - name = line[k+6] - host = line[k+9] - ports = line[k+10:] + name = line[7] + host = line[10] + ports = line[11:] self.peers[name] = (ip, host, ports) - elif 'KICK' in line: + elif line[1] == 'KICK': try: print_log("KICK", line[3] + line[4]) except: