strip the connection name
This commit is contained in:
parent
7ad1ad20b2
commit
0ee036df56
1 changed files with 5 additions and 2 deletions
7
bot.py
7
bot.py
|
@ -15,9 +15,9 @@ import Queue
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
|
|
||||||
sys.path += ['plugins'] # so 'import hook' works without duplication
|
sys.path += ['plugins', 'lib'] # so 'import hook' works without duplication
|
||||||
sys.path += ['lib']
|
|
||||||
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
|
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ bot.conns = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for name, conf in bot.config['connections'].iteritems():
|
for name, conf in bot.config['connections'].iteritems():
|
||||||
|
# strip all spaces and capitalization from the connection name
|
||||||
|
name = name.replace(" ", "_")
|
||||||
|
name = re.sub('[^A-Za-z0-9_]+', '', name).lower()
|
||||||
print 'Connecting to server: %s' % conf['server']
|
print 'Connecting to server: %s' % conf['server']
|
||||||
if conf.get('ssl'):
|
if conf.get('ssl'):
|
||||||
bot.conns[name] = SSLIRC(name, conf['server'], conf['nick'], conf=conf,
|
bot.conns[name] = SSLIRC(name, conf['server'], conf['nick'], conf=conf,
|
||||||
|
|
Reference in a new issue