imap-backup 6.1.0 → 6.2.1

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: 2a05fedc57275cadd2a1bd22efbe88ef5ec6ee72843400499cac8b8df8e80c35
4
- data.tar.gz: f0e8e859b5fb1bb8480730b3ea62abc7470f5d0ddb469113bbdac0e4f2a88d1a
3
+ metadata.gz: c0d36730de07aa607526d3a37dc985089fa0ab41418e811edee58b7e88ba2762
4
+ data.tar.gz: e91d2b8f28ebd05a8b15f9e34c1b52648a937237b44e6eeee093e7996bf1232c
5
5
  SHA512:
6
- metadata.gz: bfb4de1a3048a9f29ee30fb56c7493524a7d688a6eab2ec3307005ba3c8d341a99c961acd1d8f588384dc91571b4528482931e52724df42dff19a26553568fb0
7
- data.tar.gz: a411ad26b4ce3eb631c97d94c9242c1eb48fd57d23cffcec84f5c829d9354b506115b6c8278ee38430e27f0d6ca1400d55f74adce5eb99f94db2963f235c6d7a
6
+ metadata.gz: 9af9e727577ad646f44b9fbae4d3e0d0f0f6cd9712f9d53e95f07b443c7eb87e99958c083416fc87c2000606936422b5ce9413578326673663390cac6ba2c11a
7
+ data.tar.gz: 176f00ebb3325900e040734599a7be3b9f6c9141c11ff358cd85bc70baf094c00b1d2753d7f2136b715d4839b0fa7bb84d237104f9b96df51b73dafd33e35b2f
@@ -39,7 +39,14 @@ module Imap::Backup
39
39
  client
40
40
  ensure_account_folder
41
41
  each_folder do |folder, serializer|
42
- next if !folder.exist?
42
+ begin
43
+ next if !folder.exist?
44
+ rescue Encoding::UndefinedConversionError
45
+ message = "Skipping backup for '#{folder.name}' " \
46
+ "as it is not UTF-7 encoded correctly"
47
+ Logger.logger.info message
48
+ next
49
+ end
43
50
 
44
51
  Logger.logger.debug "[#{folder.name}] running backup"
45
52
  serializer.apply_uid_validity(folder.uid_validity)
@@ -7,14 +7,16 @@ module Imap::Backup
7
7
  class Client::Default
8
8
  extend Forwardable
9
9
  def_delegators :imap, *%i(
10
- append authenticate create disconnect examine expunge
11
- login responses select uid_fetch uid_search uid_store
10
+ append authenticate create expunge login
11
+ responses uid_fetch uid_search uid_store
12
12
  )
13
13
 
14
14
  attr_reader :args
15
+ attr_accessor :state
15
16
 
16
17
  def initialize(*args)
17
18
  @args = args
19
+ @state = nil
18
20
  end
19
21
 
20
22
  def list
@@ -26,6 +28,28 @@ module Imap::Backup
26
28
  mailbox_lists.map { |ml| extract_name(ml) }
27
29
  end
28
30
 
31
+ # Track mailbox selection during delegation to Net::IMAP instance
32
+
33
+ def disconnect
34
+ imap.disconnect
35
+ self.state = nil
36
+ end
37
+
38
+ def examine(mailbox)
39
+ return if state == [:examine, mailbox]
40
+
41
+ result = imap.examine(mailbox)
42
+ self.state = [:examine, mailbox]
43
+ result
44
+ end
45
+
46
+ def select(mailbox)
47
+ return if state == [:select, mailbox]
48
+
49
+ imap.select(mailbox)
50
+ self.state = [:select, mailbox]
51
+ end
52
+
29
53
  private
30
54
 
31
55
  def imap
@@ -24,7 +24,11 @@ module Imap::Backup
24
24
  "#{log_prefix} #{message.supplied_body.size} bytes"
25
25
  )
26
26
 
27
- folder.append(message)
27
+ begin
28
+ folder.append(message)
29
+ rescue StandardError => e
30
+ Logger.logger.warn "#{log_prefix} append error: #{e}"
31
+ end
28
32
  end
29
33
  end
30
34
 
@@ -2,8 +2,8 @@ module Imap; end
2
2
 
3
3
  module Imap::Backup
4
4
  MAJOR = 6
5
- MINOR = 1
6
- REVISION = 0
5
+ MINOR = 2
6
+ REVISION = 1
7
7
  PRE = nil
8
8
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline