new Mark Remaining Read option

This commit is contained in:
Ward Wouts 2005-05-10 20:52:58 +00:00
parent e827c94393
commit 6c92fcd40b
3 changed files with 34 additions and 19 deletions

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/ruby -w
# $Dwarf: ripnews.rb,v 1.102 2005/03/01 09:18:50 ward Exp $
# $Dwarf: ripnews.rb,v 1.103 2005/03/01 19:56:56 ward Exp $
# $Source$
#
@ -428,9 +428,9 @@ def get_multi(subj, group)
end
@decode_threads << Thread.new(body, file, fileout, subj) do |tbody, tfile, tfileout, tsubj|
puts "inside thread pre pass\n"
# puts "inside thread pre pass\n"
Thread.pass
puts "inside thread post pass\n"
# puts "inside thread post pass\n"
if UUEncode.is_uuencoded(tbody)
print " UUDecoding...\n"
if tfile
@ -478,7 +478,7 @@ def get_multi(subj, group)
output_data(tsubj, tmode, tfilename, tbody)
end # thread end
puts "ouside thread\n"
# puts "ouside thread\n"
return true
else
@ -488,7 +488,7 @@ def get_multi(subj, group)
end
def fill_preselector(group)
if @config[group].has_key?("-I")
if @config[group].has_key?("-I") and !(@config[group].has_key?("-MRR") and @config[group]["-MRR"])
@articles.set_preselect_pattern(Regexp.new(@config[group]["-I"]))
end
end
@ -652,12 +652,12 @@ def main
end
for i in @articles.get_group_subjects.sort{|a, b| ward_sort(a, b)}
print "#{i}\n" if Debuglevel > 2
# explicitly mark as read
if @config[group].has_key?("-MR") and i =~ /#{@config[group]["-MR"]}/
print "Marking '#{i}' as read\n"
@articles.group_update_newsrc(i)
next
end
if !(@config[group].has_key?("-X") and i =~ /#{@config[group]["-X"]}/) and
# get the juicy bits
elsif !(@config[group].has_key?("-X") and i =~ /#{@config[group]["-X"]}/) and
i =~ /#{@config[group]["-I"]}/
print "Match: #{i}\n" if Debuglevel > 0
if @articles.group_is_complete(i)
@ -667,21 +667,24 @@ def main
elsif @articles.group_is_multipart(i)
get_multi(i, group)
end
#rescue Article::TempError, Article::PermError
rescue TempError, PermError
print "#{$!}\n"
print " Skipping article...\n"
#print "Caught #{$!.class}\n"
#print "Error: #{$!}\n"
next
end
else
print "Not complete: #{i}\n"
end
# if Mark Remaining Read is set do so
elsif @config[group].has_key?("-MRR") and @config[group]["-MRR"] and
!(@config[group].has_key?("-X") and i =~ /#{@config[group]["-X"]}/)
print "Marking remaining '#{i}' as read\n"
@articles.group_update_newsrc(i)
end
end
# hier wachten op evt. threads...
# wait for threads if there are any
if ! @decode_threads.empty?
@articles.disconnect
puts "Waiting for decode threads..."