em-imap 0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of em-imap might be problematic. Click here for more details.
- data/LICENSE.MIT +19 -0
- data/README.md +179 -0
- data/lib/em-imap.rb +40 -0
- data/lib/em-imap/authenticators.rb +28 -0
- data/lib/em-imap/client.rb +493 -0
- data/lib/em-imap/command_sender.rb +118 -0
- data/lib/em-imap/connection.rb +181 -0
- data/lib/em-imap/continuation_synchronisation.rb +85 -0
- data/lib/em-imap/listener.rb +154 -0
- data/lib/em-imap/response_parser.rb +50 -0
- metadata +108 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
module EventMachine
|
2
|
+
module IMAP
|
3
|
+
# Intercepts the receive_data event and generates receive_response events
|
4
|
+
# with parsed data.
|
5
|
+
module ResponseParser
|
6
|
+
def post_init
|
7
|
+
super
|
8
|
+
@parser = Net::IMAP::ResponseParser.new
|
9
|
+
@buffer = ""
|
10
|
+
end
|
11
|
+
|
12
|
+
# This is a translation of Net::IMAP#get_response
|
13
|
+
def receive_data(data)
|
14
|
+
@buffer += data
|
15
|
+
|
16
|
+
until @buffer.empty?
|
17
|
+
|
18
|
+
eol = @buffer.index(CRLF)
|
19
|
+
|
20
|
+
# Include IMAP literals on the same line.
|
21
|
+
# The format for a literal is "{8}\r\n........"
|
22
|
+
# so the size would be at the end of what we thought was the line.
|
23
|
+
# We then skip over that much, and try looking for the next newline.
|
24
|
+
# (The newline after a literal is the end of the actual line,
|
25
|
+
# there's no termination marker for literals).
|
26
|
+
while eol && @buffer[0, eol][/\{(\d+)\}\z/]
|
27
|
+
eol = @buffer.index(CRLF, eol + CRLF.size + $1.to_i)
|
28
|
+
end
|
29
|
+
|
30
|
+
# The current line is not yet complete, wait for more data.
|
31
|
+
return unless eol
|
32
|
+
|
33
|
+
line = @buffer.slice!(0, eol + CRLF.size)
|
34
|
+
|
35
|
+
receive_response parse(line)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Callback used by receive data.
|
40
|
+
def receive_response(response); end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def parse(line)
|
45
|
+
@parser.parse(line)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: em-imap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
version: "0.1"
|
9
|
+
platform: ruby
|
10
|
+
authors:
|
11
|
+
- Conrad Irwin
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
|
16
|
+
date: 2011-05-02 00:00:00 -07:00
|
17
|
+
default_executable:
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: eventmachine
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
segments:
|
27
|
+
- 0
|
28
|
+
version: "0"
|
29
|
+
type: :runtime
|
30
|
+
version_requirements: *id001
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: deferrable_gratification
|
33
|
+
prerelease: false
|
34
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
segments:
|
39
|
+
- 0
|
40
|
+
version: "0"
|
41
|
+
type: :runtime
|
42
|
+
version_requirements: *id002
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
prerelease: false
|
46
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
type: :development
|
54
|
+
version_requirements: *id003
|
55
|
+
description: Allows you to connect to an IMAP4rev1 server in a non-blocking fashion.
|
56
|
+
email:
|
57
|
+
- conrad@rapportive.com
|
58
|
+
executables: []
|
59
|
+
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files: []
|
63
|
+
|
64
|
+
files:
|
65
|
+
- lib/em-imap.rb
|
66
|
+
- lib/em-imap/listener.rb
|
67
|
+
- lib/em-imap/client.rb
|
68
|
+
- lib/em-imap/continuation_synchronisation.rb
|
69
|
+
- lib/em-imap/response_parser.rb
|
70
|
+
- lib/em-imap/connection.rb
|
71
|
+
- lib/em-imap/command_sender.rb
|
72
|
+
- lib/em-imap/authenticators.rb
|
73
|
+
- LICENSE.MIT
|
74
|
+
- README.md
|
75
|
+
has_rdoc: true
|
76
|
+
homepage: http://github.com/rapportive-oss/em-imap
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 8
|
91
|
+
- 7
|
92
|
+
version: 1.8.7
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
requirements: []
|
101
|
+
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.3.6
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: An EventMachine based IMAP client.
|
107
|
+
test_files: []
|
108
|
+
|