From 065fa5949ec7284df33d02cf8d2c430c901a46a0 Mon Sep 17 00:00:00 2001 From: Matthias Linder Date: Thu, 21 Mar 2013 13:04:14 +0100 Subject: [PATCH] fix immediate ping timeout on quakenet https://github.com/sbp/phenny/pull/27 --- modules/startup.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/startup.py b/modules/startup.py index ce0c0f4..0af303b 100644 --- a/modules/startup.py +++ b/modules/startup.py @@ -10,6 +10,7 @@ http://inamidst.com/phenny/ import threading, time def setup(phenny): + print("Setting up phenny") # by clsn phenny.data = {} refresh_delay = 300.0 @@ -42,17 +43,13 @@ def setup(phenny): pong.rule = r'.*' phenny.variables['pong'] = pong - # Need to wrap handle_connect to start the loop. - inner_handle_connect = phenny.handle_connect +def startup(phenny, input): + import time - def outer_handle_connect(): - inner_handle_connect() - if phenny.data.get('startup.setup.pingloop'): - phenny.data['startup.setup.pingloop']() - - phenny.handle_connect = outer_handle_connect + # Start the ping loop. Has to be done after USER on e.g. quakenet + if phenny.data.get('startup.setup.pingloop'): + phenny.data['startup.setup.pingloop']() -def startup(phenny, input): if hasattr(phenny.config, 'serverpass'): phenny.write(('PASS', phenny.config.serverpass))