6 ## labels that have special semantics. user will be unable to
7 ## add/remove these via normal label mechanisms.
8 RESERVED_LABELS = [ :starred, :spam, :draft, :unread, :killed, :sent, :deleted, :inbox, :attachment ]
10 ## labels which it nonetheless makes sense to search for by
11 LISTABLE_RESERVED_LABELS = [ :starred, :spam, :draft, :sent, :killed, :deleted, :inbox, :attachment ]
13 ## labels that will typically be hidden from the user
14 HIDDEN_RESERVED_LABELS = [ :starred, :unread, :attachment ]
20 IO.readlines(fn).map { |x| x.chomp.intern }
26 labels.each { |t| @labels[t] = true }
28 self.class.i_am_the_instance self
31 ## all listable (just user-defined at the moment) labels, ordered
32 ## nicely and converted to pretty strings. use #label_for to recover
33 ## the original label.
35 ## uniq's only necessary here because of certain upgrade issues
36 (LISTABLE_RESERVED_LABELS + @labels.keys).uniq
39 ## all apply-able (user-defined and system listable) labels, ordered
40 ## nicely and converted to pretty strings. use #label_for to recover
41 ## the original label.
46 ## reverse the label->string mapping, for convenience!
48 if RESERVED_LABELS.include? l
57 l2 = s.downcase.intern
58 if RESERVED_LABELS.include? l2
66 t = t.intern unless t.is_a? Symbol
67 unless @labels.member?(t) || RESERVED_LABELS.member?(t)
80 return unless @modified
81 File.open(@fn, "w") { |f| f.puts @labels.keys.sort_by { |l| l.to_s } }