mournmail 1.0.5 → 2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebc2414b32ab7005cc39801155dcfe26eb1381026a7750b80c28ae84db63dae0
4
- data.tar.gz: 464beaa7109d55c1730baad310ac064974cf902fd43281c936721587edd175fc
3
+ metadata.gz: 0470feee9eea6f5ba0071596fe11f01dace923c44ce6c1b33738d4afc7712e07
4
+ data.tar.gz: 242f831af33c0b3fb3eec8958ecb6db122d055f263452f7c4a9a3c5964db000c
5
5
  SHA512:
6
- metadata.gz: 13eebd0a106ac2494793d379ab682091e2dcc6aff0cf5fe6c5c7eebb712c7ba0ddeb0f14d9e16278bebae72ee8a18747024bc64f5c9d42772ea50ec5a649f666
7
- data.tar.gz: 1d6a84e080f9612c41201c6fa59856fee33e2a9c0a20159185ceef8e36f8b575ecd98762d77ea19a3de00e760925262e10ad5ec7630920fef9e6edbf4b83b2fb
6
+ metadata.gz: aaf1a5eec30365b900c65a6d927bbcb5ae340be299190a48acb3107bc3f325e52e52b2045cea6079a315553f631fd97be4e3c1f888ff25a0ca7924975d9320df
7
+ data.tar.gz: 3e99259ee5ac139ca90fb047cab4d0121ddfcbbebb3a007ff30544da2595046178915ca54cb82a9ef458fd71ed8b4df99267ce05ea8028af15180e716e4a83e1
@@ -28,17 +28,17 @@ jobs:
28
28
  with:
29
29
  egress-policy: audit
30
30
 
31
- - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
+ - uses: actions/checkout@v4
32
32
 
33
33
  - name: Set up Ruby
34
- uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
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@612653d273a73bdae1df8453e090060bb4db5f31 # v1
41
+ uses: rubygems/release-gem@v1
42
42
 
43
43
  - name: Create GitHub release
44
44
  run: |
@@ -37,6 +37,7 @@ module Textbringer
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[:forgotten_attachment_re] =
58
+ CONFIG[:mournmail_forgotten_attachment_re] =
58
59
  Regexp.new(
59
60
  "^(?!>).*" +
60
61
  Regexp.union(
@@ -65,4 +66,7 @@ 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
68
72
  end
@@ -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[:forgotten_attachment_re]) &&
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)
@@ -1,5 +1,6 @@
1
1
  require "mail"
2
2
  require "nokogiri"
3
+ require "html2text"
3
4
 
4
5
  module Mournmail
5
6
  module MessageRendering
@@ -213,8 +213,12 @@ module Mournmail
213
213
  }
214
214
  end
215
215
 
216
- def to_s(limit = 78, from_limit = 16, level = 0)
217
- @line ||= format_line(limit, from_limit, level)
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 = 78, from_limit = 16, level = 0)
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
- format("%s [ %s ] %s\n",
603
- m.date.strftime("%m/%d %H:%M"),
604
- ljust(m.from.to_s.gsub(/\n/, ""), 16),
605
- ljust(m.subject.to_s.gsub(/\n/, ""), 45))
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)
@@ -129,7 +129,8 @@ module Mournmail
129
129
  def self.message_window
130
130
  if Window.list.size == 1
131
131
  split_window
132
- shrink_window(Window.current.lines - 8)
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|
@@ -1,3 +1,3 @@
1
1
  module Mournmail
2
- VERSION = "1.0.5"
2
+ VERSION = "2"
3
3
  end
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: 1.0.5
4
+ version: '2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-06-05 00:00:00.000000000 Z
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: 3.5.9
219
- signing_key:
230
+ rubygems_version: 3.6.7
220
231
  specification_version: 4
221
232
  summary: A message user agent for Textbringer.
222
233
  test_files: []