diff --git a/plugins/RSS/config.py b/plugins/RSS/config.py index f36e9dc4b..1027a462d 100644 --- a/plugins/RSS/config.py +++ b/plugins/RSS/config.py @@ -70,6 +70,13 @@ conf.registerChannelValue(RSS, 'showLinks', along with the title of the feed when the rss command is called. supybot.plugins.RSS.announce.showLinks affects whether links will be listed when a feed is automatically announced.""")) +conf.registerGlobalValue(RSS, 'defaultNumberOfHeadlines', + registry.PositiveInteger(1, """Indicates how many headlines an rss feed + will output by default, if no number is provided.""")) +conf.registerChannelValue(RSS, 'initialAnnounceHeadlines', + registry.PositiveInteger(5, """Indicates how many headlines an rss feed + will output when it is first added to announce for a channel.""")) + conf.registerGroup(RSS, 'announce') conf.registerChannelValue(RSS.announce, 'showLinks', diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index 9f5a4d591..6baf7498f 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -183,6 +183,8 @@ class RSS(callbacks.Plugin): newheadlines = filter(None, newheadlines) # Removes Nones. if newheadlines: for channel in channels: + if len(oldheadlines) == 0: + newheadlines = newheadlines[:self.registryValue('initialAnnounceHeadlines', channel)] bold = self.registryValue('bold', channel) sep = self.registryValue('headlineSeparator', channel) prefix = self.registryValue('announcementPrefix', channel) @@ -392,6 +394,8 @@ class RSS(callbacks.Plugin): headlines = self.buildHeadlines(headlines, channel, 'showLinks') if n: headlines = headlines[:n] + else: + headlines = headlines[:self.registryValue('defaultNumberOfHeadlines')] sep = self.registryValue('headlineSeparator', channel) if self.registryValue('bold', channel): sep = ircutils.bold(sep)