mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-13 04:01:05 +01:00
Fixed bug that cause RSS.announce not to announce in more than one channel.
This commit is contained in:
parent
93f64b6a68
commit
5f53515a54
@ -111,6 +111,7 @@ class RSS(callbacks.Privmsg):
|
|||||||
callbacks.Privmsg.__call__(self, irc, msg)
|
callbacks.Privmsg.__call__(self, irc, msg)
|
||||||
irc = callbacks.IrcObjectProxyRegexp(irc, msg)
|
irc = callbacks.IrcObjectProxyRegexp(irc, msg)
|
||||||
L = conf.supybot.plugins.RSS.announce.getValues(fullNames=False)
|
L = conf.supybot.plugins.RSS.announce.getValues(fullNames=False)
|
||||||
|
newFeeds = {}
|
||||||
for (channel, v) in L:
|
for (channel, v) in L:
|
||||||
feeds = v()
|
feeds = v()
|
||||||
for name in feeds:
|
for name in feeds:
|
||||||
@ -119,15 +120,17 @@ class RSS(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
url = name
|
url = name
|
||||||
if self.willGetNewFeed(url):
|
if self.willGetNewFeed(url):
|
||||||
|
newFeeds.setdefault(url, []).append(channel)
|
||||||
|
for (feed, channels) in newFeeds.iteritems():
|
||||||
t = threading.Thread(target=self._newHeadlines,
|
t = threading.Thread(target=self._newHeadlines,
|
||||||
name='Fetching <%s>' % url,
|
name='Fetching <%s>' % url,
|
||||||
args=(irc, channel, name, url))
|
args=(irc, channels, name, url))
|
||||||
self.log.info('Spawning thread to fetch <%s>', url)
|
self.log.info('Spawning thread to fetch <%s>', url)
|
||||||
world.threadsSpawned += 1
|
world.threadsSpawned += 1
|
||||||
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
def _newHeadlines(self, irc, channels, name, url):
|
||||||
def _newHeadlines(self, irc, channel, name, url):
|
|
||||||
try:
|
try:
|
||||||
oldresults = self.cachedFeeds[url]
|
oldresults = self.cachedFeeds[url]
|
||||||
oldheadlines = self.getHeadlines(oldresults)
|
oldheadlines = self.getHeadlines(oldresults)
|
||||||
@ -140,10 +143,11 @@ class RSS(callbacks.Privmsg):
|
|||||||
newheadlines.remove(headline)
|
newheadlines.remove(headline)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
if newheadlines:
|
||||||
|
for channel in channels:
|
||||||
bold = self.registryValue('bold', channel)
|
bold = self.registryValue('bold', channel)
|
||||||
sep = self.registryValue('headlineSeparator', channel)
|
sep = self.registryValue('headlineSeparator', channel)
|
||||||
prefix = self.registryValue('announcementPrefix', channel)
|
prefix = self.registryValue('announcementPrefix', channel)
|
||||||
if newheadlines:
|
|
||||||
pre = '%s%s: ' % (prefix, name)
|
pre = '%s%s: ' % (prefix, name)
|
||||||
if bold:
|
if bold:
|
||||||
pre = ircutils.bold(pre)
|
pre = ircutils.bold(pre)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user