imap-backup 8.0.0 → 8.0.2

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: ccb9808337c50af0fe59f2cdc85dedcbab50b5b0980a60e2ccf10fc3734b9f37
4
- data.tar.gz: e0b67bd5bfb040220f54c9a662c90ad545fce9c84a5fadaf6d93a485ac865ffc
3
+ metadata.gz: 31b3a3ccf051c6496e8b4fde5eb0b062927fc8a0cb0c605dd597bc1289dd77e1
4
+ data.tar.gz: f7a7a88cb51f2ebe01e5debd4a25df4df8adf4ee1a5fd2480532c948d51e382b
5
5
  SHA512:
6
- metadata.gz: 4070e85e86a627a0791924cba209d044dd71fd54a7d0d79a7c34b9aade4d4827ae020ed3a78d5e4169d0d8aa188ce34741f5a6a44d4f0ae1b035e6bbead30df8
7
- data.tar.gz: b20ac83f5bffea68ab4dd3ae12fcef6df78cb20aab136864ba97e23ddaa414fe344e122d430bf1de242e393e50ccef916ee4e1fba77353836aee9e148c5a3da8
6
+ metadata.gz: 47377d324d8a4f4bf0853ac12f6e972107bbb2d215f4916bd5a6ec301870ef6fad2eb646325dba127dd7bb8ca02f6abe72d2bfeccc139bac87c9df38a55d498a
7
+ data.tar.gz: 2a07b644b145263f41394f2f96590a0003381911389238f242f973236828ded448c169ed043ec7453d8bd0acc942ecb3d210e298b46d975c08b015794b7f4445
data/README.md CHANGED
@@ -7,18 +7,20 @@
7
7
 
8
8
  Backup, restore and migrate email accounts.
9
9
 
10
- The backups can then be restored, used to migrate to another service,
11
- inspected or exported.
10
+ # Modes
12
11
 
13
- * [Source Code]
14
- * [Code Documentation]
15
- * [Rubygem]
16
- * [CI Status]
12
+ There are two types of backups:
17
13
 
18
- [Source Code]: https://github.com/joeyates/imap-backup "Source code at GitHub"
19
- [Code Documentation]: https://rubydoc.info/gems/imap-backup/frames "Code Documentation at Rubydoc.info"
20
- [Rubygem]: https://rubygems.org/gems/imap-backup "Ruby gem at rubygems.org"
21
- [CI Status]: https://github.com/joeyates/imap-backup/actions/workflows/main.yml
14
+ * Keep all (the default) - progressively saves a local copy of all emails,
15
+ * Mirror - adds and deletes emails from the local copy to keep it up to date with the account.
16
+
17
+ # What You Can Do with a Backup
18
+
19
+ * Migrate - use the local copy to populate emails on another account. This is a once-only action that deletes any existing emails on the destination account.
20
+ * Mirror - make a destination account match the local copy. This action can be repeated.
21
+ * Restore - push the local copy back to the original account.
22
+
23
+ See below for a [full list of commands](#Commands).
22
24
 
23
25
  # Installation
24
26
 
@@ -67,6 +69,9 @@ imap-backup
67
69
 
68
70
  Alternatively, add it to your crontab.
69
71
 
72
+ Backups can also be inspected, for example via [local show](docs/commands/local-show.md)
73
+ and exported via [utils export-to-thunderbird](docs/commands/utils-export-to-thunderbird.md).
74
+
70
75
  # Commands
71
76
 
72
77
  * [backup](docs/commands/backup.md)
@@ -99,7 +104,7 @@ imap-backup help COMMAND
99
104
  If you have problems:
100
105
 
101
106
  1. ensure that you have the latest release,
102
- 2. turn on debugging output via the `imap-backup setup` main menu.
107
+ 2. run `imap-backup` with the `-v` or `--verbose` parameter.
103
108
 
104
109
  # Development
105
110
 
@@ -108,3 +113,13 @@ on development and testing.
108
113
 
109
114
  See [the CHANGELOG](./CHANGELOG.md) to a list of changes that have been
110
115
  made in each release.
116
+
117
+ * [Source Code]
118
+ * [Code Documentation]
119
+ * [Rubygem]
120
+ * [CI Status]
121
+
122
+ [Source Code]: https://github.com/joeyates/imap-backup "Source code at GitHub"
123
+ [Code Documentation]: https://rubydoc.info/gems/imap-backup/frames "Code Documentation at Rubydoc.info"
124
+ [Rubygem]: https://rubygems.org/gems/imap-backup "Ruby gem at rubygems.org"
125
+ [CI Status]: https://github.com/joeyates/imap-backup/actions/workflows/main.yml
data/imap-backup.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |gem|
22
22
  gem.required_ruby_version = ">= 2.6"
23
23
 
24
24
  gem.add_runtime_dependency "highline"
25
- gem.add_runtime_dependency "mail"
26
- gem.add_runtime_dependency "net-imap"
25
+ gem.add_runtime_dependency "mail", "2.7.1"
26
+ gem.add_runtime_dependency "net-imap", ">= 0.3.2"
27
27
  gem.add_runtime_dependency "net-smtp"
28
28
  gem.add_runtime_dependency "os"
29
29
  gem.add_runtime_dependency "rake"
@@ -14,6 +14,7 @@ module Imap::Backup
14
14
  BODY_ATTRIBUTE = "BODY[]".freeze
15
15
  UID_FETCH_RETRY_CLASSES = [EOFError, Errno::ECONNRESET, IOError].freeze
16
16
  APPEND_RETRY_CLASSES = [Net::IMAP::BadResponseError].freeze
17
+ PERMITTED_FLAGS = %i(Answered Draft Flagged Seen).freeze
17
18
 
18
19
  attr_reader :connection
19
20
  attr_reader :name
@@ -93,8 +94,10 @@ module Imap::Backup
93
94
  def append(message)
94
95
  body = message.imap_body
95
96
  date = message.date&.to_time
97
+ flags = message.flags & PERMITTED_FLAGS
96
98
  retry_on_error(errors: APPEND_RETRY_CLASSES, limit: 3) do
97
- response = client.append(utf7_encoded_name, body, message.flags, date)
99
+ response = client.append(utf7_encoded_name, body, flags, date)
100
+ flags = message.flags & PERMITTED_FLAGS
98
101
  extract_uid(response)
99
102
  end
100
103
  end
@@ -151,8 +154,9 @@ module Imap::Backup
151
154
  end
152
155
 
153
156
  def extract_uid(response)
154
- @uid_validity, uid = response.data.code.data.split.map(&:to_i)
155
- uid
157
+ uid_data = response.data.code.data
158
+ @uid_validity = uid_data.uidvalidity
159
+ uid_data.assigned_uids.first
156
160
  end
157
161
 
158
162
  def utf7_encoded_name
@@ -3,7 +3,7 @@ module Imap; end
3
3
  module Imap::Backup
4
4
  MAJOR = 8
5
5
  MINOR = 0
6
- REVISION = 0
6
+ REVISION = 2
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: 8.0.0
4
+ version: 8.0.2
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-09-24 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: mail
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.7.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.7.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-imap
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.3.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.3.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: net-smtp
57
57
  requirement: !ruby/object:Gem::Requirement