X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=backends%2Firc%2F__init__.py;h=1f58f77f11675625f26607e1f5ad990d23711671;hp=cf830b95e5195686ff6b97e3e07258b9c5c25e72;hb=5fc9625300ebde3d56a89c6d2f72a599aa0c8d1d;hpb=1751c457609209877431311c54e48278947b4ad7 diff --git a/backends/irc/__init__.py b/backends/irc/__init__.py index cf830b9..1f58f77 100644 --- a/backends/irc/__init__.py +++ b/backends/irc/__init__.py @@ -72,6 +72,7 @@ class IrcThread(threading.Thread): def run(self): ircname = self.getname() + print_log("joining IRC") while not self.processor.shared.stopped(): try: @@ -80,6 +81,7 @@ class IrcThread(threading.Thread): s.settimeout(0.1) except: s.close() + print_log("IRC: reconnect in 10 s") time.sleep(10) continue @@ -114,6 +116,7 @@ class IrcThread(threading.Thread): line = line.strip('\r') if not line: continue + # print_log("<--", line) line = line.split() if line[0] == 'PING': out_msg.append('PONG ' + line[1] + '\n') @@ -134,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: + 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()]}) @@ -155,7 +163,6 @@ class ServerProcessor(Processor): Processor.__init__(self) self.daemon = True self.banner = config.get('server', 'banner') - self.password = config.get('server', 'password') if config.get('server', 'irc') == 'yes': self.irc = IrcThread(self, config) @@ -178,19 +185,6 @@ class ServerProcessor(Processor): params = request['params'] result = None - if method in ['server.stop', 'server.info', 'server.debug']: - try: - password = request['params'][0] - except: - password = None - - if password != self.password: - self.push_response(session, - {'id': request['id'], - 'result': None, - 'error': 'incorrect password'}) - return - if method == 'server.banner': result = self.banner.replace('\\n', '\n') @@ -200,32 +194,6 @@ class ServerProcessor(Processor): elif method == 'server.version': result = VERSION - elif method == 'server.stop': - self.shared.stop() - result = 'stopping, please wait until all threads terminate.' - - elif method == 'server.info': - result = map(lambda s: {"time": s.time, - "name": s.name, - "address": s.address, - "version": s.version, - "subscriptions": len(s.subscriptions)}, - self.dispatcher.request_dispatcher.get_sessions()) - - elif method == 'server.debug': - try: - s = request['params'][1] - except: - s = None - - if s: - from guppy import hpy - h = hpy() - bp = self.dispatcher.request_dispatcher.processors['blockchain'] - try: - result = str(eval(s)) - except: - result = "error" else: print_log("unknown method", method)