Commit 259fcfb2 authored by Cool Fire's avatar Cool Fire
Browse files

Change security feed plugins to record last 10 messages

parent dfa58f76
Pipeline #58 passed with stage
in 4 minutes and 52 seconds
......@@ -15,6 +15,7 @@ class Debiansecurity
@feed_url = 'https://www.debian.org/security/dsa-long'
@feed_modi = ''
@feed_timer = 60
@recent = []
@channel = '#news'
......@@ -56,6 +57,16 @@ class Debiansecurity
title = xml.css( 'item title' ).first.text
link = xml.css( 'item link' ).first.text
# Check for already announced stuff
if @recent.include? link
raise 'Stale RSS feed link'
else
@recent.push link
if @recent.size > 10
@recent = @recent [1..10]
end
end
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
......
......@@ -15,6 +15,7 @@ class Oraclesecurity
@feed_url = 'http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/rss-otn-sec.xml'
@feed_date = ''
@feed_timer = 600
@recent = []
@channel = '#news'
......@@ -56,6 +57,16 @@ class Oraclesecurity
title = xml.css( 'item title' ).first.text
link = xml.css( 'item link' ).first.text
# Check for already announced stuff
if @recent.include? link
raise 'Stale RSS feed link'
else
@recent.push link
if @recent.size > 10
@recent = @recent [1..10]
end
end
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
......
......@@ -13,8 +13,8 @@ class Redhatsecurity
@timer = timer
@feed_url = 'https://rhn.redhat.com/rpc/recent-errata.pxt'
@feed_last = ''
@feed_timer = 600
@recent = []
@channel = '#news'
......@@ -50,17 +50,24 @@ class Redhatsecurity
title = xml.css( 'item title' ).last.text
link = xml.css( 'item link' ).last.text
if(link != @feed_last)
@feed_last = link
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
link = plugin.main( nil, nil, nil, nil, nil, link, false )
# Check for already announced stuff
if @recent.include? link
raise 'Stale RSS feed link'
else
@recent.push link
if @recent.size > 10
@recent = @recent [1..10]
end
end
@irc.message( @channel, "\x02\x034,1Red\x0f\x030,1hat\x0f #{title} | #{link}" )
@irc.message( @channel, " " )
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
link = plugin.main( nil, nil, nil, nil, nil, link, false )
end
@irc.message( @channel, "\x02\x034,1Red\x0f\x030,1hat\x0f #{title} | #{link}" )
@irc.message( @channel, " " )
rescue Exception => e
# Silently fail
@output.debug( "Failure while retrieving rss feed: #{e.to_s}\n" )
......
......@@ -13,8 +13,8 @@ class Ubuntusecurity
@timer = timer
@feed_url = 'http://www.ubuntu.com/usn/rss.xml'
@feed_last = ''
@feed_timer = 600
@recent = []
@channel = '#news'
......@@ -50,17 +50,24 @@ class Ubuntusecurity
title = xml.css( 'item title' ).first.text
link = xml.css( 'item link' ).first.text
if(link != @feed_last)
@feed_last = link
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
link = plugin.main( nil, nil, nil, nil, nil, link, false )
# Check for already announced stuff
if @recent.include? link
raise 'Stale RSS feed link'
else
@recent.push link
if @recent.size > 10
@recent = @recent [1..10]
end
end
@irc.message( @channel, "\x037,1Ubuntu\x0f #{title} | #{link}" )
@irc.message( @channel, " " )
# If the tinyurl plugin is loaded, use it
if( @status.checkplugin( "tinyurl" ) )
plugin = @status.getplugin( "tinyurl" )
link = plugin.main( nil, nil, nil, nil, nil, link, false )
end
@irc.message( @channel, "\x037,1Ubuntu\x0f #{title} | #{link}" )
@irc.message( @channel, " " )
rescue Exception => e
# Silently fail
@output.debug( "Failure while retrieving rss feed: #{e.to_s}\n" )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment