imap_mogura 0.1.1.pre.dev → 0.1.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: 63948c26de8c10fedd38588189779fd6eeee167f3ab8fe54be42ab3ae37eac76
4
- data.tar.gz: 1b86c8501895ea103f4627a34cb3057eda23f42d0722aeceb2d6ea1630ed7472
3
+ metadata.gz: 3f5a65d48e4e81a37e519995c39cddf533e3336477c358044462f51935ee1d0f
4
+ data.tar.gz: 59975c34bdd3ce2d372c71c5d6b8d9689867e431956104df8cd958294a18dc3d
5
5
  SHA512:
6
- metadata.gz: 902ce048023623971dd7c26e5512888eea1275e1160895f8fa0d6a36d91386f76e8f5d3f3a3b2cef42709b0d76d77bd08cf8c4381ea03d4dbaa62a9691b25b82
7
- data.tar.gz: 72055ee14145ec3a81ccfe02f50bc903f060368e933fbce27e63f0d45ffdd5f0ec1829ffa054ec4f0179d77bec9f4948c4dc372d408943f1332f7973b81e12ef
6
+ metadata.gz: c29a3b716cfde67b59876ad149add941ac2db45fa92154fbaa0a3587e438939568ae6eb536b12ddcc28bd14c0ab131a3f4a5725d0e11775cc3f1a95d30400b84
7
+ data.tar.gz: fc9c28711eb63e293e09173a3b4eac353e5ca40d4b3d7b01b07ea5f571c80d941d669c1bd93217c21d179a16ff59b116996f0a581b80ad883c5875a590e2f8b2
data/README.md CHANGED
@@ -4,16 +4,13 @@ A mail filtering tool for IMAP.
4
4
 
5
5
  ## Installation
6
6
 
7
- Check out this repository first and enter the directory.
7
+ To install this gem, you can get it from RubyGems.org. Just run as following.
8
8
 
9
9
  ```console
10
- $ git clone https://github.com/yskuniv/imap_mogura.git
11
- $ cd imap_mogura/
10
+ $ gem install imap_mogura --pre
12
11
  ```
13
12
 
14
- Install this gem and add to the application's Gemfile by executing:
15
-
16
- $ bundle install
13
+ (This gem has only released pre-release versions now, so you must specify `--pre` option.)
17
14
 
18
15
  ## Usage
19
16
 
@@ -45,10 +45,10 @@ module ImapMogura
45
45
  monitored_events = ["RECENT"]
46
46
  search_keys = ["RECENT", *(["UNSEEN"] if filter_unseen)]
47
47
 
48
- with_all_preparation_ready(config_name, host, port, starttls, use_ssl,
49
- auth_info: { auth_type: auth_type, user: user, password: password },
50
- create_directory: create_directory,
51
- dry_run: dry_run) do |imap_handler, rules|
48
+ with_preparation_ready(config_name, host, port, starttls, use_ssl,
49
+ auth_info: { auth_type: auth_type, user: user, password: password },
50
+ create_directory: create_directory,
51
+ dry_run: dry_run) do |imap_handler, rules|
52
52
  warn "* start monitoring recent mails in \"#{target_mailbox}\""
53
53
 
54
54
  imap_handler.monitor_events(target_mailbox, monitored_events) do
@@ -99,11 +99,11 @@ module ImapMogura
99
99
  ["ALL"]
100
100
  end
101
101
 
102
- with_all_preparation_ready(config_name, host, port, starttls, use_ssl,
103
- auth_info: { auth_type: auth_type, user: user, password: password },
104
- excluded_mailboxes: exclude_mailboxes,
105
- create_directory: create_directory,
106
- dry_run: dry_run) do |imap_handler, rules, options|
102
+ with_preparation_ready(config_name, host, port, starttls, use_ssl,
103
+ auth_info: { auth_type: auth_type, user: user, password: password },
104
+ excluded_mailboxes: exclude_mailboxes,
105
+ create_directory: create_directory,
106
+ dry_run: dry_run) do |imap_handler, rules, options|
107
107
  if all_mailbox
108
108
  excluded_mailboxes = options[:excluded_mailboxes]
109
109
 
@@ -152,13 +152,14 @@ module ImapMogura
152
152
 
153
153
  private
154
154
 
155
- def with_all_preparation_ready(config_name,
156
- host, port,
157
- starttls, use_ssl, certs: nil, verify: true,
158
- auth_info: nil,
159
- excluded_mailboxes: [],
160
- create_directory: true,
161
- dry_run: false, &block)
155
+ def with_preparation_ready(config_name,
156
+ host, port,
157
+ starttls, use_ssl, certs: nil, verify: true,
158
+ auth_info: nil,
159
+ excluded_mailboxes: [],
160
+ create_directory: true,
161
+ dry_run: false,
162
+ &block)
162
163
  _, rules = load_and_handle_config(config_name)
163
164
 
164
165
  warn "* connecting the server #{host}:#{port}..."
@@ -35,7 +35,7 @@ module ImapMogura
35
35
 
36
36
  class FieldMatcher < RuleElement
37
37
  def initialize(regexp)
38
- @regexp = /#{regexp}/ # FIXME: need to care about malicious regular expression injection
38
+ @regexp = Regexp.new(regexp)
39
39
 
40
40
  super()
41
41
  end
@@ -64,6 +64,8 @@ module ImapMogura
64
64
  else
65
65
  GeneralFieldMatcher.new(k, rule[k])
66
66
  end
67
+ rescue RegexpError
68
+ raise ParseError, "illegal regular expression: #{rule[k].inspect}"
67
69
  end
68
70
 
69
71
  def parse_rule_list(rule_list)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImapMogura
4
- VERSION = "0.1.1.pre.dev"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap_mogura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.pre.dev
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ysk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-18 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64