mailhandler 1.0.26 → 1.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2ddb338b7a52cc1426f32afaaaeab6db6c33b7d
4
- data.tar.gz: e79fff22bcc348aa7ecd8c3c6027172f5926f265
3
+ metadata.gz: 312566ee726f5b9dfebce785b387733856e1ce6b
4
+ data.tar.gz: 808d6790c07347ba88607893870c83817c968369
5
5
  SHA512:
6
- metadata.gz: 40bfafd947ed23c6562519d1427da8c491097a7d7eeeb2b48c9cdf04c8d169d14d146d509530b264c65b982eb53f3d7fc81f479028c781361f928e834a748d26
7
- data.tar.gz: a2dde2cb11e392fb60d5947671dc390f67094535154e0fe3eb8174925be7663c60f401d62f4c88b0a431fd8d25c90db8e255c6b9931ddbf7ff95c6a404a0e9b3
6
+ metadata.gz: 43055df6d4ffa6bfb05b02cbd362dfa01455bb6c466f17b571a9520b9cd4de0f34a7232eeab3d930dd32848f5d46bf89ef05a8e0a59b5a9e9ab6abcdb6bb1085
7
+ data.tar.gz: 74ee5fe56db299d830b3e1355ba1a64ccfa43d9967972b54f4ec5d9141e12a12283646188a1e43de333aa11d3bb58feb78507c889df47cf6cb7cb83770d1bdf0
@@ -140,7 +140,7 @@ module MailHandler
140
140
 
141
141
  def imap_search(retry_count, options)
142
142
 
143
- result = mailer.find(:what => :last, :count => search_options[:count], :order => :desc, :keys => imap_filter_keys(options), :delete_after_find => options[:archive])
143
+ result = mailer.find_emails(:what => :last, :count => search_options[:count], :order => :desc, :keys => imap_filter_keys(options), :delete_after_find => options[:archive])
144
144
  (result.kind_of? Array)? result : [result]
145
145
 
146
146
  # Silently ignore IMAP search errors, [RETRY_ON_ERROR_COUNT] times
@@ -182,11 +182,11 @@ module MailHandler
182
182
 
183
183
  when :since
184
184
 
185
- keys << 'SINCE' << Net::IMAP.format_datetime(options[:since])
185
+ keys << 'SINCE' << Net::IMAP.format_date(options[:since])
186
186
 
187
187
  when :before
188
188
 
189
- keys << 'BEFORE' << Net::IMAP.format_datetime(options[:before])
189
+ keys << 'BEFORE' << Net::IMAP.format_date(options[:before])
190
190
 
191
191
  else
192
192
 
@@ -2,13 +2,13 @@ module Mail
2
2
 
3
3
  class IMAP
4
4
 
5
- attr_accessor :imap
5
+ attr_accessor :imap_connection
6
6
 
7
- def find(options={}, &block)
7
+ def find_emails(options={}, &block)
8
8
 
9
9
  options = validate_options(options)
10
- options[:read_only] ? imap.examine(options[:mailbox]) : imap.select(options[:mailbox])
11
- uids = imap.uid_search(options[:keys])
10
+ options[:read_only] ? imap_connection.examine(options[:mailbox]) : imap_connection.select(options[:mailbox])
11
+ uids = imap_connection.uid_search(options[:keys])
12
12
 
13
13
  uids.reverse! if options[:what].to_sym == :last
14
14
  uids = uids.first(options[:count]) if options[:count].is_a?(Integer)
@@ -20,22 +20,22 @@ module Mail
20
20
  uids.each do |uid|
21
21
 
22
22
  uid = options[:uid].to_i unless options[:uid].nil?
23
- fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
23
+ fetchdata = imap_connection.uid_fetch(uid, ['RFC822'])[0]
24
24
  new_message = Mail.new(fetchdata.attr['RFC822'])
25
25
  new_message.mark_for_delete = true if options[:delete_after_find]
26
26
 
27
27
  if block.arity == 3
28
- yield new_message, imap, uid
28
+ yield new_message, imap_connection, uid
29
29
  else
30
30
  yield new_message
31
31
  end
32
32
 
33
- imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?
33
+ imap_connection.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find] && new_message.is_marked_for_delete?
34
34
  break unless options[:uid].nil?
35
35
 
36
36
  end
37
37
 
38
- imap.expunge if options[:delete_after_find]
38
+ imap_connection.expunge if options[:delete_after_find]
39
39
 
40
40
  else
41
41
 
@@ -44,14 +44,14 @@ module Mail
44
44
  uids.each do |uid|
45
45
 
46
46
  uid = options[:uid].to_i unless options[:uid].nil?
47
- fetchdata = imap.uid_fetch(uid, ['RFC822'])[0]
47
+ fetchdata = imap_connection.uid_fetch(uid, ['RFC822'])[0]
48
48
  emails << Mail.new(fetchdata.attr['RFC822'])
49
- imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find]
49
+ imap_connection.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED]) if options[:delete_after_find]
50
50
  break unless options[:uid].nil?
51
51
 
52
52
  end
53
53
 
54
- imap.expunge if options[:delete_after_find]
54
+ imap_connection.expunge if options[:delete_after_find]
55
55
  emails.size == 1 && options[:count] == 1 ? emails.first : emails
56
56
 
57
57
  end
@@ -61,23 +61,23 @@ module Mail
61
61
  # Start an IMAP session
62
62
  def connect(config=Mail::Configuration.instance)
63
63
 
64
- @imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)
64
+ @imap_connection = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)
65
65
 
66
66
  if settings[:authentication].nil?
67
- imap.login(settings[:user_name], settings[:password])
67
+ imap_connection.login(settings[:user_name], settings[:password])
68
68
  else
69
69
  # Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!
70
- # (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)
71
- imap.authenticate(settings[:authentication], settings[:user_name], settings[:password])
70
+ # (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap_connection/rdoc/classes/Net/IMAP.html#M000718)
71
+ imap_connection.authenticate(settings[:authentication], settings[:user_name], settings[:password])
72
72
  end
73
73
 
74
74
  end
75
75
 
76
76
  def disconnect
77
77
 
78
- if defined?(imap) && imap && !imap.disconnected?
78
+ if defined?(imap_connection) && imap_connection && !imap_connection.disconnected?
79
79
 
80
- imap.disconnect
80
+ imap_connection.disconnect
81
81
 
82
82
  end
83
83
 
@@ -1,5 +1,5 @@
1
1
  module MailHandler
2
2
 
3
- VERSION = '1.0.26'
3
+ VERSION = '1.0.27'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailhandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.26
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Balos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail