]> git.cworth.org Git - sup/blobdiff - lib/sup/modes/thread-view-mode.rb
reply all keybindings
[sup] / lib / sup / modes / thread-view-mode.rb
index 737f6f1ff309a5bd87ebdeb1d213c77c88b86bc2..27167cbdd9750158f0a76dda51b4c11740a99c9a 100644 (file)
@@ -53,6 +53,7 @@ EOS
     k.add :toggle_new, "Toggle unread/read status of message", 'N'
 #    k.add :collapse_non_new_messages, "Collapse all but unread messages", 'N'
     k.add :reply, "Reply to a message", 'r'
+    k.add :reply_all, "Reply to all participants of this message", 'G'
     k.add :forward, "Forward a message or attachment", 'f'
     k.add :bounce, "Bounce message to other recipient(s)", '!'
     k.add :alias, "Edit alias/nickname for a person", 'i'
@@ -161,12 +162,14 @@ EOS
     update
   end
 
-  def reply
+  def reply type_arg=nil
     m = @message_lines[curpos] or return
-    mode = ReplyMode.new m
+    mode = ReplyMode.new m, type_arg
     BufferManager.spawn "Reply to #{m.subj}", mode
   end
 
+  def reply_all; reply :all; end
+
   def subscribe_to_list
     m = @message_lines[curpos] or return
     if m.list_subscribe && m.list_subscribe =~ /<mailto:(.*?)\?(subject=(.*?))>/
@@ -212,14 +215,14 @@ EOS
     bt = to.size > 1 ? "#{to.size} recipients" : to.to_s
 
     if BufferManager.ask_yes_or_no "Really bounce to #{bt}?"
-      Redwood::log "Bounce Command: #{cmd}"
+      debug "bounce command: #{cmd}"
       begin
         IO.popen(cmd, 'w') do |sm|
           sm.puts m.raw_message
         end
         raise SendmailCommandFailed, "Couldn't execute #{cmd}" unless $? == 0
       rescue SystemCallError, SendmailCommandFailed => e
-        Redwood::log "Problem sending mail: #{e.message}"
+        warn "problem sending mail: #{e.message}"
         BufferManager.flash "Problem sending mail: #{e.message}"
       end
     end
@@ -253,7 +256,7 @@ EOS
     new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels
 
     return unless new_labels
-    @thread.labels = (reserved_labels + new_labels).uniq
+    @thread.labels = Set.new(reserved_labels) + new_labels
     new_labels.each { |l| LabelManager << l }
     update
     UpdateManager.relay self, :labeled, @thread.first