summaryrefslogtreecommitdiffstats
path: root/modules/startup.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/startup.py')
-rwxr-xr-xmodules/startup.py92
1 files changed, 46 insertions, 46 deletions
diff --git a/modules/startup.py b/modules/startup.py
index 81b3ecf..b9ad910 100755
--- a/modules/startup.py
+++ b/modules/startup.py
@@ -9,61 +9,61 @@ http://inamidst.com/phenny/
import threading, time
-def setup(phenny):
- print("Setting up phenny")
- # by clsn
- phenny.data = {}
- refresh_delay = 300.0
+def setup(phenny):
+ print("Setting up phenny")
+ # by clsn
+ phenny.data = {}
+ refresh_delay = 300.0
- if hasattr(phenny.config, 'refresh_delay'):
- try: refresh_delay = float(phenny.config.refresh_delay)
- except: pass
+ if hasattr(phenny.config, 'refresh_delay'):
+ try: refresh_delay = float(phenny.config.refresh_delay)
+ except: pass
- def close():
- print "Nobody PONGed our PING, restarting"
- phenny.handle_close()
-
- def pingloop():
- timer = threading.Timer(refresh_delay, close, ())
- phenny.data['startup.setup.timer'] = timer
- phenny.data['startup.setup.timer'].start()
- # print "PING!"
- phenny.write(('PING', phenny.config.host))
- phenny.data['startup.setup.pingloop'] = pingloop
+ def close():
+ print "Nobody PONGed our PING, restarting"
+ phenny.handle_close()
- def pong(phenny, input):
- try:
- # print "PONG!"
- phenny.data['startup.setup.timer'].cancel()
- time.sleep(refresh_delay + 60.0)
- pingloop()
- except: pass
- pong.event = 'PONG'
- pong.thread = True
- pong.rule = r'.*'
- phenny.variables['pong'] = pong
+ def pingloop():
+ timer = threading.Timer(refresh_delay, close, ())
+ phenny.data['startup.setup.timer'] = timer
+ phenny.data['startup.setup.timer'].start()
+ # print "PING!"
+ phenny.write(('PING', phenny.config.host))
+ phenny.data['startup.setup.pingloop'] = pingloop
-def startup(phenny, input):
- import time
+ def pong(phenny, input):
+ try:
+ # print "PONG!"
+ phenny.data['startup.setup.timer'].cancel()
+ time.sleep(refresh_delay + 60.0)
+ pingloop()
+ except: pass
+ pong.event = 'PONG'
+ pong.thread = True
+ pong.rule = r'.*'
+ phenny.variables['pong'] = pong
- # 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):
+ import time
- if hasattr(phenny.config, 'serverpass'):
- phenny.write(('PASS', phenny.config.serverpass))
+ # 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']()
- if hasattr(phenny.config, 'password'):
- phenny.msg('NickServ', 'IDENTIFY %s' % phenny.config.password)
- time.sleep(5)
+ if hasattr(phenny.config, 'serverpass'):
+ phenny.write(('PASS', phenny.config.serverpass))
- # Cf. http://swhack.com/logs/2005-12-05#T19-32-36
- for channel in phenny.channels:
- phenny.write(('JOIN', channel))
- time.sleep(0.5)
+ if hasattr(phenny.config, 'password'):
+ phenny.msg('NickServ', 'IDENTIFY %s' % phenny.config.password)
+ time.sleep(5)
+
+ # Cf. http://swhack.com/logs/2005-12-05#T19-32-36
+ for channel in phenny.channels:
+ phenny.write(('JOIN', channel))
+ time.sleep(0.5)
startup.rule = r'(.*)'
startup.event = '251'
startup.priority = 'low'
-if __name__ == '__main__':
- print __doc__.strip()
+if __name__ == '__main__':
+ print __doc__.strip()