def initialize opts={}
@header = opts.delete(:header) || {}
@header_lines = []
@body = opts.delete(:body) || []
@body += sig_lines if $config[:edit_signature] && !opts.delete(:have_signature)
if opts[:attachments]
@attachments = opts[:attachments].values
@attachment_names = opts[:attachments].keys
else
@attachments = []
@attachment_names = []
end
begin
hostname = File.open("/etc/mailname", "r").gets.chomp
rescue
nil
end
hostname = Socket.gethostname if hostname.nil? or hostname.empty?
@message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{hostname}>"
@edited = false
@selectors = []
@selector_label_width = 0
@crypto_selector =
if CryptoManager.have_crypto?
HorizontalSelector.new "Crypto:", [:none] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.keys, ["None"] + CryptoManager::OUTGOING_MESSAGE_OPERATIONS.values
end
add_selector @crypto_selector if @crypto_selector
HookManager.run "before-edit", :header => @header, :body => @body
super opts
regen_text
end