glima 0.3.2 → 0.3.4

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: 0260fea2c5f1589c7ea8cf305e1f77c724be667a
4
- data.tar.gz: f6cc75417943bb19e01050dace7ac9af881962f8
2
+ SHA256:
3
+ metadata.gz: '08854b91e0b23bbfce1c8fc40829f08d453a00cd88f09e6f9adc75d5331aaa8e'
4
+ data.tar.gz: 247805256813dc79296ecad119b6df8ac9bf3f56367d6a26bed0c592b0eb5af7
5
5
  SHA512:
6
- metadata.gz: 7249a0885cbcf95760e7204adbbf90c5f7a4b99dcd4e512110c358aa7cef23929b90e88d6366ac11339716e870741d5b489473bb499cc3fb0998cfe03daed75b
7
- data.tar.gz: f745b82e4aa88c6e7493a9e47573cf03b035cd760ae7d6f22942e973c00593834a1ef9e75e5223f0667a10c64511310c62995decb72bd02df0af8b0aca78f88a
6
+ metadata.gz: fc529c58b3698d2c9742e49c213ea519b4d78c279015faa8fd60e55cd9a6d3323c5efd9201acef756210bd7cdc12bd94098f4fc35a1af116fa76d889fe5607af
7
+ data.tar.gz: 5793d948551f163f56b17a22f6399c2d9cd84af24d775e394d9b7ae9a3b85092d22e3b01634f485375b59537386a48498c0b693577a7a645062b3b570cd31705
data/README.org CHANGED
@@ -99,6 +99,33 @@
99
99
  :
100
100
  #+END_SRC
101
101
 
102
+ * Usage
103
+ #+begin_src example
104
+ GLIMA commands:
105
+ glima auth # Authenticate interactively
106
+ glima dezip MSGID DIRECTORY # Decrypt zip found in MSGID to DIRECTORY
107
+ glima events SINCE # List operation history SINCE.
108
+ glima guess MSGID # Guess labels to add to MSGID
109
+ glima help [COMMAND] # Describe available commands or one specific command
110
+ glima init # Create new config file
111
+ glima label MSGID # Add/Remove labels to/from MSGID
112
+ glima labels # List labels
113
+ glima open MSGID # Open article in browser by MSGID
114
+ glima profile # Show user's profile.
115
+ glima push EMAIL_FILE # Push EMAIL_FILE to INBOX
116
+ glima relabel SOURCE TARGET # Rename label SOURCE to TARGET.
117
+ glima scan +LABEL [QUERY] # Scan LABEL with QUERY.
118
+ glima show MSGID # Show article.
119
+ glima trash MSGID ... # Move messages to trash
120
+ glima version # Show version
121
+ glima watch QUEUE_LABEL MARK_LABEL # Watch gmail server and xzip.
122
+ glima xzip TARGET # Transform zip-attachments in TARGET and push back to Gmail.
123
+
124
+ Options:
125
+ [--profile], [--no-profile] # Set profiler flag
126
+ [--user=USER] # Set Gmail/IMAP account
127
+ #+end_src
128
+
102
129
  * Invoke decrypter from emacs mailer (Mew)
103
130
  Minimum setup: add belows in your .emacs:
104
131
  #+BEGIN_SRC emacs-lisp
data/exe/glima CHANGED
@@ -346,7 +346,7 @@ class GlimaCLI < Clian::Cli
346
346
  @client ||= Glima::GmailClient.new(config.general.client_id,
347
347
  config.general.client_secret,
348
348
  File.expand_path("token_store.yml", File.dirname(@config_path)),
349
- @user, @datastore, @logger)
349
+ @user, @datastore, @context, @logger)
350
350
 
351
351
  Glima::Command.client ||= @client
352
352
 
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_runtime_dependency "mail"
32
32
  spec.add_runtime_dependency "rubyzip"
33
33
 
34
- spec.add_development_dependency "bundler", "~> 1.11"
35
- spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "bundler", "~> 2.1"
35
+ spec.add_development_dependency "rake", ">= 12.3.3"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  end
@@ -5,7 +5,7 @@ module Glima
5
5
  def initialize(folder, format, search_or_range)
6
6
 
7
7
  index = 1
8
- client.scan_batch(folder, search_or_range) do |mail|
8
+ client.scan_batch(folder, search_or_range, true) do |mail|
9
9
  case format
10
10
  when :mew
11
11
  puts mail.format_mew(index)
@@ -35,7 +35,7 @@ module Glima
35
35
  # Users getProfile
36
36
  :get_user_profile
37
37
 
38
- attr_reader :user
38
+ attr_reader :user, :context
39
39
 
40
40
  # Find nearby messages from pivot_message
41
41
  # `Nearby' message:
@@ -45,9 +45,9 @@ module Glima
45
45
  def nearby_mails(pivot_mail)
46
46
  from = "from:#{pivot_mail.from}"
47
47
  date1 = (pivot_mail.date.to_date - 1).strftime("after:%Y/%m/%d")
48
- date2 = (pivot_mail.date.to_date + 1).strftime("before:%Y/%m/%d")
48
+ date2 = (pivot_mail.date.to_date + 2).strftime("before:%Y/%m/%d")
49
49
  query = "#{from} -in:trash #{date1} #{date2}"
50
- scan_batch("+all", query) do |mail|
50
+ scan_batch("+all", query, false) do |mail|
51
51
  next if pivot_mail.id == mail.id
52
52
  yield mail
53
53
  end
@@ -85,12 +85,13 @@ module Glima
85
85
  }.map(&:addr).map(&:ip_address).length > 0
86
86
  end
87
87
 
88
- def initialize(client_id, client_secret, token_store_path, user, datastore, logger = nil)
88
+ def initialize(client_id, client_secret, token_store_path, user, datastore, context, logger = nil)
89
89
  @client_id = client_id
90
90
  @client_secret = client_secret
91
91
  @token_store_path = token_store_path
92
92
  @user = user
93
93
  @datastore = datastore
94
+ @context = context
94
95
  @client = Google::Apis::GmailV1::GmailService.new
95
96
  @client.client_options.application_name = 'glima'
96
97
  if logger
@@ -180,8 +181,8 @@ module Glima
180
181
  end
181
182
  end
182
183
 
183
- def scan_batch(folder, search_or_range = nil, &block)
184
- qp = Glima::QueryParameter.new(folder, search_or_range)
184
+ def scan_batch(folder, search_or_range = nil, update_context = true, &block)
185
+ qp = Glima::QueryParameter.new(folder, search_or_range, context)
185
186
  list_user_messages(me, qp.to_hash) do |res, error|
186
187
  fail "#{error}" if error
187
188
  ids = (res.messages || []).map(&:id)
@@ -189,7 +190,7 @@ module Glima
189
190
  batch_on_messages(ids) do |message|
190
191
  yield Glima::Resource::Mail.new(message) if block
191
192
  end
192
- # context.save_page_token(res.next_page_token)
193
+ context.save_page_token(res.next_page_token) if update_context
193
194
  end
194
195
  end
195
196
  rescue Glima::QueryParameter::FormatError => e
@@ -1,3 +1,3 @@
1
1
  module Glima
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -6,7 +6,7 @@ module Glima
6
6
  attr_accessor :password
7
7
 
8
8
  def self.read(zip_filename, password = "")
9
- new(File.open(File.expand_path(zip_file)).read, password)
9
+ new(File.open(File.expand_path(zip_filename)).read, password)
10
10
  end
11
11
 
12
12
  def initialize(zip_string, password = "")
@@ -113,7 +113,13 @@ module Glima
113
113
  end
114
114
 
115
115
  def with_input_stream(password = "", &block)
116
- ::Zip::InputStream.open(StringIO.new(@zip_string), 0, decrypter(password)) do |zis|
116
+ # I have to read entire content of @zip_string to avoid the problems on
117
+ # `general purpose flag Bit 3 is set`
118
+ #
119
+ zip_stringio = ::Zip::File.open_buffer(@zip_string).write_buffer
120
+ zip_stringio.rewind
121
+
122
+ ::Zip::InputStream.open(zip_stringio, 0, decrypter(password)) do |zis|
117
123
  yield zis
118
124
  end
119
125
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glima
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshinari Nomura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-04 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.11'
75
+ version: '2.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.11'
82
+ version: '2.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: 12.3.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: 12.3.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -183,8 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.5.2.2
186
+ rubygems_version: 3.0.3
188
187
  signing_key:
189
188
  specification_version: 4
190
189
  summary: Gmail CLI client