split off ydecoding stuff
This commit is contained in:
parent
cf34fe16c8
commit
7a09a4634e
2 changed files with 20 additions and 318 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.45 2003/04/19 12:42:12 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.46 2003/04/20 16:34:40 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require 'date'
|
||||
|
|
@ -228,10 +228,13 @@ def get_single(subj, group)
|
|||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "s")
|
||||
print " UUDecoding...\n"
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(body)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
filename = YEnc.get_filename(body)
|
||||
return false unless check_ext(group, filename, "s")
|
||||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(body)
|
||||
else
|
||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
|
|
@ -246,10 +249,13 @@ def get_multi(subj, group)
|
|||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
print " UUDecoding...\n"
|
||||
mode, filename, body = UUEncode.uudecode(body)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(body)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
filename = YEnc.get_filename(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(body)
|
||||
else
|
||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
|
|
@ -257,23 +263,25 @@ def get_multi(subj, group)
|
|||
return mode, filename, body
|
||||
else
|
||||
body = @articles.get_group_body_first(subj)
|
||||
if UUEncode.is_uuencoded(body) or @articles.is_yencoded(body)
|
||||
if UUEncode.is_uuencoded(body) or YEnc.is_yencoded(body)
|
||||
if UUEncode.is_uuencoded(body)
|
||||
filename = UUEncode.get_filename(body)
|
||||
return false unless check_ext(group, filename, "m")
|
||||
elsif YEnc.is_yencoded(body)
|
||||
filename = YEnc.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 UUEncode.is_uuencoded(body)
|
||||
print " UUDecoding...\n"
|
||||
mode, filename, body = UUEncode.uudecode(file, fileout)
|
||||
elsif @articles.is_yencoded(body)
|
||||
mode, filename, body = @articles.ydecode(file, fileout)
|
||||
elsif YEnc.is_yencoded(body)
|
||||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(file, fileout)
|
||||
end
|
||||
# in plaats van hier
|
||||
return false unless check_ext(group, filename, "m")
|
||||
body = fileout.path
|
||||
bodybase = body.sub(/\/[^\/]*$/, "")
|
||||
File.rename(body, "#{bodybase}/ripnewsdecode")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue