split off uudecode stuff
This commit is contained in:
parent
11363a35a2
commit
12dac93ea1
2 changed files with 20 additions and 182 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.44 2003/04/19 11:10:32 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.45 2003/04/19 12:42:12 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require 'date'
|
||||
|
|
@ -8,6 +8,7 @@ require 'getoptlong'
|
|||
require 'news/article'
|
||||
require 'news/newsrc'
|
||||
require 'tempfile'
|
||||
require 'encode/uuencode'
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
|
@ -224,15 +225,17 @@ end
|
|||
def get_single(subj, group)
|
||||
print "Fetching singlepart article: #{subj}\n"
|
||||
body = @articles.get_group_body(subj)
|
||||
if @articles.is_uuencoded(body)
|
||||
mode, filename, body = @articles.uudecode(body)
|
||||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "s")
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(body)
|
||||
return false unless check_ext(group, filename, "s")
|
||||
else
|
||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
end
|
||||
return false unless check_ext(group, filename, "s")
|
||||
return mode, filename, body
|
||||
end
|
||||
|
||||
|
|
@ -240,26 +243,32 @@ def get_multi(subj, group)
|
|||
print "Fetching multipart article: #{subj}\n"
|
||||
if @config[group]["TEMPDIR"] == nil or @config[group]["TEMPDIR"] == ""
|
||||
body = @articles.get_group_body(subj)
|
||||
if @articles.is_uuencoded(body)
|
||||
mode, filename, body = @articles.uudecode(body)
|
||||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
else
|
||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
end
|
||||
return false unless check_ext(group, filename, "m")
|
||||
return mode, filename, body
|
||||
else
|
||||
body = @articles.get_group_body_first(subj)
|
||||
if @articles.is_uuencoded(body) or @articles.is_yencoded(body)
|
||||
if UUEncode.is_uuencoded(body) or @articles.is_yencoded(body)
|
||||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
end
|
||||
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
||||
body.collect{|x| file.print "#{x}\n"}
|
||||
# hier moet een extensie check!!!
|
||||
return false unless @articles.get_group_body_rest(subj, file)
|
||||
fileout = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
|
||||
if @articles.is_uuencoded(body)
|
||||
mode, filename, body = @articles.uudecode(file, fileout)
|
||||
if UUEncode.is_uuencoded(body)
|
||||
mode, filename, body = UUEncode.uudecode(file, fileout)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(file, fileout)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue