sup 0.12.1 → 0.13.0
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.tar.gz.sig +1 -0
- data/CONTRIBUTORS +25 -12
- data/History.txt +6 -1
- data/README.md +70 -0
- data/ReleaseNotes +5 -0
- data/bin/sup +22 -15
- data/bin/sup-add +3 -3
- data/bin/sup-config +3 -4
- data/bin/sup-import-dump +1 -1
- data/bin/sup-sync +1 -1
- data/bin/sup-sync-back +2 -2
- data/bin/sup-tweak-labels +1 -1
- data/lib/sup.rb +39 -23
- data/lib/sup/account.rb +4 -0
- data/lib/sup/buffer.rb +4 -7
- data/lib/sup/colormap.rb +10 -2
- data/lib/sup/contact.rb +11 -5
- data/lib/sup/crypto.rb +278 -101
- data/lib/sup/draft.rb +3 -2
- data/lib/sup/horizontal-selector.rb +5 -2
- data/lib/sup/index.rb +47 -42
- data/lib/sup/label.rb +1 -1
- data/lib/sup/message-chunks.rb +4 -2
- data/lib/sup/message.rb +14 -3
- data/lib/sup/modes/buffer-list-mode.rb +1 -1
- data/lib/sup/modes/compose-mode.rb +1 -1
- data/lib/sup/modes/contact-list-mode.rb +2 -2
- data/lib/sup/modes/edit-message-async-mode.rb +109 -0
- data/lib/sup/modes/edit-message-mode.rb +148 -16
- data/lib/sup/modes/file-browser-mode.rb +2 -2
- data/lib/sup/modes/forward-mode.rb +4 -4
- data/lib/sup/modes/line-cursor-mode.rb +2 -2
- data/lib/sup/modes/reply-mode.rb +34 -30
- data/lib/sup/modes/resume-mode.rb +4 -1
- data/lib/sup/modes/scroll-mode.rb +8 -6
- data/lib/sup/modes/text-mode.rb +1 -1
- data/lib/sup/modes/thread-index-mode.rb +44 -25
- data/lib/sup/modes/thread-view-mode.rb +26 -24
- data/lib/sup/person.rb +18 -7
- data/lib/sup/poll.rb +1 -1
- data/lib/sup/rfc2047.rb +1 -1
- data/lib/sup/sent.rb +2 -2
- data/lib/sup/source.rb +1 -1
- data/lib/sup/textfield.rb +38 -1
- data/lib/sup/thread.rb +1 -1
- data/lib/sup/time.rb +83 -0
- data/lib/sup/util.rb +38 -74
- data/lib/sup/version.rb +3 -0
- metadata +333 -168
- metadata.gz.sig +0 -0
- data/README.txt +0 -128
- data/bin/sup-cmd +0 -138
- data/bin/sup-server +0 -44
- data/lib/sup/client.rb +0 -92
- data/lib/sup/protocol.rb +0 -161
- data/lib/sup/server.rb +0 -116
data/lib/sup/server.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
require 'sup/protocol'
|
2
|
-
|
3
|
-
module Redwood
|
4
|
-
|
5
|
-
class Server < EM::P::RedwoodServer
|
6
|
-
def initialize index
|
7
|
-
super
|
8
|
-
@index = index
|
9
|
-
end
|
10
|
-
|
11
|
-
def receive_message type, tag, params
|
12
|
-
if respond_to? :"request_#{type}"
|
13
|
-
send :"request_#{type}", tag, params
|
14
|
-
else
|
15
|
-
send_message 'error', tag, 'description' => "invalid request type #{type.inspect}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def request_query tag, a
|
20
|
-
q = @index.parse_query a['query']
|
21
|
-
query q, a['offset'], a['limit'], a['raw'] do |r|
|
22
|
-
send_message 'message', tag, r
|
23
|
-
end
|
24
|
-
send_message 'done', tag
|
25
|
-
end
|
26
|
-
|
27
|
-
def request_count tag, a
|
28
|
-
q = @index.parse_query a['query']
|
29
|
-
c = count q
|
30
|
-
send_message 'count', tag, 'count' => c
|
31
|
-
end
|
32
|
-
|
33
|
-
def request_label tag, a
|
34
|
-
q = @index.parse_query a['query']
|
35
|
-
label q, a['add'], a['remove']
|
36
|
-
send_message 'done', tag
|
37
|
-
end
|
38
|
-
|
39
|
-
def request_add tag, a
|
40
|
-
add a['raw'], a['labels']
|
41
|
-
send_message 'done', tag
|
42
|
-
end
|
43
|
-
|
44
|
-
def request_thread tag, a
|
45
|
-
thread a['message_id'], a['raw'] do |r|
|
46
|
-
send_message 'message', tag, r
|
47
|
-
end
|
48
|
-
send_message 'done', tag
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def result_from_message m, raw
|
54
|
-
mkperson = lambda { |p| { :email => p.email, :name => p.name } }
|
55
|
-
{
|
56
|
-
'summary' => {
|
57
|
-
'message_id' => m.id,
|
58
|
-
'date' => m.date,
|
59
|
-
'from' => mkperson[m.from],
|
60
|
-
'to' => m.to.map(&mkperson),
|
61
|
-
'cc' => m.cc.map(&mkperson),
|
62
|
-
'bcc' => m.bcc.map(&mkperson),
|
63
|
-
'subject' => m.subj,
|
64
|
-
'refs' => m.refs,
|
65
|
-
'replytos' => m.replytos,
|
66
|
-
'labels' => m.labels.map(&:to_s),
|
67
|
-
},
|
68
|
-
'raw' => raw ? m.raw_message : nil,
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
def query query, offset, limit, raw
|
73
|
-
c = 0
|
74
|
-
@index.each_message query do |m|
|
75
|
-
next if c < offset
|
76
|
-
break if c >= offset + limit if limit
|
77
|
-
yield result_from_message(m, raw)
|
78
|
-
c += 1
|
79
|
-
end
|
80
|
-
nil
|
81
|
-
end
|
82
|
-
|
83
|
-
def count query
|
84
|
-
@index.num_results_for query
|
85
|
-
end
|
86
|
-
|
87
|
-
def label query, remove_labels, add_labels
|
88
|
-
@index.each_message query do |m|
|
89
|
-
remove_labels.each { |l| m.remove_label l }
|
90
|
-
add_labels.each { |l| m.add_label l }
|
91
|
-
@index.update_message_state m
|
92
|
-
end
|
93
|
-
nil
|
94
|
-
end
|
95
|
-
|
96
|
-
def add raw, labels
|
97
|
-
SentManager.source.store_message Time.now, "test@example.com" do |io|
|
98
|
-
io.write raw
|
99
|
-
end
|
100
|
-
PollManager.poll_from SentManager.source do |sym,m,old_m,progress|
|
101
|
-
next unless sym == :add
|
102
|
-
m.labels = labels
|
103
|
-
end
|
104
|
-
nil
|
105
|
-
end
|
106
|
-
|
107
|
-
def thread msg_id, raw
|
108
|
-
msg = @index.build_message msg_id
|
109
|
-
@index.each_message_in_thread_for msg do |id, builder|
|
110
|
-
m = builder.call
|
111
|
-
yield result_from_message(m, raw)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|