From 0908b6a61dac8df774fce26451e508a1efc7841b Mon Sep 17 00:00:00 2001 From: "Sean B. Palmer" Date: Tue, 24 Apr 2012 15:31:27 +0100 Subject: [PATCH 1/2] Create default config if it doesn't exist --- phenny | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/phenny b/phenny index fc2bbf4..1bc110b 100755 --- a/phenny +++ b/phenny @@ -59,6 +59,14 @@ def create_default_config(fn): """) f.close() +def create_default_config_file(dotdir): + print 'Creating a default config file at ~/.phenny/default.py...' + default = os.path.join(dotdir, 'default.py') + create_default_config(default) + + print 'Done; now you can edit default.py, and run phenny! Enjoy.' + sys.exit(0) + def create_dotdir(dotdir): print 'Creating a config directory at ~/.phenny...' try: os.mkdir(dotdir) @@ -68,16 +76,15 @@ def create_dotdir(dotdir): print >> sys.stderr, 'Please fix this and then run phenny again.' sys.exit(1) - print 'Creating a default config file at ~/.phenny/default.py...' - default = os.path.join(dotdir, 'default.py') - create_default_config(default) - - print 'Done; now you can edit default.py, and run phenny! Enjoy.' - sys.exit(0) + create_default_config_file(dotdir) def check_dotdir(): + default = os.path.join(dotdir, 'default.py') + if not os.path.isdir(dotdir): create_dotdir(dotdir) + elif not os.path.isfile(default): + create_default_config_file(dotdir) def config_names(config): config = config or 'default' From 8a0d0dd9f0e98b3f2bc7637e0354f8b0a67b6b47 Mon Sep 17 00:00:00 2001 From: "Sean B. Palmer" Date: Mon, 7 May 2012 21:33:19 +0100 Subject: [PATCH 2/2] Attempt to fix the double say and disconnect bug, thanks to theli-ua and tanto --- irc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/irc.py b/irc.py index 30d1146..251ed64 100755 --- a/irc.py +++ b/irc.py @@ -42,6 +42,11 @@ class Bot(asynchat.async_chat): import threading self.sending = threading.RLock() + def initiate_send(self): + self.sending.acquire() + asynchat.async_chat.initiate_send(self) + self.sending.release() + # def push(self, *args, **kargs): # asynchat.async_chat.push(self, *args, **kargs)