Sha256: 312a7cf9af46a11d13f291c6dcc623e6faf9e7a013d0d9481e1ef8692b358bbc
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Redwood class ComposeMode < EditMessageMode def initialize opts={} header = {} header["From"] = (opts[:from] || AccountManager.default_account).full_address header["To"] = opts[:to].map { |p| p.full_address }.join(", ") if opts[:to] header["To"] = opts[:to].map { |p| p.full_address }.join(", ") if opts[:to] header["Cc"] = opts[:cc].map { |p| p.full_address }.join(", ") if opts[:cc] header["Bcc"] = opts[:bcc].map { |p| p.full_address }.join(", ") if opts[:bcc] header["Subject"] = opts[:subj] if opts[:subj] super :header => header, :body => (opts[:body] || []) end def edit_message edited = super BufferManager.kill_buffer self.buffer unless edited edited end def self.spawn_nicely opts={} to = opts[:to] || BufferManager.ask_for_contacts(:people, "To: ") or return cc = opts[:cc] || BufferManager.ask_for_contacts(:people, "Cc: ") or return if $config[:ask_for_cc] bcc = opts[:bcc] || BufferManager.ask_for_contacts(:people, "Bcc: ") or return if $config[:ask_for_bcc] subj = opts[:subj] || BufferManager.ask(:subject, "Subject: ") or return if $config[:ask_for_subject] mode = ComposeMode.new :from => opts[:from], :to => to, :cc => cc, :bcc => bcc, :subj => subj BufferManager.spawn "New Message", mode mode.edit_message end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sup-0.3 | lib/sup/modes/compose-mode.rb |