imap-backup 13.2.0 → 13.3.0

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
  SHA256:
3
- metadata.gz: 6ef98e7550571026f402c2fa7c82b37707be3c79ee23bd190dd091d234e9c9e7
4
- data.tar.gz: f2f7508af8f492cfd19972ba11e3ca651bc417f69b43dd5f78d511500f5373af
3
+ metadata.gz: 52be0d33c65e865c04931e81821a563e8203a001a951b8ec6624f0fded2180aa
4
+ data.tar.gz: 2fece56b157329aa6e8cd0bc73d66d5ec3c3923f126822977910dc904d955a1a
5
5
  SHA512:
6
- metadata.gz: 7d6bb21bffea6ac0c7dc70c073700fe532d3fe5492ad9fd54f668070b682b17e958c152f07e91807a3c5f6aa8e354c7cdb0ca188cd2398bccc16951b421d4ea0
7
- data.tar.gz: 2a1f679f55a047626cb85b2bd8b3b69cadbce20426af6ad278fab2f24758e379276575dc0149265b7783804da18f433731672cbaf34e0bf7c52ee38fa26a258e
6
+ metadata.gz: 26c0c0434bf7743a3ce9b8b6c0f24b05b14682f4e52fcacf4813cec7a913df720f6413a066b25db810e04d4e18411cfbd79119430f37785186b3013757a2e76d
7
+ data.tar.gz: 3f250c3272221488bb8b9c08b1f68198a1a6b3f45bd75c31ccc6b2284c0e2130d65bcd91783c6c85b65b4e1bbdbe09378a1ff15e595f8ab3ae016d2faeb53aee
@@ -52,10 +52,7 @@ module Imap::Backup
52
52
  end
53
53
 
54
54
  def clean_up
55
- if account.mirror_mode
56
- Logger.logger.info "Mirror mode - Deleting messages only present locally"
57
- LocalOnlyMessageDeleter.new(folder, serializer).run
58
- end
55
+ LocalOnlyMessageDeleter.new(folder, serializer).run if account.mirror_mode
59
56
  FlagRefresher.new(folder, serializer).run if account.mirror_mode || refresh
60
57
  end
61
58
 
@@ -1,3 +1,5 @@
1
+ require "imap/backup/logger"
2
+
1
3
  module Imap; end
2
4
 
3
5
  module Imap::Backup
@@ -15,7 +17,13 @@ module Imap::Backup
15
17
  # but that would require a garbage collection later.
16
18
  def run
17
19
  local_only_uids = serializer.uids - folder.uids
18
- return if local_only_uids.empty?
20
+ if local_only_uids.empty?
21
+ Logger.logger.debug "There are no 'local-only' messages to delete"
22
+ return
23
+ end
24
+
25
+ Logger.logger.info "Deleting messages only present locally"
26
+ Logger.logger.debug "Messages to be deleted: #{local_only_uids.inspect}"
19
27
 
20
28
  serializer.filter do |message|
21
29
  !local_only_uids.include?(message.uid)
@@ -26,6 +26,8 @@ module Imap::Backup
26
26
  block.call
27
27
 
28
28
  commit
29
+
30
+ serializer.reload
29
31
  end
30
32
  end
31
33
  end
@@ -62,9 +62,8 @@ module Imap::Backup
62
62
 
63
63
  def delete
64
64
  imap.delete
65
- @imap = nil
66
65
  mbox.delete
67
- @mbox = nil
66
+ reload
68
67
  end
69
68
 
70
69
  def apply_uid_validity(value)
@@ -130,8 +129,7 @@ module Imap::Backup
130
129
  new_imap.rename imap.folder_path
131
130
  mbox.delete
132
131
  new_mbox.rename mbox.folder_path
133
- @imap = nil
134
- @mbox = nil
132
+ reload
135
133
  end
136
134
 
137
135
  def folder_path
@@ -142,6 +140,11 @@ module Imap::Backup
142
140
  @sanitized ||= Naming.to_local_path(folder)
143
141
  end
144
142
 
143
+ def reload
144
+ @imap = nil
145
+ @mbox = nil
146
+ end
147
+
145
148
  private
146
149
 
147
150
  def rename(new_name)
@@ -2,7 +2,7 @@ module Imap; end
2
2
 
3
3
  module Imap::Backup
4
4
  MAJOR = 13
5
- MINOR = 2
5
+ MINOR = 3
6
6
  REVISION = 0
7
7
  PRE = nil
8
8
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.0
4
+ version: 13.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates