clacks 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWM1MmUwNDEzYTU0NmY0M2FlZWVkODUxN2U1MGUyYWEwZTI0NWQ2Zg==
4
+ ODk1Y2ZlZDEzYTUwMTUwNTUyODEwM2ZmM2JiMDY2MmRiOTRiZjQ5OA==
5
5
  data.tar.gz: !binary |-
6
- ZjI2OTQ4ZTBkYjNhMjU5MjExMDFjMzk5OWQyMzk2NDFjNzA1N2E4OA==
6
+ NjhlNDZlMjA1YjIxOGYzMjVlYzBmNjcyYzU1NGE1MmFhOGJmMjk5ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDZiZjU5MGViYTY1MzUzZjNiZTEzOTk0MmE4NDljNWZjMjVjNDc4ZTVmMGI4
10
- ZjNlMDE1OTBiZmRiMDE5MzAxNTMwNjRkM2FkZTVlYjQzMjZjMmYzODU3Y2Ix
11
- ZGFhMDAyYjZmZmQ5YmJiMDE3YmM0YzAxMTk5MDI4ZDYxNjViMDE=
9
+ MTgzZTU3MTgzMjUyMWM4NzVhMGE4ZTNhYjA3YTVkYTg0YTg0NjQzOWFkMGM3
10
+ ZDAwOTA4YjJhNTEzNjlkMWVhMjUxZDE3ZTIyNTQzOTg5ODY1ZTc2NjE1Y2Iy
11
+ MDZlNjVhMjUzODM4YTQ2N2QwNTc5ZDhmZTk2NmZiNjk4ZjA4NDc=
12
12
  data.tar.gz: !binary |-
13
- ZWZlMDZmYTM3MTZjMGFmNjQ2YmRlNWNiYzQ1YzkwNDhjZjM1NGJhYTk4MjZk
14
- NzVhMzdiNzE2YmQ5MjY1N2E3MzQ3MzMyYmYxYjNhZDYzNDg0N2ZlYTk3MWY3
15
- MjhlYTUxMjcyYzZlYmMzNWQxM2JkMTZjZjM0ZTE2OGFkZDJkMmM=
13
+ ZDBjZjQ2ZTM1MGU1MzgzZTZmNGVkN2IyNTJmYzViZTIzZThiOTMzYjc1ZGU4
14
+ NGZhNzBlMWIxYzcwNzQyZTJhZWU0OGI3MzlkMDRiOWJkNTA1Y2I1NDM1MDky
15
+ NzVlMjhhZmZjODA0MDUxNzJlYmU3MTEyNmQ4MTVlYWEwN2YwMTE=
@@ -127,6 +127,7 @@ module Clacks
127
127
  # or until a QUIT signal is received to stop the process.
128
128
  def imap_find(imap)
129
129
  options = Clacks.config[:find_options]
130
+ delete_after_find = options[:delete_after_find]
130
131
  begin
131
132
  break if stopping?
132
133
  uids = imap.uid_search(options[:keys] || 'ALL')
@@ -135,14 +136,14 @@ module Clacks
135
136
  uids.reverse! if (options[:what].to_sym == :last && options[:order].to_sym == :asc) ||
136
137
  (options[:what].to_sym != :last && options[:order].to_sym == :desc)
137
138
  processed = 0
139
+ expunge = false
138
140
  uids.each do |uid|
139
141
  break if stopping?
140
142
  source = imap.uid_fetch(uid, ['RFC822']).first.attr['RFC822']
141
- break if stopping?
142
143
  mail = nil
143
144
  begin
144
145
  mail = Mail.new(source)
145
- mail.mark_for_delete = true if options[:delete_after_find]
146
+ mail.mark_for_delete = true if delete_after_find
146
147
  Clacks.config[:on_mail].call(mail)
147
148
  rescue Exception => e
148
149
  Clacks.logger.debug(e.message)
@@ -150,7 +151,8 @@ module Clacks
150
151
  end
151
152
  begin
152
153
  imap.uid_copy(uid, options[:archivebox]) if options[:archivebox]
153
- if options[:delete_after_find] && (mail.nil? || mail.is_marked_for_delete?)
154
+ if delete_after_find && (mail.nil? || mail.is_marked_for_delete?)
155
+ expunge = true
154
156
  imap.uid_store(uid, "+FLAGS", [Net::IMAP::DELETED])
155
157
  end
156
158
  rescue Exception => e
@@ -158,7 +160,7 @@ module Clacks
158
160
  end
159
161
  processed += 1
160
162
  end
161
- imap.expunge if options[:delete_after_find]
163
+ imap.expunge if expunge
162
164
  end while uids.any? && processed == uids.length
163
165
  end
164
166
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: binary -*-
2
2
  module Clacks
3
- VERSION = '1.0.5'
3
+ VERSION = '1.0.6'
4
4
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: clacks
3
3
  version: !ruby/object:Gem::Version
4
4
  version: !binary |-
5
- MS4wLjU=
5
+ MS4wLjY=
6
6
  platform: ruby
7
7
  authors:
8
8
  - ITRP
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-16 00:00:00.000000000 Z
12
+ date: 2014-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail