From: marcus-sup@bar-coded.net (Marcus Williams)
Subject: [sup-talk] [PATCH] Additional attachment goodness...
Date: Wed, 27 Feb 2008 22:40:57 +0000 [thread overview]
Message-ID: <1204151850-sup-9501@tomsk> (raw)
Adds hidden/reserved attachment label to track attachments. Also adds
new flag on thread index mode to denote an attachment '#'. This
extends the attachments patch sent earlier and is also against latest
'next'. It will require another sup-sync -all to work against all
sources, but attempts to be backwards compatable with non-synced
sources. Adds a "has:attachment" search query.
---
lib/sup/index.rb | 2 +-
lib/sup/label.rb | 6 +++---
lib/sup/message.rb | 1 +
lib/sup/modes/thread-index-mode.rb | 3 ++-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index 4205f2a..bb70328 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -438,7 +438,7 @@ protected
extraopts[:load_deleted] = true if subs =~ /\blabel:deleted\b/
## gmail style "is" operator
- subs = subs.gsub(/\b(is):(\S+)\b/) do
+ subs = subs.gsub(/\b(is|has):(\S+)\b/) do
field, label = $1, $2
case label
when "read"
diff --git a/lib/sup/label.rb b/lib/sup/label.rb
index 4afc0f9..716ef98 100644
--- a/lib/sup/label.rb
+++ b/lib/sup/label.rb
@@ -5,13 +5,13 @@ class LabelManager
## labels that have special semantics. user will be unable to
## add/remove these via normal label mechanisms.
- RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent, :deleted, :inbox ]
+ RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent, :deleted, :inbox, :attachment ]
## labels which it nonetheless makes sense to search for by
- LISTABLE_RESERVED_LABELS = [ :starred, :spam, :draft, :sent, :killed, :deleted, :inbox ]
+ LISTABLE_RESERVED_LABELS = [ :starred, :spam, :draft, :sent, :killed, :deleted, :inbox, :attachment ]
## labels that will typically be hidden from the user
- HIDDEN_RESERVED_LABELS = [ :starred, :unread ]
+ HIDDEN_RESERVED_LABELS = [ :starred, :unread, :attachment ]
def initialize fn
@fn = fn
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 480f52c..2be779c 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -410,6 +410,7 @@ private
# attachment (should we allow images with generated names?).
# Lowercase the filename because searches are easier that way
@attachments.push filename.downcase unless filename =~ /^sup-attachment-/
+ add_label :attachment unless filename =~ /^sup-attachment-/
[Chunk::Attachment.new(m.header.content_type, filename, m, sibling_types)]
## otherwise, it's body text
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index 7a0b815..1b2c0d7 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -713,7 +713,8 @@ protected
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} "] } +
--
1.5.4.1
next reply other threads:[~2008-02-27 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 22:40 Marcus Williams [this message]
2008-02-28 17:02 ` William Morgan
2008-02-28 20:57 ` Marcus Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204151850-sup-9501@tomsk \
--to=marcus-sup@bar-coded.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox