Skip to content

Commit

Permalink
add SSL support to IRC bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael MacDonald committed Jan 7, 2010
1 parent d9699ca commit 4412014
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions buildbot/scripts/sample.cfg
Expand Up @@ -147,6 +147,8 @@ c['status'].append(html.WebStatus(http_port=8010))
# from buildbot.status import words
# c['status'].append(words.IRC(host="irc.example.com", nick="bb",
# channels=["#example"]))
# c['status'].append(words.IRC(host="irc.example.com", nick="bb",
# channels=["#example"], useSSL=True))
#
# from buildbot.status import client
# c['status'].append(client.PBListener(9988))
Expand Down
14 changes: 11 additions & 3 deletions buildbot/status/words.py
Expand Up @@ -853,12 +853,13 @@ class IRC(base.StatusReceiverMultiService):
server, however I can join multiple channels."""

compare_attrs = ["host", "port", "nick", "password",
"channels", "allowForce",
"channels", "allowForce", "useSSL",
"categories"]

def __init__(self, host, nick, channels, port=6667, allowForce=True,
categories=None, password=None, notify_events={},
noticeOnChannel = False, showBlameList = True):
noticeOnChannel = False, showBlameList = True,
useSSL=False):
base.StatusReceiverMultiService.__init__(self)

assert allowForce in (True, False) # TODO: implement others
Expand All @@ -877,7 +878,14 @@ def __init__(self, host, nick, channels, port=6667, allowForce=True,
self.channels, self.categories, self.notify_events,
noticeOnChannel = noticeOnChannel,
showBlameList = showBlameList)
c = internet.TCPClient(self.host, self.port, self.f)

if useSSL:
# SSL client needs a ClientContextFactory for some SSL mumbo-jumbo
cf = ssl.ClientContextFactory()
c = internet.SSLCLient(self.host, self.port, self.f, cf)
else:
c = internet.TCPClient(self.host, self.port, self.f)

c.setServiceParent(self)

def setServiceParent(self, parent):
Expand Down

0 comments on commit 4412014

Please sign in to comment.