mournmail 1.0.5 → 3
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.
- checksums.yaml +4 -4
- data/.github/workflows/push_gem.yml +3 -3
- data/lib/mournmail/config.rb +13 -7
- data/lib/mournmail/draft_mode.rb +10 -4
- data/lib/mournmail/message_mode.rb +4 -7
- data/lib/mournmail/message_rendering.rb +1 -0
- data/lib/mournmail/summary.rb +9 -3
- data/lib/mournmail/summary_mode.rb +11 -5
- data/lib/mournmail/utils.rb +9 -3
- data/lib/mournmail/version.rb +1 -1
- data/mournmail.gemspec +1 -0
- metadata +17 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 410f91625278d6121b3f4f0c2253595b294e66b4a0149ce6af53afaaac8a2747
|
|
4
|
+
data.tar.gz: 2e052315c79594fc4a7946142efce5ff3f04b288e223c4d569f6b7cee423e95d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3e8e9a07573cacb0f5de41c5055589040a75a6ef2e9b8315e86744efea7f0c11b74cbed2d4c0e92bf4cee724bad183439d5c61b4a7b6f024eb48afe26005db4
|
|
7
|
+
data.tar.gz: a51657c1ec942e4dd19f8982bfec92566f77c505b25988dd72dd20d8a1869a73ecbe752b682ca0cdae08c5fc5981b710b9b0e2df49f7e9ebe4b8d701e5b8f5a5
|
|
@@ -28,17 +28,17 @@ jobs:
|
|
|
28
28
|
with:
|
|
29
29
|
egress-policy: audit
|
|
30
30
|
|
|
31
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
32
|
|
|
33
33
|
- name: Set up Ruby
|
|
34
|
-
uses: ruby/setup-ruby@
|
|
34
|
+
uses: ruby/setup-ruby@v1
|
|
35
35
|
with:
|
|
36
36
|
bundler-cache: true
|
|
37
37
|
ruby-version: ruby
|
|
38
38
|
|
|
39
39
|
# Release
|
|
40
40
|
- name: Publish to RubyGems
|
|
41
|
-
uses: rubygems/release-gem@
|
|
41
|
+
uses: rubygems/release-gem@v1
|
|
42
42
|
|
|
43
43
|
- name: Create GitHub release
|
|
44
44
|
run: |
|
data/lib/mournmail/config.rb
CHANGED
|
@@ -26,17 +26,18 @@ module Textbringer
|
|
|
26
26
|
CONFIG[:mournmail_keep_alive_interval] = 60
|
|
27
27
|
case RUBY_PLATFORM
|
|
28
28
|
when /mswin|mingw/
|
|
29
|
-
CONFIG[:
|
|
30
|
-
CONFIG[:
|
|
29
|
+
CONFIG[:mournmail_file_open_command] = "start"
|
|
30
|
+
CONFIG[:mournmail_link_open_command] = "start"
|
|
31
31
|
when /darwin/
|
|
32
|
-
CONFIG[:
|
|
33
|
-
CONFIG[:
|
|
32
|
+
CONFIG[:mournmail_file_open_command] = "open"
|
|
33
|
+
CONFIG[:mournmail_link_open_command] = "open"
|
|
34
34
|
else
|
|
35
|
-
CONFIG[:
|
|
36
|
-
CONFIG[:
|
|
35
|
+
CONFIG[:mournmail_file_open_command] = "xdg-open"
|
|
36
|
+
CONFIG[:mournmail_link_open_command] = "xdg-open"
|
|
37
37
|
end
|
|
38
38
|
CONFIG[:mournmail_addresses_path] = File.expand_path("~/.addresses")
|
|
39
39
|
CONFIG[:mournmail_signature_regexp] = /^-- /
|
|
40
|
+
CONFIG[:mournmail_summary_lines] = 7
|
|
40
41
|
CONFIG[:mournmail_allowed_attachment_extensions] = [
|
|
41
42
|
"txt",
|
|
42
43
|
"md",
|
|
@@ -54,7 +55,7 @@ module Textbringer
|
|
|
54
55
|
"ppt",
|
|
55
56
|
"zip"
|
|
56
57
|
]
|
|
57
|
-
CONFIG[:
|
|
58
|
+
CONFIG[:mournmail_forgotten_attachment_re] =
|
|
58
59
|
Regexp.new(
|
|
59
60
|
"^(?!>).*" +
|
|
60
61
|
Regexp.union(
|
|
@@ -65,4 +66,9 @@ module Textbringer
|
|
|
65
66
|
/ファイルを参照/
|
|
66
67
|
).to_s
|
|
67
68
|
)
|
|
69
|
+
CONFIG[:mournmail_summary_line_limit] = 78
|
|
70
|
+
CONFIG[:mournmail_summary_from_limit] = 16
|
|
71
|
+
CONFIG[:mournmail_summary_use_line_cache] = true
|
|
72
|
+
CONFIG[:mournmail_smtp_open_timeout] = 30
|
|
73
|
+
CONFIG[:mournmail_smtp_read_timeout] = 60
|
|
68
74
|
end
|
data/lib/mournmail/draft_mode.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Mournmail
|
|
|
22
22
|
define_local_command(:draft_send,
|
|
23
23
|
doc: "Send a mail and exit from mail buffer.") do
|
|
24
24
|
s = @buffer.to_s
|
|
25
|
-
if s.match?(CONFIG[:
|
|
25
|
+
if s.match?(CONFIG[:mournmail_forgotten_attachment_re]) &&
|
|
26
26
|
!s.match?(/^Attached-File:/)
|
|
27
27
|
msg = "It seems like you forgot to attach a file. Send anyway?"
|
|
28
28
|
return unless yes_or_no?(msg)
|
|
@@ -76,16 +76,22 @@ module Mournmail
|
|
|
76
76
|
account = @buffer[:mournmail_delivery_account] ||
|
|
77
77
|
Mournmail.current_account
|
|
78
78
|
conf = CONFIG[:mournmail_accounts][account]
|
|
79
|
+
delivery_method = @buffer[:mournmail_delivery_method] ||
|
|
80
|
+
conf[:delivery_method]
|
|
79
81
|
options = @buffer[:mournmail_delivery_options] ||
|
|
80
82
|
conf[:delivery_options]
|
|
83
|
+
if delivery_method == :smtp
|
|
84
|
+
options = {
|
|
85
|
+
open_timeout: CONFIG[:mournmail_smtp_open_timeout],
|
|
86
|
+
read_timeout: CONFIG[:mournmail_smtp_read_timeout],
|
|
87
|
+
}.merge(options)
|
|
88
|
+
end
|
|
81
89
|
if options[:authentication] == "gmail"
|
|
82
90
|
token = Mournmail.google_access_token(account)
|
|
83
91
|
options = options.merge(authentication: "xoauth2",
|
|
84
92
|
password: token)
|
|
85
93
|
end
|
|
86
|
-
m.delivery_method(
|
|
87
|
-
conf[:delivery_method],
|
|
88
|
-
options)
|
|
94
|
+
m.delivery_method(delivery_method, options)
|
|
89
95
|
bury_buffer(@buffer)
|
|
90
96
|
Mournmail.background do
|
|
91
97
|
begin
|
|
@@ -11,10 +11,7 @@ module Mournmail
|
|
|
11
11
|
MESSAGE_MODE_MAP.define_key("\t", :message_next_link_or_part_command)
|
|
12
12
|
|
|
13
13
|
# See http://nihongo.jp/support/mail_guide/dev_guide.txt
|
|
14
|
-
URI_REGEXP =
|
|
15
|
-
URI.regexp("https"),
|
|
16
|
-
URI.regexp("ftp"),
|
|
17
|
-
URI.regexp("mailto"))
|
|
14
|
+
URI_REGEXP = URI::RFC2396_PARSER.make_regexp(["http", "https", "ftp", "mailto"])
|
|
18
15
|
MIME_REGEXP = /^\[(([0-9.]+) [A-Za-z._\-]+\/[A-Za-z._\-]+.*|PGP\/MIME .*)\]$/
|
|
19
16
|
URI_OR_MIME_REGEXP = Regexp.union(URI_REGEXP, MIME_REGEXP)
|
|
20
17
|
|
|
@@ -157,7 +154,7 @@ module Mournmail
|
|
|
157
154
|
find_file(@attached_file.path)
|
|
158
155
|
else
|
|
159
156
|
background do
|
|
160
|
-
system(*CONFIG[:
|
|
157
|
+
system(*CONFIG[:mournmail_file_open_command], @attached_file.path,
|
|
161
158
|
out: File::NULL, err: File::NULL)
|
|
162
159
|
end
|
|
163
160
|
end
|
|
@@ -179,8 +176,8 @@ module Mournmail
|
|
|
179
176
|
insert u.to_mailtext.sub(/\n\n\z/, "")
|
|
180
177
|
end_of_buffer
|
|
181
178
|
else
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
cmd = Mournmail.account_config[:link_open_command] || CONFIG[:mournmail_link_open_command]
|
|
180
|
+
system(*cmd, uri, out: File::NULL, err: File::NULL)
|
|
184
181
|
end
|
|
185
182
|
end
|
|
186
183
|
end
|
data/lib/mournmail/summary.rb
CHANGED
|
@@ -213,8 +213,12 @@ module Mournmail
|
|
|
213
213
|
}
|
|
214
214
|
end
|
|
215
215
|
|
|
216
|
-
def to_s(limit =
|
|
217
|
-
|
|
216
|
+
def to_s(limit = CONFIG[:mournmail_summary_line_limit],
|
|
217
|
+
from_limit = CONFIG[:mournmail_summary_from_limit],
|
|
218
|
+
level = 0)
|
|
219
|
+
if @line.nil? || !CONFIG[:mournmail_summary_use_line_cache]
|
|
220
|
+
@line = format_line(limit, from_limit, level)
|
|
221
|
+
end
|
|
218
222
|
return @line if @replies.empty?
|
|
219
223
|
s = @line.dup
|
|
220
224
|
child_level = level + 1
|
|
@@ -247,7 +251,9 @@ module Mournmail
|
|
|
247
251
|
|
|
248
252
|
private
|
|
249
253
|
|
|
250
|
-
def format_line(limit =
|
|
254
|
+
def format_line(limit = CONFIG[:mournmail_summary_line_limit],
|
|
255
|
+
from_limit = CONFIG[:mournmail_summary_from_limit],
|
|
256
|
+
level = 0)
|
|
251
257
|
space = " " * (level < 8 ? level : 8)
|
|
252
258
|
s = +""
|
|
253
259
|
s << format("%6d %s%s %s[ %s ] ",
|
|
@@ -390,7 +390,7 @@ module Mournmail
|
|
|
390
390
|
summary = Mournmail.current_summary
|
|
391
391
|
mailbox = Mournmail.current_mailbox
|
|
392
392
|
spam_mailbox = Mournmail.account_config[:spam_mailbox]
|
|
393
|
-
if mailbox == Net::IMAP.encode_utf7(spam_mailbox)
|
|
393
|
+
if spam_mailbox && mailbox == Net::IMAP.encode_utf7(spam_mailbox)
|
|
394
394
|
raise EditorError, "Can't prefetch spam"
|
|
395
395
|
end
|
|
396
396
|
target_uids = @buffer.to_s.scan(/^ *\d+/).map { |s|
|
|
@@ -599,10 +599,16 @@ module Mournmail
|
|
|
599
599
|
def show_search_result(messages,
|
|
600
600
|
query: nil, buffer_name: "*search result*")
|
|
601
601
|
summary_text = messages.map { |m|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
s = +""
|
|
603
|
+
s << format("%s [ %s ] ",
|
|
604
|
+
m.date.strftime("%m/%d %H:%M"),
|
|
605
|
+
ljust(m.from.to_s.gsub(/\n/, ""),
|
|
606
|
+
CONFIG[:mournmail_summary_from_limit]))
|
|
607
|
+
s << ljust(m.subject.to_s.gsub(/\n/, ""),
|
|
608
|
+
CONFIG[:mournmail_summary_line_limit] - Buffer.display_width(s))
|
|
609
|
+
s << "\n"
|
|
610
|
+
s
|
|
611
|
+
|
|
606
612
|
}.join
|
|
607
613
|
buffer = Buffer.find_or_new(buffer_name, undo_limit: 0,
|
|
608
614
|
read_only: true)
|
data/lib/mournmail/utils.rb
CHANGED
|
@@ -129,7 +129,8 @@ module Mournmail
|
|
|
129
129
|
def self.message_window
|
|
130
130
|
if Window.list.size == 1
|
|
131
131
|
split_window
|
|
132
|
-
|
|
132
|
+
n = Window.current.lines - (CONFIG[:mournmail_summary_lines] + 1)
|
|
133
|
+
shrink_window(n)
|
|
133
134
|
end
|
|
134
135
|
windows = Window.list
|
|
135
136
|
i = (windows.index(Window.current) + 1) % windows.size
|
|
@@ -197,7 +198,7 @@ module Mournmail
|
|
|
197
198
|
end
|
|
198
199
|
Timeout.timeout(CONFIG[:mournmail_imap_connect_timeout]) do
|
|
199
200
|
@imap = Net::IMAP.new(conf[:imap_host],
|
|
200
|
-
conf[:imap_options].except(:auth_type, :user_name))
|
|
201
|
+
conf[:imap_options].except(:auth_type, :user_name, :password))
|
|
201
202
|
@imap.authenticate(auth_type, conf[:imap_options][:user_name],
|
|
202
203
|
password)
|
|
203
204
|
@mailboxes = @imap.list("", "*").map { |mbox|
|
|
@@ -266,7 +267,12 @@ module Mournmail
|
|
|
266
267
|
FileUtils.mkdir_p(File.dirname(auth_path))
|
|
267
268
|
store = Google::APIClient::FileStore.new(auth_path)
|
|
268
269
|
storage = Google::APIClient::Storage.new(store)
|
|
269
|
-
|
|
270
|
+
begin
|
|
271
|
+
storage.authorize
|
|
272
|
+
rescue Signet::AuthorizationError
|
|
273
|
+
File.unlink(auth_path)
|
|
274
|
+
raise
|
|
275
|
+
end
|
|
270
276
|
if storage.authorization.nil?
|
|
271
277
|
conf = CONFIG[:mournmail_accounts][account]
|
|
272
278
|
path = File.expand_path(conf[:client_secret_path])
|
data/lib/mournmail/version.rb
CHANGED
data/mournmail.gemspec
CHANGED
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.add_runtime_dependency "google-apis-core"
|
|
31
31
|
spec.add_runtime_dependency "launchy"
|
|
32
32
|
spec.add_runtime_dependency "nokogiri"
|
|
33
|
+
spec.add_runtime_dependency "html2text"
|
|
33
34
|
|
|
34
35
|
spec.add_development_dependency "bundler"
|
|
35
36
|
spec.add_development_dependency "rake", ">= 12.0"
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mournmail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: '3'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shugo Maeda
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: textbringer
|
|
@@ -136,6 +135,20 @@ dependencies:
|
|
|
136
135
|
- - ">="
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
137
|
version: '0'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: html2text
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '0'
|
|
145
|
+
type: :runtime
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
139
152
|
- !ruby/object:Gem::Dependency
|
|
140
153
|
name: bundler
|
|
141
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -200,7 +213,6 @@ homepage: https://github.com/shugo/mournmail
|
|
|
200
213
|
licenses:
|
|
201
214
|
- MIT
|
|
202
215
|
metadata: {}
|
|
203
|
-
post_install_message:
|
|
204
216
|
rdoc_options: []
|
|
205
217
|
require_paths:
|
|
206
218
|
- lib
|
|
@@ -215,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
215
227
|
- !ruby/object:Gem::Version
|
|
216
228
|
version: '0'
|
|
217
229
|
requirements: []
|
|
218
|
-
rubygems_version:
|
|
219
|
-
signing_key:
|
|
230
|
+
rubygems_version: 4.1.0.dev
|
|
220
231
|
specification_version: 4
|
|
221
232
|
summary: A message user agent for Textbringer.
|
|
222
233
|
test_files: []
|