mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
RSS: Remove illegal characters from entries.
This commit is contained in:
parent
9e645ed645
commit
7c4a28d7fd
@ -361,6 +361,8 @@ class RSS(callbacks.Plugin):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
_normalize_entry = utils.str.multipleReplacer(
|
||||||
|
{'\r': ' ', '\n': ' ', '\x00': ''})
|
||||||
def format_entry(self, channel, feed, entry, is_announce):
|
def format_entry(self, channel, feed, entry, is_announce):
|
||||||
key_name = 'announceFormat' if is_announce else 'format'
|
key_name = 'announceFormat' if is_announce else 'format'
|
||||||
if feed.name in self.registryValue('feeds'):
|
if feed.name in self.registryValue('feeds'):
|
||||||
@ -371,10 +373,11 @@ class RSS(callbacks.Plugin):
|
|||||||
template = self.registryValue(key_name, channel)
|
template = self.registryValue(key_name, channel)
|
||||||
date = entry.get('published_parsed')
|
date = entry.get('published_parsed')
|
||||||
date = utils.str.timestamp(date)
|
date = utils.str.timestamp(date)
|
||||||
return string.Template(template).safe_substitute(
|
s = string.Template(template).safe_substitute(
|
||||||
feed_name=feed.name,
|
feed_name=feed.name,
|
||||||
date=date,
|
date=date,
|
||||||
**entry)
|
**entry)
|
||||||
|
return self._normalize_entry(s)
|
||||||
|
|
||||||
def announce_entry(self, irc, channel, feed, entry):
|
def announce_entry(self, irc, channel, feed, entry):
|
||||||
if self.should_send_entry(channel, entry):
|
if self.should_send_entry(channel, entry):
|
||||||
|
Loading…
Reference in New Issue
Block a user