uron 1.3.0 → 1.3.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/uron.rb +14 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 072c0d933a2d856884ac242e14aa43d492a67b0c
4
- data.tar.gz: 0c6314192d29d6e07b2138f996ff12c068ce3e06
3
+ metadata.gz: f871350a697b79679efebff3405e7dbb41ab1482
4
+ data.tar.gz: 24bab3b0b45859b16274052414a1e4e6a4a02420
5
5
  SHA512:
6
- metadata.gz: b67e1876044aeecf5fa4632d6d38b5cdfbaf45b64ae7dd8ee946ff75c7b59391bf595ef3a4382d2694e311478a2a3fd7a304933c6486d44079da1d105ccf2b57
7
- data.tar.gz: e5b1b16a386bc3d3d4cfe2f460d79342b742d39cf9d758c2ba4997a067d630384633e55bc0f998fa7cb9f68252367be75968f18b47d04683e6413376dcee74b7
6
+ metadata.gz: 53e08437fb63416cd5092ff0f6fab00806d60a1f16218e42e983e46119b25b3e63d2a2488f6400acb6030c40907332032eed3750fd5cf56a9762a1671285b22e
7
+ data.tar.gz: c90e87d74ffdb389ad50fefb652c2130994256da2ca9c040b57d7cc68bcf7ccea24af3821a21c3217a83f840afbde89b8216049e2d1c2ece6098ad83654845ee
@@ -34,7 +34,7 @@ require "socket"
34
34
  #= uron - a mail delivery agent
35
35
  #
36
36
  class Uron
37
- VERSION = "1.3.0"
37
+ VERSION = "1.3.1"
38
38
 
39
39
  ConfigError = Class.new(RuntimeError)
40
40
 
@@ -82,7 +82,7 @@ class Uron
82
82
  def run(io = $stdin)
83
83
  @mail = self.class::Mail.read(io)
84
84
 
85
- logging "From #{(@mail.headers[:from] || []).first} #{Time.now}"
85
+ logging @mail.from || "From #{(@mail.headers[:from] || []).first} #{Time.now}"
86
86
  logging " Subject: #{@mail.headers[:subject].first[0, 69]}" if @mail.headers.include?(:subject)
87
87
 
88
88
  catch(:tag) do
@@ -241,6 +241,9 @@ class Uron
241
241
  self.new(io.binmode.read)
242
242
  end
243
243
 
244
+ # `From` line from MTA, if exists
245
+ attr_reader :from
246
+
244
247
  # a Hash of mail headers
245
248
  attr_reader :headers
246
249
 
@@ -254,6 +257,9 @@ class Uron
254
257
  #
255
258
  # _plain_ is the original mail text.
256
259
  def initialize(plain)
260
+ @from = nil
261
+ @headers = {}
262
+ @body = []
257
263
  @plain = plain.dup
258
264
  parse(@plain)
259
265
  end
@@ -262,8 +268,14 @@ class Uron
262
268
  #
263
269
  # _plain_ is the original mail text.
264
270
  def parse(plain)
271
+ @from = nil
265
272
  @headers = {}
266
273
  @body = []
274
+
275
+ if plain.sub!(/\AFrom .*?\r?\n/, '')
276
+ @from = $&.chomp
277
+ end
278
+
267
279
  header_p = true
268
280
  prev = nil
269
281
  plain.each_line do |line|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uron
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - U.Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-29 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler