master
commit
3088bd358b
|
@ -34,7 +34,7 @@ def run_phenny(config):
|
|||
|
||||
def connect(config):
|
||||
p = bot.Phenny(config)
|
||||
p.run(config.host, config.port)
|
||||
p.run(config.host, config.port, config.ssl)
|
||||
|
||||
try: Watcher()
|
||||
except Exception, e:
|
||||
|
|
9
irc.py
9
irc.py
|
@ -64,15 +64,18 @@ class Bot(asynchat.async_chat):
|
|||
self.__write(args, text)
|
||||
except Exception, e: pass
|
||||
|
||||
def run(self, host, port=6667):
|
||||
self.initiate_connect(host, port)
|
||||
def run(self, host, port=6667, ssl=False):
|
||||
self.initiate_connect(host, port, ssl)
|
||||
|
||||
def initiate_connect(self, host, port):
|
||||
def initiate_connect(self, host, port, ssl):
|
||||
if self.verbose:
|
||||
message = 'Connecting to %s:%s...' % (host, port)
|
||||
print >> sys.stderr, message,
|
||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.connect((host, port))
|
||||
if ssl:
|
||||
import ssl
|
||||
self.socket = ssl.wrap_socket(self.socket)
|
||||
try: asyncore.loop()
|
||||
except KeyboardInterrupt:
|
||||
sys.exit()
|
||||
|
|
5
phenny
5
phenny
|
@ -27,6 +27,8 @@ def create_default_config(fn):
|
|||
print >> f, trim("""\
|
||||
nick = 'phenny'
|
||||
host = 'irc.example.net'
|
||||
port = 6667
|
||||
ssl = False
|
||||
channels = ['#example', '#test']
|
||||
owner = 'yournickname'
|
||||
|
||||
|
@ -135,6 +137,9 @@ def main(argv=None):
|
|||
if not hasattr(module, 'port'):
|
||||
module.port = 6667
|
||||
|
||||
if not hasattr(module, 'ssl'):
|
||||
module.ssl = False
|
||||
|
||||
if not hasattr(module, 'password'):
|
||||
module.password = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue