From c65639d55f7b897b21af98c522a647917327f6ba Mon Sep 17 00:00:00 2001 From: "Esteban (Eka) Feldman" Date: Thu, 16 Feb 2012 12:22:41 -0300 Subject: [PATCH 1/2] when config file is passed by arg avoid creating config dir --- phenny | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phenny b/phenny index 6cb0961..fc2bbf4 100755 --- a/phenny +++ b/phenny @@ -118,7 +118,8 @@ def main(argv=None): # Step Two: Check Dependencies check_python_version() # require python2.4 or later - check_dotdir() # require ~/.phenny, or make it and exit + if not opts.config: + check_dotdir() # require ~/.phenny, or make it and exit # Step Three: Load The Configurations From 6198b30d76a6e7ce3ba3037f454221cbbc4b0b32 Mon Sep 17 00:00:00 2001 From: "Sean B. Palmer" Date: Thu, 16 Feb 2012 17:55:23 +0000 Subject: [PATCH 2/2] Throttle channel joins --- irc.py | 4 ++-- modules/oblique.py | 4 +++- modules/startup.py | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/irc.py b/irc.py index 767aa27..30d1146 100755 --- a/irc.py +++ b/irc.py @@ -46,7 +46,7 @@ class Bot(asynchat.async_chat): # asynchat.async_chat.push(self, *args, **kargs) def __write(self, args, text=None): - # print '%r %r %r' % (self, args, text) + # print 'PUSH: %r %r %r' % (self, args, text) try: if text is not None: # 510 because CR and LF count too, as nyuszika7h points out @@ -102,7 +102,7 @@ class Bot(asynchat.async_chat): line = line[:-1] self.buffer = '' - # print line + # print 'GOT:', repr(line) if line.startswith(':'): source, line = line[1:].split(' ', 1) else: source = None diff --git a/modules/oblique.py b/modules/oblique.py index 7bd6718..d93446e 100755 --- a/modules/oblique.py +++ b/modules/oblique.py @@ -43,7 +43,9 @@ def service(phenny, input, command, args): lines = bytes.splitlines() if not lines: return phenny.reply("Sorry, the service didn't respond any output.") - phenny.say(lines[0][:350]) + try: line = lines[0].encode('utf-8')[:350] + except: line = lines[0][:250] + phenny.say(line) def refresh(phenny): if hasattr(phenny.config, 'services'): diff --git a/modules/startup.py b/modules/startup.py index 48c5fc9..297dfb5 100755 --- a/modules/startup.py +++ b/modules/startup.py @@ -53,16 +53,19 @@ def setup(phenny): phenny.handle_connect = outer_handle_connect def startup(phenny, input): + import time + if hasattr(phenny.config, 'serverpass'): phenny.write(('PASS', phenny.config.serverpass)) if hasattr(phenny.config, 'password'): phenny.msg('NickServ', 'IDENTIFY %s' % phenny.config.password) - __import__('time').sleep(5) + 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'