mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-10-14 17:59:29 +02:00
Change RSS.announce such that it appends the given feeds to its current
list of feeds to announce.
This commit is contained in:
parent
850effae95
commit
0d6761f1c6
@ -333,37 +333,41 @@ class RSS(callbacks.Privmsg):
|
|||||||
def announce(self, irc, msg, args, channel, optlist, rest):
|
def announce(self, irc, msg, args, channel, optlist, rest):
|
||||||
"""[<channel>] [--remove] [<name|url> ...]
|
"""[<channel>] [--remove] [<name|url> ...]
|
||||||
|
|
||||||
Sets the current list of announced feeds in the channel to the feeds
|
Adds the list of <name|url> to the current list of announced feeds in
|
||||||
given. Valid feeds include the names of registered feeds as well as
|
the channel given. Valid feeds include the names of registered feeds
|
||||||
URLs for a RSS feeds. <channel> is only necessary if the message isn't
|
as well as URLs for a RSS feeds. <channel> is only necessary if the
|
||||||
sent in the channel itself. If no arguments are specified, replies
|
message isn't sent in the channel itself. If no arguments are
|
||||||
with the current list of feeds to announce. If --remove is given,
|
specified, replies with the current list of feeds to announce. If
|
||||||
the specified feeds will be removed from the list of feeds to announce.
|
--remove is given, the specified feeds will be removed from the list
|
||||||
|
of feeds to announce.
|
||||||
"""
|
"""
|
||||||
remove = False
|
remove = False
|
||||||
announce = conf.supybot.plugins.RSS.announce
|
announce = conf.supybot.plugins.RSS.announce
|
||||||
for (option, _) in optlist:
|
for (option, _) in optlist:
|
||||||
if option == 'remove':
|
if option == 'remove':
|
||||||
|
if not rest:
|
||||||
|
raise callbacks.ArgumentError
|
||||||
remove = True
|
remove = True
|
||||||
if remove:
|
def addFeed(feed):
|
||||||
if rest:
|
if feed not in feeds:
|
||||||
feeds = announce.get(channel)()
|
feeds.add(feed)
|
||||||
for feed in rest:
|
def removeFeed(feed):
|
||||||
if feed in feeds:
|
if feed in feeds:
|
||||||
feeds.remove(feed)
|
feeds.remove(feed)
|
||||||
announce.get(channel).setValue(feeds)
|
if rest:
|
||||||
irc.replySuccess()
|
if remove:
|
||||||
return
|
updater = removeFeed
|
||||||
else:
|
else:
|
||||||
raise callbacks.ArgumentError
|
updater = addFeed
|
||||||
|
feeds = announce.get(channel)()
|
||||||
|
for feed in rest:
|
||||||
|
updater(feed)
|
||||||
|
announce.get(channel).setValue(feeds)
|
||||||
|
irc.replySuccess()
|
||||||
elif not rest:
|
elif not rest:
|
||||||
feeds = utils.commaAndify(announce.get(channel)())
|
feeds = utils.commaAndify(announce.get(channel)())
|
||||||
irc.reply(feeds or 'I am currently not announcing any feeds.')
|
irc.reply(feeds or 'I am currently not announcing any feeds.')
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
announce.get(channel).setValue(rest)
|
|
||||||
irc.replySuccess()
|
|
||||||
return
|
|
||||||
announce = wrap(announce, [('checkChannelCapability', 'op'),
|
announce = wrap(announce, [('checkChannelCapability', 'op'),
|
||||||
getopts({'remove':''}), any('something')])
|
getopts({'remove':''}), any('something')])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user