mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-24 03:29:28 +01:00
Updated to use the same scheme as Bugzilla.
This commit is contained in:
parent
69b6ee4c6f
commit
c51a9db841
@ -63,11 +63,11 @@ def configure(advanced):
|
|||||||
prompt = 'Would you like to add another RSS feed?'
|
prompt = 'Would you like to add another RSS feed?'
|
||||||
name = something('What\'s the name of the website?')
|
name = something('What\'s the name of the website?')
|
||||||
url = something('What\'s the URL of the RSS feed?')
|
url = something('What\'s the URL of the RSS feed?')
|
||||||
|
# XXX How should we fix this? I'm thinking just remove it.
|
||||||
registerFeed(name, url)
|
registerFeed(name, url)
|
||||||
|
|
||||||
class AnnouncedFeeds(registry.SpaceSeparatedListOf):
|
class AnnouncedFeeds(registry.SpaceSeparatedListOfStrings):
|
||||||
Value = registry.String
|
List = callbacks.CanonicalNameSet
|
||||||
List = ircutils.IrcSet
|
|
||||||
|
|
||||||
conf.registerPlugin('RSS')
|
conf.registerPlugin('RSS')
|
||||||
conf.registerChannelValue(conf.supybot.plugins.RSS, 'bold', registry.Boolean(
|
conf.registerChannelValue(conf.supybot.plugins.RSS, 'bold', registry.Boolean(
|
||||||
@ -81,19 +81,16 @@ conf.registerChannelValue(conf.supybot.plugins.RSS, 'announcementPrefix',
|
|||||||
is prepended (if any) to the new news item announcements made in the
|
is prepended (if any) to the new news item announcements made in the
|
||||||
channel."""))
|
channel."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.RSS, 'announce',
|
conf.registerChannelValue(conf.supybot.plugins.RSS, 'announce',
|
||||||
AnnouncedFeeds([], """Determines which RSS feeds should be announced in
|
AnnouncedFeeds([], """Determines which RSS feeds should be announced in the
|
||||||
the channel; valid input is a list of strings (either registered RSS feeds
|
channel; valid input is a list of strings (either registered RSS feeds or
|
||||||
or RSS feed URLs) separated by spaces."""))
|
RSS feed URLs) separated by spaces."""))
|
||||||
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'waitPeriod',
|
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'waitPeriod',
|
||||||
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
|
registry.PositiveInteger(1800, """Indicates how many seconds the bot will
|
||||||
wait between retrieving RSS feeds; requests made within this period will
|
wait between retrieving RSS feeds; requests made within this period will
|
||||||
return cached results."""))
|
return cached results."""))
|
||||||
conf.registerGroup(conf.supybot.plugins.RSS, 'feeds')
|
conf.registerGlobalValue(conf.supybot.plugins.RSS, 'feeds',
|
||||||
conf.supybot.plugins.RSS.feeds.help = utils.normalizeWhitespace("""These are
|
AnnouncedFeeds([], """Determines what feeds should be accessible as
|
||||||
the registered feeds for the RSS plugin.""")
|
commands."""))
|
||||||
|
|
||||||
def registerFeed(name, url):
|
|
||||||
conf.supybot.plugins.RSS.feeds.register(name, registry.String(url, ''))
|
|
||||||
|
|
||||||
class RSS(callbacks.Privmsg):
|
class RSS(callbacks.Privmsg):
|
||||||
threaded = True
|
threaded = True
|
||||||
@ -104,14 +101,16 @@ class RSS(callbacks.Privmsg):
|
|||||||
self.lastRequest = {}
|
self.lastRequest = {}
|
||||||
self.cachedFeeds = {}
|
self.cachedFeeds = {}
|
||||||
self.gettingLockLock = threading.Lock()
|
self.gettingLockLock = threading.Lock()
|
||||||
for (name, url) in registry._cache.iteritems():
|
for name in self.registryValue('feeds'):
|
||||||
if name.startswith('supybot.plugins.rss.feeds.'):
|
self._registerFeed(name)
|
||||||
name = rsplit(name, '.', 1)[-1]
|
url = self.registryValue('feeds.%s' % name)
|
||||||
v = registry.String('', 'help is not needed here')
|
|
||||||
v.set(url)
|
|
||||||
url = v()
|
|
||||||
self.makeFeedCommand(name, url)
|
self.makeFeedCommand(name, url)
|
||||||
|
|
||||||
|
def _registerFeed(self, name, url=''):
|
||||||
|
self.registryValue('feeds').add(name)
|
||||||
|
group = self.registryValue('feeds', value=False)
|
||||||
|
group.register(name, registry.String(url, ''))
|
||||||
|
|
||||||
def __call__(self, irc, msg):
|
def __call__(self, irc, msg):
|
||||||
callbacks.Privmsg.__call__(self, irc, msg)
|
callbacks.Privmsg.__call__(self, irc, msg)
|
||||||
irc = callbacks.SimpleProxy(irc, msg)
|
irc = callbacks.SimpleProxy(irc, msg)
|
||||||
@ -259,7 +258,7 @@ class RSS(callbacks.Privmsg):
|
|||||||
f.url = url # Used by __call__.
|
f.url = url # Used by __call__.
|
||||||
self.feedNames.add(name)
|
self.feedNames.add(name)
|
||||||
setattr(self.__class__, name, f)
|
setattr(self.__class__, name, f)
|
||||||
registerFeed(name, url)
|
self._registerFeed(name, url)
|
||||||
|
|
||||||
def add(self, irc, msg, args):
|
def add(self, irc, msg, args):
|
||||||
"""<name> <url>
|
"""<name> <url>
|
||||||
|
Loading…
Reference in New Issue
Block a user