gmail-imap 1.0.0 → 1.0.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.
data/lib/gmail_imap.rb
CHANGED
@@ -28,7 +28,7 @@ class Net::IMAP::ResponseParser::Gmail < Net::IMAP::ResponseParser
|
|
28
28
|
when /\A(?:UID)\z/ni
|
29
29
|
name, val = uid_data
|
30
30
|
when /\A(?:X-GM-LABELS)\z/ni
|
31
|
-
name, val =
|
31
|
+
name, val = label_data
|
32
32
|
when /\A(?:X-GM-MSGID)\z/ni
|
33
33
|
name, val = uid_data
|
34
34
|
when /\A(?:X-GM-THRID)\z/ni
|
@@ -40,4 +40,28 @@ class Net::IMAP::ResponseParser::Gmail < Net::IMAP::ResponseParser
|
|
40
40
|
end
|
41
41
|
return attr
|
42
42
|
end
|
43
|
+
|
44
|
+
def label_data
|
45
|
+
token = match(T_ATOM)
|
46
|
+
name = token.value.upcase
|
47
|
+
match(T_SPACE)
|
48
|
+
return name, astring_list
|
49
|
+
end
|
50
|
+
|
51
|
+
def astring_list
|
52
|
+
result = []
|
53
|
+
match(T_LPAR)
|
54
|
+
while true
|
55
|
+
token = lookahead
|
56
|
+
case token.symbol
|
57
|
+
when T_RPAR
|
58
|
+
shift_token
|
59
|
+
break
|
60
|
+
when T_SPACE
|
61
|
+
shift_token
|
62
|
+
end
|
63
|
+
result.push(astring)
|
64
|
+
end
|
65
|
+
return result
|
66
|
+
end
|
43
67
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
* 3 FETCH (X-GM-LABELS (Inbox This "Supports Spaces"))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'net/imap/
|
1
|
+
require 'net/imap/gmail'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
4
|
class Net::IMAP::ResponseParser::GmailTest < Test::Unit::TestCase
|
@@ -12,4 +12,13 @@ class Net::IMAP::ResponseParser::GmailTest < Test::Unit::TestCase
|
|
12
12
|
assert_equal 789, result.data.attr['X-GM-THRID']
|
13
13
|
assert_equal ['Foo', 'Bar'], result.data.attr['X-GM-LABELS']
|
14
14
|
end
|
15
|
+
|
16
|
+
def test_parses_gmail_fetch_quoted_labels
|
17
|
+
message = File.read(File.expand_path(File.join(__FILE__, '..', '..', '..', '..', 'fixtures', 'response-quoted-labels.log')))
|
18
|
+
|
19
|
+
parser = Net::IMAP::ResponseParser::Gmail.new
|
20
|
+
result = parser.parse(message)
|
21
|
+
|
22
|
+
assert_equal ['Inbox', 'This', 'Supports Spaces'], result.data.attr['X-GM-LABELS']
|
23
|
+
end
|
15
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmail-imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mocha
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/gmail_imap.rb
|
44
44
|
- lib/net/imap/gmail.rb
|
45
45
|
- lib/net/imap/response_parser/gmail.rb
|
46
|
+
- test/fixtures/response-quoted-labels.log
|
46
47
|
- test/fixtures/response.log
|
47
48
|
- test/net/imap/response_parser/test_gmail.rb
|
48
49
|
- test/net/imap/test_gmail.rb
|
@@ -71,6 +72,7 @@ signing_key:
|
|
71
72
|
specification_version: 3
|
72
73
|
summary: A Gmail extension-aware accessory to Net::IMAP.
|
73
74
|
test_files:
|
75
|
+
- test/fixtures/response-quoted-labels.log
|
74
76
|
- test/fixtures/response.log
|
75
77
|
- test/net/imap/response_parser/test_gmail.rb
|
76
78
|
- test/net/imap/test_gmail.rb
|