- add DELEXT configuration option
- update documentation a bit
This commit is contained in:
parent
97a8b5ea28
commit
30c79ac405
4 changed files with 34 additions and 11 deletions
|
|
@ -1,9 +1,10 @@
|
|||
# $Dwarf: CHANGELOG,v 1.19 2003/04/24 09:44:25 ward Exp $
|
||||
# $Dwarf: CHANGELOG,v 1.20 2003/04/24 12:14:36 ward Exp $
|
||||
# $Source$
|
||||
|
||||
from 0.2.0 to 0.2.1
|
||||
- fail gracefully at a lack of configuration
|
||||
- fail gracefully if tempdir doesn't exist or isn't writable
|
||||
- implement DELEXT configuration option
|
||||
|
||||
from 0.1.0 to 0.2.0
|
||||
- fix extension enforcing
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $Dwarf: README,v 1.5 2002/11/05 09:33:40 ward Exp $
|
||||
# $Dwarf: README,v 1.6 2003/04/24 07:59:37 ward Exp $
|
||||
# $Source$
|
||||
|
||||
Ripnews is a bulk downloader for usenet. It's quite flexible in terms of
|
||||
|
|
@ -113,6 +113,12 @@ NEWSRCNAME=<newsrcbase> Specify newsrc basename. Server names
|
|||
will be appended.
|
||||
PERMISSION=<perm> Set permission bits for directory
|
||||
creation. Standard unix style, eg. 0755.
|
||||
EXTENSIONS=<pattern> Set extension include pattern.
|
||||
OPT_M=<pattern> Set EXTENSIONS just for multi part messages.
|
||||
OPT_S=<pattern> Set EXTENSIONS just for single part messages.
|
||||
DELEXT=<pattern> Set extension "mark read" pattern.
|
||||
OPT_MD=<pattern> Set DELEXT just for multi part messages.
|
||||
OPT_SD=<pattern> Set DELEXT just for single part messages.
|
||||
|
||||
Ruby patterns:
|
||||
--------------
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# $Dwarf: TODO,v 1.12 2003/04/20 20:42:43 ward Exp $
|
||||
# $Dwarf: TODO,v 1.13 2003/04/21 22:11:38 ward Exp $
|
||||
# $Source$
|
||||
|
||||
[ ] check for multiple servers (ip adresses) for each name and pick
|
||||
|
|
@ -17,3 +17,5 @@
|
|||
This will mess up things if a get_body is repeated because of
|
||||
exceptions. Use buffering for each body, before writing...
|
||||
[ ] more regression tests
|
||||
[ ] add "mark read" option for subjects
|
||||
[ ] update documentation
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.51 2003/04/24 09:41:17 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.52 2003/04/24 12:14:36 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require 'date'
|
||||
|
|
@ -226,6 +226,10 @@ def check_config
|
|||
@config[i]["-S"] = @config[i]["EXTENSIONS"]
|
||||
@config[i]["-M"] = @config[i]["EXTENSIONS"]
|
||||
end
|
||||
if @config[i].has_key?("DELEXT")
|
||||
@config[i]["-SD"] = @config[i]["DELEXT"]
|
||||
@config[i]["-MD"] = @config[i]["DELEXT"]
|
||||
end
|
||||
@config[i]["-M"] = "(?!.*)" if @config[i].has_key?("-S") and ! @config[i].has_key?("-M")
|
||||
@config[i]["-S"] = "(?!.*)" if @config[i].has_key?("-M") and ! @config[i].has_key?("-S")
|
||||
}
|
||||
|
|
@ -237,12 +241,12 @@ def get_single(subj, group)
|
|||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
print " filename #{filename}\n"
|
||||
return false unless check_ext(group, filename, "s")
|
||||
return false unless check_ext(group, filename, "s", subj)
|
||||
print " UUDecoding...\n"
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
filename = YEnc.get_filename(body)
|
||||
return false unless check_ext(group, filename, "s")
|
||||
return false unless check_ext(group, filename, "s", subj)
|
||||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(body)
|
||||
else
|
||||
|
|
@ -259,14 +263,14 @@ def get_multi(subj, group)
|
|||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
print " filename #{filename}\n"
|
||||
return false unless check_ext(group, filename, "m")
|
||||
return false unless check_ext(group, filename, "m", subj)
|
||||
print " UUDecoding...\n"
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
print "yencc\n"
|
||||
filename = YEnc.get_filename(body)
|
||||
print "filename #{filename}\n"
|
||||
return false unless check_ext(group, filename, "m")
|
||||
return false unless check_ext(group, filename, "m", subj)
|
||||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(body)
|
||||
else
|
||||
|
|
@ -280,12 +284,12 @@ def get_multi(subj, group)
|
|||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
print " filename #{filename}\n"
|
||||
return false unless check_ext(group, filename, "m")
|
||||
return false unless check_ext(group, filename, "m", subj)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
print "yencc\n"
|
||||
filename = YEnc.get_filename(body)
|
||||
print "filename #{filename}\n"
|
||||
return false unless check_ext(group, filename, "m")
|
||||
return false unless check_ext(group, filename, "m", subj)
|
||||
end
|
||||
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
||||
body.collect{|x| file.print "#{x}\n"}
|
||||
|
|
@ -344,11 +348,21 @@ def output_data(subject, mode, filename="", body="")
|
|||
end
|
||||
end
|
||||
|
||||
def check_ext(group, filename, mode)
|
||||
def check_ext(group, filename, mode, subject)
|
||||
case mode
|
||||
when "s"
|
||||
if @config[group].has_key?("-SD") && ( filename =~ /\.(#{@config[group]["-SD"]})$/ )
|
||||
print "Marking '#{subject}' matches as read\n"
|
||||
@articles.group_update_newsrc(subject)
|
||||
return false
|
||||
end
|
||||
return @config[group].has_key?("-S") ? ( filename =~ /\.(#{@config[group]["-S"]})$/ ) : true
|
||||
when "m"
|
||||
if @config[group].has_key?("-MD") && ( filename =~ /\.(#{@config[group]["-MD"]})$/ )
|
||||
print "Marking '#{subject}' matches as read\n"
|
||||
@articles.group_update_newsrc(subject)
|
||||
return false
|
||||
end
|
||||
return @config[group].has_key?("-M") ? ( filename =~ /\.(#{@config[group]["-M"]})$/ ) : true
|
||||
else
|
||||
print "Illegal mode \"#{mode}\" in check_ext\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue