attachment temp files (used for Attachment#view!) now use (a
monkey-patched) Tempfile, so they should be deleted upon program exit or
gc or however it works.
## Here we define all the "chunks" that a message is parsed
## into. Chunks are used by ThreadViewMode to render a message. Chunks
## Here we define all the "chunks" that a message is parsed
## into. Chunks are used by ThreadViewMode to render a message. Chunks
## included as quoted text during a reply. Text, Quotes, and mime-parsed
## attachments are quotable; Signatures are not.
## included as quoted text during a reply. Text, Quotes, and mime-parsed
## attachments are quotable; Signatures are not.
+## monkey-patch time: make temp files have the right extension
+class Tempfile
+ def make_tmpname basename, n
+ sprintf '%d-%d-%s', $$, n, basename
+ end
+end
+
+
module Redwood
module Chunk
class Attachment
module Redwood
module Chunk
class Attachment
- file =
- if @filename
- File.open File.join(Dir::tmpdir, @filename), "w"
- else
- Tempfile.new "redwood.attachment"
- end
-
+ file = Tempfile.new(@filename || "sup-attachment")
file.print @raw_content
file.close
file.path
file.print @raw_content
file.close
file.path
require 'time'
require 'iconv'
require 'time'
require 'iconv'