ruby-gmail 0.0.6 → 0.0.7
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.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/lib/gmail.rb +1 -1
- data/lib/ietf/rfc2045.rb +5 -3
- data/lib/ietf/rfc822.rb +1 -0
- data/lib/mime/entity.rb +4 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/gmail.rb
CHANGED
data/lib/ietf/rfc2045.rb
CHANGED
@@ -4,10 +4,10 @@ module IETF
|
|
4
4
|
def self.parse_rfc2045_from(raw)
|
5
5
|
headers, raw = IETF::RFC822.parse_rfc822_from(raw)
|
6
6
|
|
7
|
-
if headers['content-type'] =~ /multipart\/(\w+); boundary=([\"\']?)(.*)\2
|
7
|
+
if headers['content-type'] =~ /multipart\/(\w+); boundary=([\"\']?)(.*)\2?/
|
8
8
|
content = {}
|
9
9
|
content[:type] = $1
|
10
|
-
content[:boundary] = $
|
10
|
+
content[:boundary] = $3
|
11
11
|
content[:content] = IETF::RFC2045.parse_rfc2045_content_from(raw, content[:boundary])
|
12
12
|
else
|
13
13
|
content = raw
|
@@ -17,9 +17,11 @@ module IETF
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.parse_rfc2045_content_from(raw, boundary)
|
20
|
-
parts = raw.split(/#{CRLF.source}--#{boundary}(?:--)?(?:#{CRLF.source}|$)/)
|
20
|
+
parts = ("\r\n" + raw).split(/#{CRLF.source}--#{boundary}(?:--)?(?:#{CRLF.source}|$)/)
|
21
21
|
parts.reject! {|p| p.gsub(/^[ \r\n#{HTAB}]?$/,'') == ''} # Remove any parts that are blank
|
22
|
+
puts "[RFC2045] PARTS:\n\t#{parts.map {|p| p.gsub(/\n/,"\n\t")}.join("\n---\n\t")}" if $DEBUG
|
22
23
|
parts.collect {|part|
|
24
|
+
puts "[RFC2045] Parsing PART with boundary #{boundary.inspect}:\n\t#{part.gsub(/\n/,"\n\t")}" if $DEBUG
|
23
25
|
IETF::RFC2045.parse_rfc2045_from(part)
|
24
26
|
}
|
25
27
|
end
|
data/lib/ietf/rfc822.rb
CHANGED
@@ -12,6 +12,7 @@ module IETF
|
|
12
12
|
headers = {}
|
13
13
|
# Parse out rfc822 (headers)
|
14
14
|
head, remaining_raw = raw.split(/#{CRLF.source}#{CRLF.source}/,2)
|
15
|
+
puts "[RFC822] HEAD found:\n\t#{head.gsub(/\n/,"\n\t")}" if $DEBUG
|
15
16
|
head.scan(FIELD) do |field_name, field_body|
|
16
17
|
headers[field_name.downcase] = field_body
|
17
18
|
end
|
data/lib/mime/entity.rb
CHANGED
@@ -12,7 +12,7 @@ module MIME
|
|
12
12
|
class Entity
|
13
13
|
def initialize(arg=nil)
|
14
14
|
if arg.is_a?(String)
|
15
|
-
@raw = arg.gsub(/\r
|
15
|
+
@raw = arg.gsub(/\r/,'').gsub(/\n/, "\r\n") # normalizes end-of-line characters
|
16
16
|
from_parsed(IETF::RFC2045.parse_rfc2045_from(@raw))
|
17
17
|
elsif arg.is_a?(Hash)
|
18
18
|
@headers = arg
|
@@ -39,16 +39,17 @@ module MIME
|
|
39
39
|
if parsed[1].is_a?(Hash)
|
40
40
|
@multipart_type = parsed[1][:type]
|
41
41
|
@multipart_boundary = parsed[1][:boundary]
|
42
|
+
raise "IETF PARSING FAIL! (empty boundary)" if @multipart_boundary == ''
|
42
43
|
end
|
43
44
|
else
|
44
|
-
raise "IETF PARSING FAIL!"
|
45
|
+
raise "IETF PARSING FAIL! ('A' structure)"
|
45
46
|
end
|
46
47
|
return self
|
47
48
|
when Hash
|
48
49
|
if parsed.has_key?(:type) && parsed.has_key?(:boundary) && parsed.has_key?(:content)
|
49
50
|
@content = parsed[:content].is_a?(Array) ? parsed[:content].collect {|p| Entity.new.from_parsed(p)} : parsed[:content]
|
50
51
|
else
|
51
|
-
raise "IETF PARSING FAIL!"
|
52
|
+
raise "IETF PARSING FAIL! ('H' structure)"
|
52
53
|
end
|
53
54
|
return self
|
54
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-gmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Parker
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
teST6sOe8lUhZQ==
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-12-
|
33
|
+
date: 2009-12-23 00:00:00 -05:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|