imap_processor 1.6 → 1.7

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
- SHA1:
3
- metadata.gz: 64ddb04b56787b6fdcd6c727755411b21e46282a
4
- data.tar.gz: 5db3b017a08a2852bccb113c69b558f0ebc532b8
2
+ SHA256:
3
+ metadata.gz: 632f5afa32e055708809e6817e2532f5a5f880b48d9bb808102e63e2bad6cff7
4
+ data.tar.gz: 145bf8485b69a4629b32b12748edc780899db542e6a180db88a61ee6fc93ba56
5
5
  SHA512:
6
- metadata.gz: 3499a98406aa2074a826972c2584cd652b6761ece82daa183fca355ceb78e0c04dcf3628fdf716dcf9fd96ac569ba7b17606524ae0b3fb271158dd7a226cbed7
7
- data.tar.gz: c623f510ff4b5644d4ae19624c355542602c5c0fee3d00397e5496936729e332ed97f4adafe4f23457f6623caed4edec60c1b142d5fe1cf4961416a417df762e
6
+ metadata.gz: e1c5b332b9d8e3dbb9f105d888cb796a1e901633f40147a241ed2ac0ec7f63664f8a9b78a0eed149d8653eace16de68190d2737462294192ecaaa0bf331d1746
7
+ data.tar.gz: 5561900484e14b7fe02508402af345a07a8999c56b2fdf05dd91989698b4b5a87bdd9f09acebf84232e7505b3a9ce8e57e8e9fc42041567555cf889592ec055c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,17 @@
1
+ === 1.7 / 2020-06-04
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Added #noop? to improve readability.
6
+ * Documented how to use this with gmail.
7
+ * Improved imap_archive output by distinguishing hosts.
8
+ * Improved show_messages output to be cleaner and have better info (from/to).
9
+
10
+ * 2 bug fixes:
11
+
12
+ * Fixed --noop by covering all imap calls that modify w/ checks.
13
+ * Fixed option processing with multiple accounts by dup'ing args to OptionParser.
14
+
1
15
  === 1.6 / 2014-10-17
2
16
 
3
17
  * 1 minor enhancement:
@@ -30,6 +30,27 @@ imap_mkdir :: Ensures that certain mailboxes exist.
30
30
 
31
31
  Run any command with --help for details.
32
32
 
33
+ == Google Mail:
34
+
35
+ This is kinda painful. You need to have Two Factor Authentication
36
+ enabled with google, then you need to create an app specific password
37
+ as described here: https://support.google.com/accounts/answer/185833
38
+
39
+ Then, your config needs to be set up like this:
40
+
41
+ - :Host: imap.googlemail.com
42
+ :SSL: true
43
+ :Auth: PLAIN
44
+ :Username: your.address@gmail.com
45
+ :Password: app-specific-password
46
+
47
+ Specifically, you need to set auth to PLAIN, and your password needs
48
+ to your app specific password. Run with --debug to help figure
49
+ problems out.
50
+
51
+ Google is threatening to turn this off at some point and require
52
+ oauth... at which point... I have no idea. I give up I guess.
53
+
33
54
  == REQUIREMENTS:
34
55
 
35
56
  * IMAP server
@@ -26,7 +26,7 @@ class IMAPProcessor
26
26
  ##
27
27
  # The version of IMAPProcessor you are using
28
28
 
29
- VERSION = "1.6"
29
+ VERSION = "1.7"
30
30
 
31
31
  ##
32
32
  # Base IMAPProcessor error class
@@ -137,8 +137,7 @@ class IMAPProcessor
137
137
  exit 1
138
138
  end
139
139
 
140
- defaults = YAML.load_file(opts_file)
141
- defaults = [defaults] unless Array === defaults
140
+ defaults = Array(YAML.load_file(opts_file))
142
141
  end
143
142
 
144
143
  defaults.map { |default|
@@ -285,7 +284,7 @@ Example ~/.#{@@opts_file_name}:
285
284
 
286
285
  end # OptionParser.new do
287
286
 
288
- op.parse! args
287
+ op.parse! args.dup
289
288
 
290
289
  options[:Port] ||= options[:SSL] ? 993 : 143
291
290
 
@@ -425,7 +424,7 @@ Example ~/.#{@@opts_file_name}:
425
424
  list = imap.list '', name
426
425
  return if list
427
426
  log "CREATE #{name}"
428
- imap.create name
427
+ imap.create name unless noop?
429
428
  end
430
429
 
431
430
  ##
@@ -433,10 +432,10 @@ Example ~/.#{@@opts_file_name}:
433
432
 
434
433
  def delete_messages uids, expunge = true
435
434
  log "DELETING [...#{uids.size} uids]"
436
- imap.store uids, '+FLAGS.SILENT', [:Deleted]
435
+ imap.store uids, '+FLAGS.SILENT', [:Deleted] unless noop?
437
436
  if expunge then
438
437
  log "EXPUNGE"
439
- imap.expunge
438
+ imap.expunge unless noop?
440
439
  end
441
440
  end
442
441
 
@@ -554,12 +553,12 @@ Example ~/.#{@@opts_file_name}:
554
553
  log "COPY [...#{uids.size} uids]"
555
554
 
556
555
  begin
557
- imap.copy uids, destination
556
+ imap.copy uids, destination unless noop?
558
557
  rescue Net::IMAP::NoResponseError
559
- # ruby-lang bug #1713
560
- #raise unless e.response.data.code.name == 'TRYCREATE'
561
- create_mailbox destination
562
- imap.copy uids, destination
558
+ unless noop? then
559
+ create_mailbox destination
560
+ imap.copy uids, destination
561
+ end
563
562
  end
564
563
 
565
564
  delete_messages uids, expunge
@@ -571,12 +570,14 @@ Example ~/.#{@@opts_file_name}:
571
570
  def show_messages(uids)
572
571
  return if uids.nil? or (Array === uids and uids.empty?)
573
572
 
574
- fetch_data = 'BODY.PEEK[HEADER.FIELDS (DATE SUBJECT MESSAGE-ID)]'
573
+ fetch_data = 'BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT)]'
575
574
  messages = imap.fetch uids, fetch_data
576
575
  fetch_data.sub! '.PEEK', '' # stripped by server
577
576
 
577
+ messages ||= []
578
+
578
579
  messages.each do |res|
579
- puts res.attr[fetch_data].delete("\r")
580
+ puts res.attr[fetch_data].delete("\r").gsub(/^/, " ")
580
581
  end
581
582
  end
582
583
 
@@ -587,4 +588,10 @@ Example ~/.#{@@opts_file_name}:
587
588
  @verbose
588
589
  end
589
590
 
591
+ ##
592
+ # Did the user set --noop?
593
+
594
+ def noop?
595
+ options[:Noop]
596
+ end
590
597
  end
@@ -43,6 +43,8 @@ imap_archive archives old mail on IMAP server by moving it to dated mailboxen.
43
43
  def initialize(options)
44
44
  super
45
45
 
46
+ puts "Archiving #{options[:Host]}"
47
+
46
48
  @list = options[:List]
47
49
  @move = options[:Move]
48
50
  @sep = options[:Sep] || '.'
@@ -99,7 +101,7 @@ imap_archive archives old mail on IMAP server by moving it to dated mailboxen.
99
101
  end
100
102
 
101
103
  log "EXPUNGE"
102
- imap.expunge
104
+ imap.expunge unless noop?
103
105
  end
104
106
  end
105
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap_processor
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.6'
4
+ version: '1.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -11,9 +11,9 @@ bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
+ MIIDPjCCAiagAwIBAgIBBDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
15
15
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
16
- GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
16
+ GRYDY29tMB4XDTE5MTIxMzAwMDIwNFoXDTIwMTIxMjAwMDIwNFowRTETMBEGA1UE
17
17
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
18
18
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
19
19
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,58 +22,50 @@ cert_chain:
22
22
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
23
23
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
24
24
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
25
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
26
- AQAFoDJRokCQdxFfOrmsKX41KOFlU/zjrbDVM9hgB/Ur999M6OXGSi8FitXNtMwY
27
- FVjsiAPeU7HaWVVcZkj6IhINelTkXsxgGz/qCzjHy3iUMuZWw36cS0fiWJ5rvH+e
28
- hD7uXxJSFuyf1riDGI1aeWbQ74WMwvNstOxLUMiV5a1fzBhlxPqb537ubDjq/M/h
29
- zPUFPVYeL5KjDHLCqI2FwIk2sEMOQgjpXHzl+3NlD2LUgUhHDMevmgVua0e2GT1B
30
- xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
31
- VpzF30vNaJK6ZT7xlIsIlwmH
25
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
26
+ AQCkkcHqAa6IKLYGl93rn78J3L+LnqyxaA059n4IGMHWN5bv9KBQnIjOrpLadtYZ
27
+ vhWkunWDKdfVapBEq5+T4HzqnsEXC3aCv6JEKJY6Zw7iSzl0M8hozuzRr+w46wvT
28
+ fV2yTN6QTVxqbMsJJyjosks4ZdQYov2zdvQpt1HsLi+Qmckmg8SPZsd+T8uiiBCf
29
+ b+1ORSM5eEfBQenPXy83LZcoQz8i6zVB4aAfTGGdhxjoMGUEmSZ6xpkOzmnGa9QK
30
+ m5x9IDiApM+vCELNwDXXGNFEnQBBK+wAe4Pek8o1V1TTOxL1kGPewVOitX1p3xoN
31
+ h7iEjga8iM1LbZUfiISZ+WrB
32
32
  -----END CERTIFICATE-----
33
- date: 2014-10-17 00:00:00.000000000 Z
33
+ date: 2020-06-04 00:00:00.000000000 Z
34
34
  dependencies:
35
- - !ruby/object:Gem::Dependency
36
- name: minitest
37
- requirement: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: '5.4'
42
- type: :development
43
- prerelease: false
44
- version_requirements: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ~>
47
- - !ruby/object:Gem::Version
48
- version: '5.4'
49
35
  - !ruby/object:Gem::Dependency
50
36
  name: rdoc
51
37
  requirement: !ruby/object:Gem::Requirement
52
38
  requirements:
53
- - - ~>
39
+ - - ">="
54
40
  - !ruby/object:Gem::Version
55
41
  version: '4.0'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '7'
56
45
  type: :development
57
46
  prerelease: false
58
47
  version_requirements: !ruby/object:Gem::Requirement
59
48
  requirements:
60
- - - ~>
49
+ - - ">="
61
50
  - !ruby/object:Gem::Version
62
51
  version: '4.0'
52
+ - - "<"
53
+ - !ruby/object:Gem::Version
54
+ version: '7'
63
55
  - !ruby/object:Gem::Dependency
64
56
  name: hoe
65
57
  requirement: !ruby/object:Gem::Requirement
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: '3.13'
61
+ version: '3.22'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
65
  requirements:
74
- - - ~>
66
+ - - "~>"
75
67
  - !ruby/object:Gem::Version
76
- version: '3.13'
68
+ version: '3.22'
77
69
  description: |-
78
70
  IMAPProcessor is a client for processing messages on an IMAP server. It
79
71
  provides some basic mechanisms for connecting to an IMAP server, determining
@@ -106,8 +98,7 @@ extra_rdoc_files:
106
98
  - Manifest.txt
107
99
  - README.rdoc
108
100
  files:
109
- - .autotest
110
- - .gemtest
101
+ - ".autotest"
111
102
  - History.rdoc
112
103
  - Manifest.txt
113
104
  - README.rdoc
@@ -135,28 +126,27 @@ files:
135
126
  homepage: https://github.com/seattlerb/imap_processor
136
127
  licenses:
137
128
  - MIT
138
- metadata: {}
129
+ metadata:
130
+ homepage_uri: https://github.com/seattlerb/imap_processor
139
131
  post_install_message:
140
132
  rdoc_options:
141
- - --main
133
+ - "--main"
142
134
  - README.rdoc
143
135
  require_paths:
144
136
  - lib
145
137
  required_ruby_version: !ruby/object:Gem::Requirement
146
138
  requirements:
147
- - - '>='
139
+ - - ">="
148
140
  - !ruby/object:Gem::Version
149
141
  version: '0'
150
142
  required_rubygems_version: !ruby/object:Gem::Requirement
151
143
  requirements:
152
- - - '>='
144
+ - - ">="
153
145
  - !ruby/object:Gem::Version
154
146
  version: '0'
155
147
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.4.1
148
+ rubygems_version: 3.0.3
158
149
  signing_key:
159
150
  specification_version: 4
160
151
  summary: IMAPProcessor is a client for processing messages on an IMAP server
161
- test_files:
162
- - test/test_imap_processor.rb
152
+ test_files: []
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes