sup 0.14.1.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTORS +14 -11
- data/History.txt +44 -0
- data/README.md +9 -4
- data/ReleaseNotes +8 -0
- data/bin/sup +1 -0
- data/bin/sup-add +2 -1
- data/bin/sup-config +3 -0
- data/bin/sup-sync-back-maildir +127 -0
- data/bin/{sup-sync-back → sup-sync-back-mbox} +3 -3
- data/lib/sup.rb +75 -3
- data/lib/sup/index.rb +54 -16
- data/lib/sup/label.rb +2 -2
- data/lib/sup/maildir.rb +120 -47
- data/lib/sup/mbox.rb +1 -1
- data/lib/sup/message.rb +65 -2
- data/lib/sup/modes/edit_message_mode.rb +16 -8
- data/lib/sup/modes/forward_mode.rb +13 -4
- data/lib/sup/modes/reply_mode.rb +6 -0
- data/lib/sup/modes/search_list_mode.rb +12 -0
- data/lib/sup/modes/thread_index_mode.rb +30 -0
- data/lib/sup/modes/thread_view_mode.rb +15 -5
- data/lib/sup/poll.rb +62 -17
- data/lib/sup/search.rb +18 -0
- data/lib/sup/sent.rb +1 -1
- data/lib/sup/source.rb +32 -4
- data/lib/sup/thread.rb +6 -0
- data/lib/sup/util.rb +12 -2
- data/lib/sup/util/query.rb +5 -2
- data/lib/sup/version.rb +1 -1
- metadata +17 -16
data/lib/sup/sent.rb
CHANGED
@@ -27,7 +27,7 @@ class SentManager
|
|
27
27
|
def write_sent_message date, from_email, &block
|
28
28
|
::Thread.new do
|
29
29
|
debug "store the sent message (locking sent source..)"
|
30
|
-
@source.
|
30
|
+
@source.synchronize do
|
31
31
|
@source.store_message date, from_email, &block
|
32
32
|
end
|
33
33
|
PollManager.poll_from @source
|
data/lib/sup/source.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "sup/rfc2047"
|
2
|
+
require "monitor"
|
2
3
|
|
3
4
|
module Redwood
|
4
5
|
|
@@ -53,8 +54,8 @@ class Source
|
|
53
54
|
## Examples for you to look at: mbox.rb and maildir.rb.
|
54
55
|
|
55
56
|
bool_accessor :usual, :archived
|
56
|
-
attr_reader :uri
|
57
|
-
attr_accessor :id
|
57
|
+
attr_reader :uri, :usual
|
58
|
+
attr_accessor :id
|
58
59
|
|
59
60
|
def initialize uri, usual=true, archived=false, id=nil
|
60
61
|
raise ArgumentError, "id must be an integer: #{id.inspect}" unless id.is_a? Fixnum if id
|
@@ -64,10 +65,10 @@ class Source
|
|
64
65
|
@archived = archived
|
65
66
|
@id = id
|
66
67
|
|
67
|
-
@poll_lock =
|
68
|
+
@poll_lock = Monitor.new
|
68
69
|
end
|
69
70
|
|
70
|
-
## overwrite me if you have a disk incarnation (currently used only for sup-sync-back)
|
71
|
+
## overwrite me if you have a disk incarnation (currently used only for sup-sync-back-mbox)
|
71
72
|
def file_path; nil end
|
72
73
|
|
73
74
|
def to_s; @uri.to_s; end
|
@@ -81,6 +82,14 @@ class Source
|
|
81
82
|
## leaks (esp. file descriptors).
|
82
83
|
def go_idle; end
|
83
84
|
|
85
|
+
## Returns an array containing all the labels that are natively
|
86
|
+
## supported by this source
|
87
|
+
def supported_labels?; [] end
|
88
|
+
|
89
|
+
## Returns an array containing all the labels that are currently in
|
90
|
+
## the location filename
|
91
|
+
def labels? info; [] end
|
92
|
+
|
84
93
|
## Yields values of the form [Symbol, Hash]
|
85
94
|
## add: info, labels, progress
|
86
95
|
## delete: info, progress
|
@@ -92,6 +101,25 @@ class Source
|
|
92
101
|
true
|
93
102
|
end
|
94
103
|
|
104
|
+
def synchronize &block
|
105
|
+
@poll_lock.synchronize &block
|
106
|
+
end
|
107
|
+
|
108
|
+
def try_lock
|
109
|
+
acquired = @poll_lock.try_enter
|
110
|
+
if acquired
|
111
|
+
debug "lock acquired for: #{self}"
|
112
|
+
else
|
113
|
+
debug "could not acquire lock for: #{self}"
|
114
|
+
end
|
115
|
+
acquired
|
116
|
+
end
|
117
|
+
|
118
|
+
def unlock
|
119
|
+
@poll_lock.exit
|
120
|
+
debug "lock released for: #{self}"
|
121
|
+
end
|
122
|
+
|
95
123
|
## utility method to read a raw email header from an IO stream and turn it
|
96
124
|
## into a hash of key-value pairs. minor special semantics for certain headers.
|
97
125
|
##
|
data/lib/sup/thread.rb
CHANGED
@@ -387,6 +387,12 @@ class ThreadSet
|
|
387
387
|
m.refs.any? { |ref_id| @messages.member? ref_id }
|
388
388
|
end
|
389
389
|
|
390
|
+
def delete_message message
|
391
|
+
el = @messages[message.id]
|
392
|
+
return unless el.message
|
393
|
+
el.message = nil
|
394
|
+
end
|
395
|
+
|
390
396
|
## the heart of the threading code
|
391
397
|
def add_message message
|
392
398
|
el = @messages[message.id]
|
data/lib/sup/util.rb
CHANGED
@@ -8,6 +8,7 @@ require 'set'
|
|
8
8
|
require 'enumerator'
|
9
9
|
require 'benchmark'
|
10
10
|
require 'unicode'
|
11
|
+
require 'fileutils'
|
11
12
|
|
12
13
|
## time for some monkeypatching!
|
13
14
|
class Symbol
|
@@ -45,6 +46,17 @@ class Lockfile
|
|
45
46
|
def touch_yourself; touch path end
|
46
47
|
end
|
47
48
|
|
49
|
+
class File
|
50
|
+
# platform safe file.link which attempts a copy if hard-linking fails
|
51
|
+
def self.safe_link src, dest
|
52
|
+
begin
|
53
|
+
File.link src, dest
|
54
|
+
rescue
|
55
|
+
FileUtils.copy src, dest
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
48
60
|
class Pathname
|
49
61
|
def human_size
|
50
62
|
s =
|
@@ -120,8 +132,6 @@ module RMail
|
|
120
132
|
# Convert to ASCII before trying to match with regexp
|
121
133
|
class Field
|
122
134
|
|
123
|
-
EXTRACT_FIELD_NAME_RE = /\A([^\x00-\x1f\x7f-\xff :]+):\s*/no
|
124
|
-
|
125
135
|
class << self
|
126
136
|
def parse(field)
|
127
137
|
field = field.dup.to_s
|
data/lib/sup/util/query.rb
CHANGED
@@ -3,10 +3,13 @@ module Redwood
|
|
3
3
|
module Query
|
4
4
|
class QueryDescriptionError < ArgumentError; end
|
5
5
|
|
6
|
-
def self.describe
|
6
|
+
def self.describe(query, fallback = nil)
|
7
7
|
d = query.description.force_encoding("UTF-8")
|
8
8
|
|
9
|
-
|
9
|
+
unless d.valid_encoding?
|
10
|
+
raise QueryDescriptionError.new(d) unless fallback
|
11
|
+
d = fallback
|
12
|
+
end
|
10
13
|
return d
|
11
14
|
end
|
12
15
|
end
|
data/lib/sup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
11
|
-
hash: -295629968094096073
|
8
|
+
- 15
|
9
|
+
- 0
|
10
|
+
hash: 3778501713049268347
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- William Morgan
|
@@ -18,7 +17,7 @@ authors:
|
|
18
17
|
autorequire:
|
19
18
|
bindir: bin
|
20
19
|
cert_chain: []
|
21
|
-
date: 2013-
|
20
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
24
23
|
name: xapian-ruby
|
@@ -53,21 +52,21 @@ dependencies:
|
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: 1.3.1
|
55
54
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rmail
|
55
|
+
name: rmail-sup
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
none: false
|
59
58
|
requirements:
|
60
|
-
- -
|
59
|
+
- - ~>
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
61
|
+
version: 1.0.1
|
63
62
|
type: :runtime
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
none: false
|
67
66
|
requirements:
|
68
|
-
- -
|
67
|
+
- - ~>
|
69
68
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
69
|
+
version: 1.0.1
|
71
70
|
- !ruby/object:Gem::Dependency
|
72
71
|
name: highline
|
73
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,7 +274,8 @@ executables:
|
|
275
274
|
- sup-import-dump
|
276
275
|
- sup-recover-sources
|
277
276
|
- sup-sync
|
278
|
-
- sup-sync-back
|
277
|
+
- sup-sync-back-maildir
|
278
|
+
- sup-sync-back-mbox
|
279
279
|
- sup-tweak-labels
|
280
280
|
- sup-psych-ify-config-files
|
281
281
|
extensions: []
|
@@ -293,7 +293,8 @@ files:
|
|
293
293
|
- bin/sup-import-dump
|
294
294
|
- bin/sup-recover-sources
|
295
295
|
- bin/sup-sync
|
296
|
-
- bin/sup-sync-back
|
296
|
+
- bin/sup-sync-back-maildir
|
297
|
+
- bin/sup-sync-back-mbox
|
297
298
|
- bin/sup-tweak-labels
|
298
299
|
- bin/sup-psych-ify-config-files
|
299
300
|
- lib/sup/hook.rb
|
@@ -364,9 +365,9 @@ homepage: http://supmua.org
|
|
364
365
|
licenses:
|
365
366
|
- GPL-2
|
366
367
|
post_install_message: ! "SUP: If you are upgrading Sup from before version 0.14.0:
|
367
|
-
Please\n run `sup-psych-ify-config-files` to migrate from 0.13
|
368
|
-
|
369
|
-
|
368
|
+
Please\n run `sup-psych-ify-config-files` to migrate from 0.13.\n\n Check
|
369
|
+
https://github.com/sup-heliotrope/sup/wiki/Migration-0.13-to-0.14\n for more
|
370
|
+
detailed and up-to-date instructions.\n"
|
370
371
|
rdoc_options: []
|
371
372
|
require_paths:
|
372
373
|
- lib
|