vmail 1.9.3 → 1.9.4

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.
@@ -285,6 +285,9 @@ module Vmail
285
285
  def format_headers(hash)
286
286
  lines = []
287
287
  hash.each_pair do |key, value|
288
+ if value.nil?
289
+ next
290
+ end
288
291
  if value.is_a?(Array)
289
292
  value = value.join(", ")
290
293
  end
@@ -347,9 +350,10 @@ EOF
347
350
  mail = Mail.new
348
351
  raw_headers, raw_body = *text.split(/\n\s*\n/, 2)
349
352
  headers = {}
353
+
350
354
  raw_headers.split("\n").each do |line|
351
355
  key, value = *line.split(/:\s*/, 2)
352
- if key == 'message-id'
356
+ if key == 'references'
353
357
  mail.references = value
354
358
  else
355
359
  next if (value.nil? || value.strip == '')
@@ -85,20 +85,14 @@ module Vmail
85
85
  end
86
86
 
87
87
  def extract_headers(mail = @mail)
88
- headers = {'from' => utf8(mail['from'].decoded),
88
+ headers = {
89
+ 'from' => utf8(mail['from'].decoded),
89
90
  'date' => (mail.date.strftime('%a, %b %d %I:%M %p %Z %Y') rescue mail.date),
90
91
  'to' => mail['to'].nil? ? nil : utf8(mail['to'].decoded),
92
+ 'cc' => (mail.cc && utf8(mail['cc'].decoded.to_s)),
93
+ 'reply_to' => (mail.reply_to && utf8(mail['reply_to'].decoded)),
91
94
  'subject' => utf8(mail.subject)
92
95
  }
93
- if !mail.cc.nil?
94
- headers['cc'] = utf8(mail['cc'].decoded.to_s)
95
- end
96
- if !mail.reply_to.nil?
97
- headers['reply_to'] = utf8(mail['reply_to'].decoded)
98
- end
99
- if mail['message-id']
100
- headers['references'] = mail['message-id']
101
- end
102
96
  headers
103
97
  rescue
104
98
  {'error' => $!}
@@ -25,7 +25,7 @@ module Vmail
25
25
  reply_body = reply_quote_header + divider('-') +
26
26
  (current_message.plaintext.split(/^-+$/,2)[1])
27
27
  {
28
- 'message-id' => current_message.message_id,
28
+ 'references' => current_message.message_id,
29
29
  'from' => "#@name <#@username>",
30
30
  'to' => reply_recipient,
31
31
  'cc' => reply_cc,
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '1.9.3'
2
+ VERSION = '1.9.4'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: vmail
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.9.3
5
+ version: 1.9.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Choi