diff --git a/.gitignore b/.gitignore index 108b518..efa61ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ .tox AUTHORS ChangeLog +*.egg *egg-info dist/* build/* *.pyc doc/build/* -doc/source/api/* +doc/source/api/* \ No newline at end of file diff --git a/doc/source/installation.rst b/doc/source/installation.rst index e1766bb..6a23604 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -17,6 +17,7 @@ when starting the bot. It should look like:: pass=PASSWORD server=irc.freenode.net port=6667 + force_ssl=True or False (Defaults to False) server_password=SERVERPASS channel_config=/path/to/yaml/config diff --git a/gerritbot/bot.py b/gerritbot/bot.py index 8027b8c..301a5f6 100755 --- a/gerritbot/bot.py +++ b/gerritbot/bot.py @@ -22,6 +22,7 @@ nick=NICKNAME pass=PASSWORD server=irc.freenode.net port=6667 +force_ssl=false server_password=SERVERPASS channel_config=/path/to/yaml/config @@ -75,8 +76,8 @@ irc.client.ServerConnection.buffer_class.errors = 'replace' class GerritBot(irc.bot.SingleServerIRCBot): def __init__(self, channels, nickname, password, server, port=6667, - server_password=None): - if port == 6697: + force_ssl=False, server_password=None): + if force_ssl or port == 6697: factory = irc.connection.Factory(wrapper=ssl.wrap_socket) super(GerritBot, self).__init__([(server, port, server_password)], nickname, nickname, @@ -296,7 +297,8 @@ class ChannelConfig(object): def _main(): - config = ConfigParser.ConfigParser({'server_password': None}) + config = ConfigParser.ConfigParser({'force_ssl': 'false', + 'server_password': None}) config.read(sys.argv[1]) setup_logging(config) @@ -315,6 +317,7 @@ def _main(): config.get('ircbot', 'pass'), config.get('ircbot', 'server'), config.getint('ircbot', 'port'), + config.getboolean('ircbot', 'force_ssl'), config.get('ircbot', 'server_password')) g = Gerrit(bot, channel_config,