Skip to content

Commit

Permalink
Merge pull request #1431 from delanne/IRCnoticeOnChannel
Browse files Browse the repository at this point in the history
set noticeOnChannel to True by default (keep the same behaviour as eight)
  • Loading branch information
Mikhail Sobolev committed Dec 11, 2014
2 parents 19a0e7c + 6e303e9 commit d928cf0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
20 changes: 9 additions & 11 deletions master/buildbot/status/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def connectionLost(self, reason):

# The following methods are called when we write something.
def groupChat(self, channel, message):
if self.noticeOnChannel:
self.notice(channel, message.encode('utf-8', 'replace'))
self.notice(channel, message.encode('utf-8', 'replace'))

def chat(self, user, message):
self.msg(user, message.encode('utf-8', 'replace'))
Expand Down Expand Up @@ -142,7 +141,7 @@ class IrcStatusFactory(ThrottledClientFactory):
p = None

def __init__(self, nickname, password, channels, pm_to_nicks, tags, notify_events,
noticeOnChannel=False, useRevisions=False, showBlameList=False,
useRevisions=False, showBlameList=False,
lostDelay=None, failedDelay=None, useColors=True, allowShutdown=False):
ThrottledClientFactory.__init__(self, lostDelay=lostDelay,
failedDelay=failedDelay)
Expand All @@ -153,7 +152,6 @@ def __init__(self, nickname, password, channels, pm_to_nicks, tags, notify_event
self.pm_to_nicks = pm_to_nicks
self.tags = tags
self.notify_events = notify_events
self.noticeOnChannel = noticeOnChannel
self.useRevisions = useRevisions
self.showBlameList = showBlameList
self.useColors = useColors
Expand All @@ -173,7 +171,6 @@ def buildProtocol(self, address):
p = self.protocol(self.nickname, self.password,
self.channels, self.pm_to_nicks, self.status,
self.tags, self.notify_events,
noticeOnChannel=self.noticeOnChannel,
useColors=self.useColors,
useRevisions=self.useRevisions,
showBlameList=self.showBlameList)
Expand Down Expand Up @@ -208,18 +205,20 @@ class IRC(base.StatusReceiverMultiService):

def __init__(self, host, nick, channels, pm_to_nicks=[], port=6667,
allowForce=False, tags=None, password=None, notify_events={},
noticeOnChannel=False, showBlameList=True, useRevisions=False,
showBlameList=True, useRevisions=False,
useSSL=False, lostDelay=None, failedDelay=None, useColors=True,
allowShutdown=False, categories=None # categories is deprecated
allowShutdown=False, **kwargs
):
base.StatusReceiverMultiService.__init__(self)

deprecated_params = kwargs.keys()
if deprecated_params:
config.error("%s are deprecated" % (",".join(deprecated_params)))

if allowForce not in (True, False):
config.error("allowForce must be boolean, not %r" % (allowForce,))
if allowShutdown not in (True, False):
config.error("allowShutdown must be boolean, not %r" % (allowShutdown,))
if categories:
log.msg("WARNING: categories are deprecated and should be replaced with 'tags=[cat]'")

# need to stash these so we can detect changes later
self.host = host
Expand All @@ -230,14 +229,13 @@ def __init__(self, host, nick, channels, pm_to_nicks=[], port=6667,
self.password = password
self.allowForce = allowForce
self.useRevisions = useRevisions
self.tags = tags or categories
self.tags = tags
self.notify_events = notify_events
self.allowShutdown = allowShutdown

self.f = IrcStatusFactory(self.nick, self.password,
self.channels, self.pm_to_nicks,
self.tags, self.notify_events,
noticeOnChannel=noticeOnChannel,
useRevisions=useRevisions,
showBlameList=showBlameList,
lostDelay=lostDelay,
Expand Down
3 changes: 1 addition & 2 deletions master/buildbot/status/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ class StatusBot(object):

contactClass = Contact

def __init__(self, status, tags, notify_events, noticeOnChannel=False,
def __init__(self, status, tags, notify_events,
useRevisions=False, showBlameList=False, useColors=True,
categories=None # deprecated
):
Expand All @@ -997,7 +997,6 @@ def __init__(self, status, tags, notify_events, noticeOnChannel=False,
self.master = status.master
self.tags = tags or categories
self.notify_events = notify_events
self.noticeOnChannel = noticeOnChannel
self.useColors = useColors
self.useRevisions = useRevisions
self.showBlameList = showBlameList
Expand Down
6 changes: 2 additions & 4 deletions master/buildbot/test/unit/test_status_irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def makeBot(self, *args, **kwargs):
return irc.IrcStatusBot(*args, **kwargs)

def test_groupChat(self):
b = self.makeBot(noticeOnChannel=True)
b = self.makeBot()
b.notice = lambda d, m: evts.append(('n', d, m))

evts = []
b.groupChat('#chan', 'hi')
self.assertEqual(evts, [('n', '#chan', 'hi')])

def test_chat(self):
b = self.makeBot(noticeOnChannel=False)
b = self.makeBot()
b.msg = lambda d, m: evts.append(('m', d, m))

evts = []
Expand Down Expand Up @@ -234,7 +234,6 @@ def test_constr_args(self):
tags=['tags'],
password='pass',
notify_events={'successToFailure': 1, },
noticeOnChannel=True,
showBlameList=False,
useRevisions=True,
useSSL=False,
Expand All @@ -254,7 +253,6 @@ def test_constr_args(self):
factory.protocol.assert_called_with(
'nick', 'pass', ['channels'], ['pm', 'to', 'nicks'],
factory.status, ['tags'], {'successToFailure': 1},
noticeOnChannel=True,
useColors=False,
useRevisions=True,
showBlameList=False)
Expand Down
4 changes: 0 additions & 4 deletions master/docs/manual/cfg-statustargets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,6 @@ The following parameters are accepted by this class:
A dictionnary of events to be notified on the IRC channels.
This parameter can be changed during run-time by sending the ``notify`` command to the bot.

``noticeOnChannel``
(optional, disabled by default)
Whether to respond privately to request from users, or to respond on the channel the request was made.

``showBlameList``
(optional, disabled by default)
Whether or not to display the blamelist for failed builds.
Expand Down
5 changes: 5 additions & 0 deletions master/docs/relnotes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ Changes and Removals
* Property values must be serializable in JSON.
* :bb:status:`IRC` has the following changes:
- categories parameter is deprecated and removed. It should be replaced with tags=[cat]
- noticeOnChannel parameter is deprecated and removed.
Changes for Developers
~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit d928cf0

Please sign in to comment.