thread: The message thread to be formatted.
EOS
+ HookManager.register "mark-as-spam", <<EOS
+This hook is run when a thread is marked as spam
+Variables:
+ thread: The message thread being marked as spam.
+EOS
+
register_keymap do |k|
k.add :load_threads, "Load #{LOAD_MORE_THREAD_NUM} more threads", 'M'
k.add_multi "Load all threads (! to confirm) :", '!' do |kk|
k.add :toggle_tagged, "Tag/untag selected thread", 't'
k.add :toggle_tagged_all, "Tag/untag all threads", 'T'
k.add :tag_matching, "Tag matching threads", 'g'
- k.add :apply_to_tagged, "Apply next command to all tagged threads", ';'
+ k.add :apply_to_tagged, "Apply next command to all tagged threads", '+'
k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
end
end
end
+ def unsaved?; dirty? end
def lines; @text.length; end
def [] i; @text[i]; end
def contains_thread? t; @threads.include?(t) end
def toggle_spam
t = cursor_thread or return
multi_toggle_spam [t]
+ HookManager.run("mark-as-spam", :thread => t)
end
## both spam and deleted have the curious characteristic that you
end
def save
+ BufferManager.say("Saving contacts...") { ContactManager.instance.save }
dirty_threads = @mutex.synchronize { (@threads + @hidden_threads.keys).select { |t| t.dirty? } }
return if dirty_threads.empty?
end
def tag_matching
- query = BufferManager.ask :search, "tag threads matching: "
+ query = BufferManager.ask :search, "tag threads matching (regex): "
return if query.nil? || query.empty?
- query = /#{query}/i
+ query = begin
+ /#{query}/i
+ rescue RegexpError => e
+ BufferManager.flash "error interpreting '#{query}': #{e.message}"
+ return
+ end
@mutex.synchronize { @threads.each { |t| @tags.tag t if thread_matches?(t, query) } }
regen_text
end
end
def multi_edit_labels threads
- answer = BufferManager.ask :add_labels, "add labels: "
- return unless answer
- user_labels = answer.split(/\s+/).map { |l| l.intern }
+ user_labels = BufferManager.ask_for_labels :add_labels, "Add labels: ", [], @hidden_labels
+ return unless user_labels
hl = user_labels.select { |l| @hidden_labels.member? l }
if hl.empty?
def add_or_unhide m
@ts_mutex.synchronize do
if (is_relevant?(m) || @ts.is_relevant?(m)) && !@ts.contains?(m)
- @ts.load_thread_for_message m
+ @ts.load_thread_for_message m, @load_thread_opts
end
@hidden_threads.delete @ts.thread_for(m)
from +
[
[subj_color, size_widget_text],
- [:to_me_color, dp ? " >" : (p ? ' +' : " ")],
+ [:to_me_color, t.labels.member?(:attachment) ? "@" : " "],
+ [:to_me_color, dp ? ">" : (p ? '+' : " ")],
[subj_color, t.subj + (t.subj.empty? ? "" : " ")],
] +
(t.labels - @hidden_labels).map { |label| [:label_color, "+#{label} "] } +
[[:snippet_color, snippet]
]
-
end
def dirty?; @mutex.synchronize { (@hidden_threads.keys + @threads).any? { |t| t.dirty? } } end