sup 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sup might be problematic. Click here for more details.
- data/History.txt +5 -0
- data/Rakefile +1 -3
- data/bin/sup +8 -5
- data/bin/sup-import +10 -6
- data/doc/TODO +6 -2
- data/doc/UserGuide.txt +188 -30
- data/lib/sup.rb +2 -2
- data/lib/sup/buffer.rb +12 -5
- data/lib/sup/imap.rb +120 -83
- data/lib/sup/index.rb +2 -1
- data/lib/sup/mbox/loader.rb +1 -1
- data/lib/sup/mbox/ssh-file.rb +37 -21
- data/lib/sup/message.rb +14 -10
- data/lib/sup/modes/contact-list-mode.rb +6 -8
- data/lib/sup/modes/inbox-mode.rb +1 -9
- data/lib/sup/modes/label-list-mode.rb +1 -1
- data/lib/sup/modes/label-search-results-mode.rb +1 -5
- data/lib/sup/modes/line-cursor-mode.rb +2 -1
- data/lib/sup/modes/person-search-results-mode.rb +1 -5
- data/lib/sup/modes/reply-mode.rb +7 -2
- data/lib/sup/modes/scroll-mode.rb +5 -3
- data/lib/sup/modes/search-results-mode.rb +1 -5
- data/lib/sup/modes/thread-index-mode.rb +29 -13
- data/lib/sup/modes/thread-view-mode.rb +40 -25
- data/lib/sup/person.rb +1 -1
- data/lib/sup/poll.rb +52 -44
- data/lib/sup/thread.rb +7 -2
- data/lib/sup/util.rb +5 -5
- metadata +2 -2
data/lib/sup/person.rb
CHANGED
@@ -10,7 +10,7 @@ class PersonManager
|
|
10
10
|
self.class.i_am_the_instance self
|
11
11
|
end
|
12
12
|
|
13
|
-
def name_for email; @names.member?(email)
|
13
|
+
def name_for email; @names.member?(email) ? @names[email][1] : nil; end
|
14
14
|
def register email, name
|
15
15
|
return unless name
|
16
16
|
|
data/lib/sup/poll.rb
CHANGED
@@ -8,16 +8,14 @@ class PollManager
|
|
8
8
|
DELAY = 300
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@
|
11
|
+
@mutex = Mutex.new
|
12
12
|
@last_poll = nil
|
13
13
|
|
14
14
|
self.class.i_am_the_instance self
|
15
15
|
end
|
16
16
|
|
17
17
|
def buffer
|
18
|
-
BufferManager.spawn_unless_exists("<poll for new messages>", :hidden => true)
|
19
|
-
PollMode.new
|
20
|
-
end
|
18
|
+
BufferManager.spawn_unless_exists("<poll for new messages>", :hidden => true) { PollMode.new }
|
21
19
|
end
|
22
20
|
|
23
21
|
def poll
|
@@ -40,55 +38,65 @@ class PollManager
|
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
41
|
+
## TODO: merge this with sup-import
|
43
42
|
def do_poll
|
44
|
-
|
45
|
-
@
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
total_num = total_numi = 0
|
44
|
+
@mutex.synchronize do
|
45
|
+
found = {}
|
46
|
+
Index.usual_sources.each do |source|
|
47
|
+
next if source.broken? || source.done?
|
48
|
+
|
49
|
+
yield "Loading from #{source}... "
|
50
|
+
start_offset = nil
|
51
|
+
num = 0
|
52
|
+
num_inbox = 0
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
54
|
+
source.each do |offset, labels|
|
55
|
+
break if source.broken?
|
56
|
+
start_offset ||= offset
|
57
|
+
yield "Found message at #{offset} with labels #{labels * ', '}"
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
else
|
59
|
+
begin
|
60
|
+
begin
|
61
|
+
m = Redwood::Message.new :source => source, :source_info => offset, :labels => labels
|
62
|
+
rescue MessageFormatError => e
|
63
|
+
yield "Non-fatal error loading message #{source}##{offset}: #{e.message}"
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
if found[m.id]
|
68
|
+
yield "Skipping duplicate message #{m.id}"
|
69
|
+
next
|
70
|
+
end
|
67
71
|
found[m.id] = true
|
68
|
-
end
|
69
72
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
if Index.add_message m
|
74
|
+
UpdateManager.relay :add, m
|
75
|
+
num += 1
|
76
|
+
total_num += 1
|
77
|
+
total_numi += 1 if m.labels.include? :inbox
|
78
|
+
end
|
79
|
+
|
80
|
+
if num % 1000 == 0 && num > 0
|
81
|
+
elapsed = Time.now - start
|
82
|
+
pctdone = source.pct_done
|
83
|
+
remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone)
|
84
|
+
yield "## #{num} (#{pctdone}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining"
|
85
|
+
end
|
86
|
+
rescue SourceError => e
|
87
|
+
msg = "Fatal error loading from #{source}: #{e.message}"
|
88
|
+
Redwood::log msg
|
89
|
+
yield msg
|
90
|
+
break
|
75
91
|
end
|
76
|
-
rescue SourceError, MessageFormatError => e
|
77
|
-
yield "Ignoring erroneous message at #{source}##{offset}: #{e.message}"
|
78
|
-
end
|
79
|
-
|
80
|
-
if num % 1000 == 0 && num > 0
|
81
|
-
elapsed = Time.now - start
|
82
|
-
pctdone = (offset.to_f - start_offset) / (source.total.to_f - start_offset)
|
83
|
-
remaining = (source.end_offset.to_f - offset.to_f) * (elapsed.to_f / (offset.to_f - start_offset))
|
84
|
-
yield "## #{num} (#{(pctdone * 100.0)}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining"
|
85
92
|
end
|
93
|
+
yield "Found #{num} messages" unless num == 0
|
86
94
|
end
|
87
|
-
|
95
|
+
|
96
|
+
yield "Done polling; loaded #{total_num} new messages total"
|
97
|
+
@last_poll = Time.now
|
98
|
+
@polling = false
|
88
99
|
end
|
89
|
-
yield "Done polling; loaded #{total_num} new messages total"
|
90
|
-
@last_poll = Time.now
|
91
|
-
@polling = false
|
92
100
|
[total_num, total_numi]
|
93
101
|
end
|
94
102
|
end
|
data/lib/sup/thread.rb
CHANGED
@@ -7,7 +7,9 @@ class Thread
|
|
7
7
|
|
8
8
|
attr_reader :containers
|
9
9
|
def initialize
|
10
|
-
|
10
|
+
## ah, the joys of a multithreaded application with a class called
|
11
|
+
## "Thread". i keep instantiating the wrong one...
|
12
|
+
raise "wrong Thread class, buddy!" if block_given?
|
11
13
|
@containers = []
|
12
14
|
end
|
13
15
|
|
@@ -28,7 +30,9 @@ class Thread
|
|
28
30
|
puts "=== end thread ==="
|
29
31
|
end
|
30
32
|
|
31
|
-
## yields each message and
|
33
|
+
## yields each message, its depth, and its parent
|
34
|
+
## note that the message can be a Message object, or :fake_root,
|
35
|
+
## or nil.
|
32
36
|
def each fake_root=false
|
33
37
|
adj = 0
|
34
38
|
root = @containers.find_all { |c| !Message.subj_is_reply?(c) }.argmin { |c| c.date }
|
@@ -78,6 +82,7 @@ class Thread
|
|
78
82
|
def set_labels l; each { |m, *o| m && m.labels = l }; end
|
79
83
|
|
80
84
|
def has_label? t; any? { |m, *o| m && m.has_label?(t) }; end
|
85
|
+
def dirty?; any? { |m, *o| m && m.dirty? }; end
|
81
86
|
def save index; each { |m, *o| m && m.save(index) }; end
|
82
87
|
|
83
88
|
def direct_participants
|
data/lib/sup/util.rb
CHANGED
@@ -224,16 +224,16 @@ class Time
|
|
224
224
|
["minute", 60],
|
225
225
|
["hour", 24],
|
226
226
|
["day", 7],
|
227
|
-
["week", 4], # heh heh
|
227
|
+
["week", 4.345], # heh heh
|
228
228
|
["month", 12],
|
229
229
|
["year", nil],
|
230
230
|
].argfind do |unit, size|
|
231
|
-
if diff <= 1
|
231
|
+
if diff.round <= 1
|
232
232
|
"one #{unit}"
|
233
|
-
elsif size.nil? || diff < size
|
234
|
-
"#{diff} #{unit}s"
|
233
|
+
elsif size.nil? || diff.round < size
|
234
|
+
"#{diff.round} #{unit}s"
|
235
235
|
else
|
236
|
-
diff
|
236
|
+
diff /= size.to_f
|
237
237
|
false
|
238
238
|
end
|
239
239
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sup
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-01-
|
6
|
+
version: 0.0.5
|
7
|
+
date: 2007-01-05 00:00:00 -08:00
|
8
8
|
summary: A console-based email client with the best features of GMail, mutt, and emacs. Features full text search, labels, tagged operations, multiple buffers, recent contacts, and more.
|
9
9
|
require_paths:
|
10
10
|
- lib
|