imap-backup 4.2.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/imap/backup/downloader.rb +23 -9
- data/lib/imap/backup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a03b28188aede7ee27bb741e32a40619a2fe58090631a6341eba5cffc2cefe4
|
4
|
+
data.tar.gz: d50ac5b602aa86f150846dc925962f727e1e0bcb830113eace96cec1038833e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b95c61e9f505d63274ba73e50bc7e15cc44b9391e8fc1bc3cc8a70bfb59dd11c43bc41fe0334c70f089ccf15a5890c9ae9d3fe4631062a085a753836fd8f4a
|
7
|
+
data.tar.gz: a8657ca4282ea0a6e0037c6dc687265a23f2e0af16146900de9665aaf6a03f118d0895a33ee89a2dc788f0bb358b3651b90ddaf721ba588a949b92acd975781c
|
@@ -13,31 +13,45 @@ module Imap::Backup
|
|
13
13
|
def run
|
14
14
|
uids = folder.uids - serializer.uids
|
15
15
|
count = uids.count
|
16
|
-
|
16
|
+
debug "#{count} new messages"
|
17
17
|
uids.each_slice(block_size).with_index do |block, i|
|
18
|
-
offset = i * block_size + 1
|
19
18
|
uids_and_bodies = folder.fetch_multi(block)
|
20
19
|
if uids_and_bodies.nil?
|
21
20
|
if block_size > 1
|
22
|
-
|
21
|
+
debug("Multi fetch failed for UIDs #{block.join(", ")}, switching to single fetches")
|
23
22
|
@block_size = 1
|
24
23
|
redo
|
25
24
|
else
|
26
|
-
|
25
|
+
debug("Fetch failed for UID #{block[0]} - skipping")
|
27
26
|
next
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
30
|
+
offset = i * block_size + 1
|
31
31
|
uids_and_bodies.each.with_index do |uid_and_body, j|
|
32
32
|
uid = uid_and_body[:uid]
|
33
33
|
body = uid_and_body[:body]
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
case
|
35
|
+
when !body
|
36
|
+
info("Fetch returned empty body - skipping")
|
37
|
+
when !uid
|
38
|
+
info("Fetch returned empty UID - skipping")
|
39
|
+
else
|
40
|
+
debug("uid: #{uid} (#{offset + j}/#{count}) - #{body.size} bytes")
|
41
|
+
serializer.save(uid, body)
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def info(message)
|
50
|
+
Imap::Backup::Logger.logger.info("[#{folder.name}] #{message}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def debug(message)
|
54
|
+
Imap::Backup::Logger.logger.debug("[#{folder.name}] #{message}")
|
55
|
+
end
|
42
56
|
end
|
43
57
|
end
|
data/lib/imap/backup/version.rb
CHANGED
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: 4.2.
|
4
|
+
version: 4.2.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-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|