Added configurable prefix to new news item announcements

This commit is contained in:
Daniel DiPaolo 2004-01-05 01:04:03 +00:00
parent 626038fa53
commit 4dd0e26ddc

View File

@ -76,7 +76,10 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
it announces new additions."""), it announces new additions."""),
('headline-separator', configurable.SpaceSurroundedStrType, ' :: ', ('headline-separator', configurable.SpaceSurroundedStrType, ' :: ',
"""Determines what string is used to seperate headlines in """Determines what string is used to seperate headlines in
feeds."""),] feeds."""),
('announce-news-prefix', configurable.StrType, 'New news item - ',
"""Sets the prefix to be added (if any) to the new news item
announcements made to the channel."""),]
) )
globalConfigurables = configurable.Dictionary( globalConfigurables = configurable.Dictionary(
[('wait-period', configurable.PositiveIntType, 1800, [('wait-period', configurable.PositiveIntType, 1800,
@ -96,6 +99,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
for (channel, d) in feeds.iteritems(): for (channel, d) in feeds.iteritems():
sep = self.configurables.get('headline-separator', channel) sep = self.configurables.get('headline-separator', channel)
bold = self.configurables.get('announce-news-bold', channel) bold = self.configurables.get('announce-news-bold', channel)
prefix = self.configurables.get('announce-news-prefix', channel)
for name in d: for name in d:
if self.isCommand(name): if self.isCommand(name):
url = self.getCommand(name).url url = self.getCommand(name).url
@ -117,7 +121,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
if bold: if bold:
name = ircutils.bold(name) name = ircutils.bold(name)
headlines = sep.join(newheadlines) headlines = sep.join(newheadlines)
s = '%s: %s' % (name, headlines) s = '%s%s: %s' % (prefix, name, headlines)
irc.queueMsg(ircmsgs.privmsg(channel, s)) irc.queueMsg(ircmsgs.privmsg(channel, s))
def getFeed(self, url): def getFeed(self, url):