[TASK] Add ssl support.
This commit is contained in:
parent
b500639653
commit
5a3db5ab7c
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from twisted.words.protocols import irc
|
from twisted.words.protocols import irc
|
||||||
from twisted.internet import reactor, protocol
|
from twisted.internet import reactor, protocol, ssl
|
||||||
from twisted.python import usage, log
|
from twisted.python import usage, log
|
||||||
from twisted.internet import inotify
|
from twisted.internet import inotify
|
||||||
from twisted.python import filepath
|
from twisted.python import filepath
|
||||||
|
@ -141,6 +141,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
host = config.get('irc', 'host')
|
host = config.get('irc', 'host')
|
||||||
port = int(config.get('irc', 'port'))
|
port = int(config.get('irc', 'port'))
|
||||||
|
ssl_switch = config.get('irc', 'ssl')
|
||||||
channel = config.get('irc', 'channel')
|
channel = config.get('irc', 'channel')
|
||||||
nickname = config.get('irc', 'nickname')
|
nickname = config.get('irc', 'nickname')
|
||||||
nickserv_pw = config.get('irc', 'nickserv_pw')
|
nickserv_pw = config.get('irc', 'nickserv_pw')
|
||||||
|
@ -153,7 +154,10 @@ if __name__ == '__main__':
|
||||||
f = MonitorBotFactory(nickname, channel, nickserv_pw, fsmon)
|
f = MonitorBotFactory(nickname, channel, nickserv_pw, fsmon)
|
||||||
|
|
||||||
# connect factory to this host and port
|
# connect factory to this host and port
|
||||||
reactor.connectTCP(host, port, f)
|
if ssl_switch == 'no':
|
||||||
|
reactor.connectTCP(host, port, f)
|
||||||
|
else:
|
||||||
|
reactor.connectSSL(host, port, f, ssl.ClientContextFactory())
|
||||||
|
|
||||||
# run bot
|
# run bot
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
coverage
|
coverage
|
||||||
pyopenssl
|
pyopenssl
|
||||||
twisted
|
twisted
|
||||||
|
service_identity
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
[irc]
|
[irc]
|
||||||
host = irc.euirc.net
|
host = irc.euirc.net
|
||||||
port = 6667
|
port = 6667
|
||||||
|
ssl = no
|
||||||
|
ssl = yes
|
||||||
nickName = FDS-kun
|
nickName = FDS-kun
|
||||||
realName = bot: provides tracking of an ftp folder
|
realName = bot: provides tracking of an ftp folder
|
||||||
channel = #JPT
|
channel = #JPT
|
||||||
|
|
Loading…
Reference in New Issue