maybe: filters
maybe: rangefilter on the initial inbox to only consider the most recent 1000 messages
select all, starred, to me, etc
-editing of arbitrary messages
annotations on messages
gmail
pop
move sup-import argument handling to getopt
be able to mark individual messages as spam in thread-view-mode
+toggle wrapping
+x resuming of arbitrary messages
x alias authors in thread-view-mode
x fix up contact list mode: should display while loading, and when you add an alias, should move everything else to the right
x fix bug: envelope-to thing still not working
class ComposeMode < EditMessageMode
attr_reader :body, :header
- def initialize h={}
+ def initialize opts={}
super()
@header = {
"From" => AccountManager.default_account.full_address,
"Message-Id" => gen_message_id,
}
- @header["To"] = [h[:to]].flatten.compact.map { |p| p.full_address }
- @body = sig_lines
+ @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]
+
+ @body = opts[:body] || sig_lines
regen_text
end
k.add :reply, "Reply to a message", 'r'
k.add :forward, "Forward a message", 'f'
k.add :alias, "Edit alias/nickname for a person", 'a'
+ k.add :edit_as_new, "Edit message as new", 'd'
k.add :save_to_disk, "Save message/attachment to disk", 's'
end
def [] i; @text[i]; end
def show_header
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
BufferManager.spawn_unless_exists("Full header") do
TextMode.new m.raw_header
end
end
def toggle_detailed_header
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
@layout[m].state = (@layout[m].state == :detailed ? :open : :detailed)
update
end
def reply
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
mode = ReplyMode.new m
BufferManager.spawn "Reply to #{m.subj}", mode
end
def forward
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
mode = ForwardMode.new m
BufferManager.spawn "Forward of #{m.subj}", mode
mode.edit
end
def toggle_starred
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
if m.has_label? :starred
m.remove_label :starred
else
end
def toggle_expanded
- return unless(chunk = @chunk_lines[curpos])
+ chunk = @chunk_lines[curpos] or return
case chunk
when Message, Message::Quote, Message::Signature
l = @layout[chunk]
update
end
+ def edit_as_new
+ m = @message_lines[curpos] or return
+ mode = ComposeMode.new(:body => m.basic_body_lines, :to => m.to, :cc => m.cc, :subj => m.subj, :bcc => m.bcc)
+ BufferManager.spawn "edit as new", mode
+ mode.edit
+ end
+
def save_to_disk
- return unless(chunk = @chunk_lines[curpos])
+ chunk = @chunk_lines[curpos] or return
case chunk
when Message::Attachment
fn = BufferManager.ask :filename, "Save attachment to file: ", chunk.filename
end
def edit_message
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
if m.is_draft?
mode = ResumeMode.new m
BufferManager.spawn "Edit message", mode
end
def jump_to_next_open
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
while nextm = @layout[m].next
break if @layout[nextm].state == :open
m = nextm
end
def jump_to_prev_open
- return unless(m = @message_lines[curpos])
+ m = @message_lines[curpos] or return
## jump to the top of the current message if we're in the body;
## otherwise, to the previous message