Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/180365
Change subject: redis2irc: join channels after reloading config
......................................................................
redis2irc: join channels after reloading config
Change-Id: I141cd4611f3cfed91e280b07cb742361254d5709
---
M redis2irc.py
1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/wikibugs2
refs/changes/65/180365/1
diff --git a/redis2irc.py b/redis2irc.py
index fde7c17..3b44cc9 100644
--- a/redis2irc.py
+++ b/redis2irc.py
@@ -21,10 +21,25 @@
:type builder: messagebuilder.IRCMessageBuilder
:type chanfilter: channelfilter.ChannelFilter
"""
+ self.channels = set(kwargs['autojoins'])
super(Redis2Irc, self).__init__(**kwargs)
self._conf = conf
self._builder = builder
self._chanfilter = chanfilter
+
+ def join_many(self, targets):
+ for target in targets:
+ if target not in self.channels:
+ self.join(target)
+
+ def join(self, target):
+ super(Redis2Irc, self).join(target)
+ self.channels.add(target)
+
+ def part(self, target, reason=None):
+ super(Redis2Irc, self).part(target, reason)
+ if target in self.channels:
+ self.channels.remove(target)
@property
def conf(self):
@@ -52,6 +67,8 @@
updated = bot.chanfilter.update()
if updated:
bot.privmsg('#wikimedia-labs', '!log tools.wikibugs Updated
channels.yaml to: %s' % updated)
+ # Reload channels
+ bot.join_many(bot.chanfilter.all_channels())
channels = bot.chanfilter.channels_for(useful_info['projects'])
for chan in channels:
bot.privmsg(chan, text)
--
To view, visit https://gerrit.wikimedia.org/r/180365
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I141cd4611f3cfed91e280b07cb742361254d5709
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/wikibugs2
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits