some bugs fixed

get_filename method added
This commit is contained in:
Ward Wouts 2003-04-20 16:34:11 +00:00
parent 1588b7e917
commit 11363a35a2

View file

@ -1,6 +1,6 @@
#################################
#
# $Dwarf: article.rb,v 1.59 2002/11/05 10:29:51 ward Exp $
# $Dwarf: uuencode.rb,v 1.1 2003/04/18 22:53:25 ward Exp $
# $Source$
#
# article.rb
@ -11,7 +11,8 @@
require 'tempfile'
class yEnc
class UUEncode
class << self
Debuglevel = 0
@ -153,35 +154,21 @@ def _uudecode_array(data)
return false
end
#def uudecode_group(subj, file=nil, outfile=nil)
def uudecode_group(subj, tempdir=nil)
group_subjects unless @grouped
body = get_group_body_first(subj)
if body.to_s =~ /begin/
print "uuencoded!\n" if Debuglevel > 0
if (tempdir != nil)
file = Tempfile.new("#{tempdir}/riptmp")
body.collect{|i| file.print "#{i}\n"}
get_group_body_rest(subj, file)
mode, filename, result = uudecode(file, outfile)
else
body.concat(get_group_body_rest(subj))
mode, filename, result = uudecode(body)
end
return mode, filename, result
else
print "Not uuencoded!\n" if Debuglevel > 0
return false
end
end
def is_uuencoded(data)
if data.to_s =~ /begin\s+\d+?\s+.*?\S?\s*\Z/
if data.to_s =~ /begin\s+\d+?\s+.*?\S?\s*$/m
return true
else
return false
end
end
def get_filename(data)
if data.to_s =~ /^begin(\s+(\d+))?(\s+(.*?\S))?\s*$/m
filename = $4
return filename
end
return false
end
end # class
end