mutantmonkey 2012-05-30 22:55:11 -07:00
commit 1d461a8484
2 changed files with 18 additions and 6 deletions

5
irc.py
View File

@ -47,6 +47,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)

19
phenny
View File

@ -64,6 +64,14 @@ def create_default_config(fn):
"""), file=f)
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)
@ -73,16 +81,15 @@ def create_dotdir(dotdir):
print('Please fix this and then run phenny again.', file=sys.stderr)
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'