yEnc support added by Stijn Hoop. Thanks!

This commit is contained in:
Ward Wouts 2002-05-06 21:18:45 +00:00
parent e926490e30
commit 1db82593d1
2 changed files with 271 additions and 12 deletions

View file

@ -190,11 +190,14 @@ def get_single(subj)
body = @articles.get_group_body(subj)
if @articles.is_uuencoded(body)
mode, filename, body = @articles.uudecode(body)
else
print "Not UUencoded!\n"
return false
return mode, filename, body
end
return mode, filename, body
if @articles.is_yencoded(body)
mode, filename, body = @articles.ydecode(body)
return mode, filename, body
end
print "unknown encoding (not UU, not yEnc), skipping...\n"
return false
end
def get_multi(subj, group)
@ -203,10 +206,14 @@ def get_multi(subj, group)
body = @articles.get_group_body(subj)
if @articles.is_uuencoded(body)
mode, filename, body = @articles.uudecode(body)
else
print "Multipart article not UUencoded!\n"
return false
return mode, filename, body
end
if @articles.is_yencoded(body)
mode, filename, body = @articles.ydecode(body)
return mode, filename, body
end
print "unknown encoding (not UU, not yEnc), skipping...\n"
return false
else
body = @articles.get_group_body_first(subj)
next if body == false
@ -219,12 +226,22 @@ def get_multi(subj, group)
body = fileout.path
file.close
fileout.close
else
print "Multipart article not UUencoded!\n"
return false
return mode, filename, body
end
if @articles.is_yencoded(body)
file = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
body.collect{|x| file.print "#{x}\n"}
next unless @articles.get_group_body_rest(subj, file)
fileout = Tempfile.new("riptmp", @config[group]["TEMPDIR"])
mode, filename, body = @articles.ydecode(file, fileout)
body = fileout.path
file.close
fileout.close
return mode, filename, body
end
print "unknown encoding (not UU, not yEnc), skipping...\n"
return false
end
return mode, filename, body
end
def output_data(subject, mode, filename="", body="")
@ -253,7 +270,7 @@ end
#############################################################################################
defaults = {'-c' => '.ripnewsrc'}
defaults = {'-c' => "#{ENV['HOME']}/.ripnewsrc"}
defaults = parse_options(defaults)
parse_config(defaults)
check_config