Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Cool Fire
nanobot4
Commits
933fd7be
Commit
933fd7be
authored
Mar 19, 2018
by
Cool Fire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update buffering strategy for redhat security feed.
parent
24926372
Pipeline
#573
failed with stages
in 6 minutes and 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
plugins/redhatsecurity.rb
plugins/redhatsecurity.rb
+14
-13
No files found.
plugins/redhatsecurity.rb
View file @
933fd7be
...
@@ -25,7 +25,6 @@ class Redhatsecurity
...
@@ -25,7 +25,6 @@ class Redhatsecurity
# Default action for this plugin
# Default action for this plugin
def
main
(
nick
,
user
,
host
,
from
,
msg
,
arguments
,
con
)
def
main
(
nick
,
user
,
host
,
from
,
msg
,
arguments
,
con
)
end
end
# Method to be called when the plugin is unloaded
# Method to be called when the plugin is unloaded
...
@@ -45,28 +44,30 @@ class Redhatsecurity
...
@@ -45,28 +44,30 @@ class Redhatsecurity
# Grab rss
# Grab rss
xml
=
agent
.
get
(
@feed_url
).
body
xml
=
agent
.
get
(
@feed_url
).
body
xml
=
Nokogiri
::
XML
(
xml
)
xml
=
Nokogiri
::
XML
(
xml
)
# Parse out info
# Parse out info
items
=
xms
.
css
(
'item'
)
title
=
xml
.
css
(
'item title'
).
last
.
text
title
=
xml
.
css
(
'item title'
).
last
.
text
link
=
xml
.
css
(
'item link'
).
last
.
text
link
=
xml
.
css
(
'item link'
).
last
.
text
# Check for already announced stuff
# Check for already announced stuff
if
@recent
.
include?
link
if
@recent
.
include?
link
raise
'Stale RSS feed
link
'
@recent
.
delete
link
else
else
@recent
.
push
link
# If the tinyurl plugin is loaded, use it
if
@recent
.
size
>
10
if
(
@status
.
checkplugin
(
"tinyurl"
)
)
@recent
=
@recent
[
1
..
10
]
plugin
=
@status
.
getplugin
(
"tinyurl"
)
link
=
plugin
.
main
(
nil
,
nil
,
nil
,
nil
,
nil
,
link
,
false
)
end
end
end
# If the tinyurl plugin is loaded, use it
@irc
.
message
(
@channel
,
"
\x02\x03
4,1Red
\x0f\x03
0,1hat
\x0f
#{
title
}
|
#{
link
}
"
)
if
(
@status
.
checkplugin
(
"tinyurl"
)
)
@irc
.
message
(
@channel
,
" "
)
plugin
=
@status
.
getplugin
(
"tinyurl"
)
link
=
plugin
.
main
(
nil
,
nil
,
nil
,
nil
,
nil
,
link
,
false
)
end
end
@recent
.
push
link
# Trim buffer
@recent
.
shift
(
@recent
.
length
-
50
)
if
@recent
.
length
>
50
@irc
.
message
(
@channel
,
"
\x02\x03
4,1Red
\x0f\x03
0,1hat
\x0f
#{
title
}
|
#{
link
}
"
)
@irc
.
message
(
@channel
,
" "
)
rescue
Exception
=>
e
rescue
Exception
=>
e
# Silently fail
# Silently fail
@output
.
debug
(
"Failure while retrieving rss feed:
#{
e
.
message
}
\n
"
)
@output
.
debug
(
"Failure while retrieving rss feed:
#{
e
.
message
}
\n
"
)
...
@@ -76,4 +77,4 @@ class Redhatsecurity
...
@@ -76,4 +77,4 @@ class Redhatsecurity
sleep
(
@feed_timer
)
sleep
(
@feed_timer
)
end
end
end
end
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment