add require for yenc

some tabbing inserted
This commit is contained in:
Ward Wouts 2003-04-20 20:41:10 +00:00
parent 0b1249b372
commit d7c079a7bb

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/ruby -w #!/usr/local/bin/ruby -w
# $Dwarf: ripnews.rb,v 1.46 2003/04/20 16:34:40 ward Exp $ # $Dwarf: ripnews.rb,v 1.47 2003/04/20 18:39:13 ward Exp $
# $Source$ # $Source$
require 'date' require 'date'
@ -9,6 +9,7 @@ require 'news/article'
require 'news/newsrc' require 'news/newsrc'
require 'tempfile' require 'tempfile'
require 'encode/uuencode' require 'encode/uuencode'
require 'encode/yenc'
########################################################################### ###########################################################################
@ -227,6 +228,7 @@ def get_single(subj, group)
body = @articles.get_group_body(subj) body = @articles.get_group_body(subj)
if UUEncode.is_uuencoded(body) if UUEncode.is_uuencoded(body)
filename = UUEncode.get_filename(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")
print " UUDecoding...\n" print " UUDecoding...\n"
mode, filename, body = UUEncode.uudecode(body) mode, filename, body = UUEncode.uudecode(body)
@ -248,11 +250,14 @@ def get_multi(subj, group)
body = @articles.get_group_body(subj) body = @articles.get_group_body(subj)
if UUEncode.is_uuencoded(body) if UUEncode.is_uuencoded(body)
filename = UUEncode.get_filename(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")
print " UUDecoding...\n" print " UUDecoding...\n"
mode, filename, body = UUEncode.uudecode(body) mode, filename, body = UUEncode.uudecode(body)
elsif YEnc.is_yencoded(body) elsif YEnc.is_yencoded(body)
print "yencc\n"
filename = YEnc.get_filename(body) 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")
print " YDecoding...\n" print " YDecoding...\n"
mode, filename, body = YEnc.ydecode(body) mode, filename, body = YEnc.ydecode(body)
@ -266,9 +271,12 @@ def get_multi(subj, group)
if UUEncode.is_uuencoded(body) or YEnc.is_yencoded(body) if UUEncode.is_uuencoded(body) or YEnc.is_yencoded(body)
if UUEncode.is_uuencoded(body) if UUEncode.is_uuencoded(body)
filename = UUEncode.get_filename(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")
elsif YEnc.is_yencoded(body) elsif YEnc.is_yencoded(body)
print "yencc\n"
filename = YEnc.get_filename(body) 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")
end end
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"]) file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
@ -405,13 +413,13 @@ for group in @config.keys.sort
mode, filename, body = get_multi(i, group) mode, filename, body = get_multi(i, group)
end end
if mode == false if mode == false
print "Skipping article...\n" print " Skipping article...\n"
else else
output_data(i, mode, filename, body) output_data(i, mode, filename, body)
end end
rescue Article::TempError, Article::PermError rescue Article::TempError, Article::PermError
print "#{$!}\n" print "#{$!}\n"
print "Skipping article...\n" print " Skipping article...\n"
next next
end end
else else