omah-plugin-taxonomy 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/omah-plugin-taxonomy.rb +46 -0
- metadata +68 -0
- metadata.gz.sig +3 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7628693c5ed1691a321311f174c9e96feff16dbe
|
4
|
+
data.tar.gz: 6169941b5d811bdb20ac9815a2a9c49951583ee0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de60c201564beacdbfa047c427cc4fcdb5564ca486cfad78aa1202806a751c27ba0aefe683346765447608c89c5e973363f2e7e36badf52c7c399e8aa3a1736f
|
7
|
+
data.tar.gz: d6fd79f71b9e295b8746e9133ba233cee0219e367412b1ae25faee90a9648f102526212c8d363604afaa374bd1299b9b3284b08b8d01ad55b0f598157f1c8129
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: omah-plugin-taxonomy.rb
|
4
|
+
|
5
|
+
|
6
|
+
class PluginException < Exception
|
7
|
+
end
|
8
|
+
|
9
|
+
class OmahPluginTaxonomy
|
10
|
+
|
11
|
+
def initialize(settings: {}, variables: {})
|
12
|
+
|
13
|
+
lookupfile = settings[:lookupfile]
|
14
|
+
|
15
|
+
unless File.exists? lookupfile then
|
16
|
+
raise PluginException, "lookup file %[lookupfile} not found"
|
17
|
+
end
|
18
|
+
|
19
|
+
dx = Dynarex.new
|
20
|
+
dx.import lookupfile
|
21
|
+
@a = dx.all
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def on_newmessage(h)
|
26
|
+
|
27
|
+
# attempt to match a recipient address or subject keyword with with 1 or more tags
|
28
|
+
|
29
|
+
matched = @a.select do |item|
|
30
|
+
|
31
|
+
%i(from subject).detect do |x|
|
32
|
+
|
33
|
+
val = item.method(x).call
|
34
|
+
next if val.empty?
|
35
|
+
|
36
|
+
h[x] =~ Regexp.new(val)
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
h[:tags] = matched.inject('') {|r,x| r << x.tags}
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omah-plugin-taxonomy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDUwMjE3NDEwM1oXDTE4MDUwMjE3NDEwM1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBANgR1KCFXfqcDwYe3Kxj/BZ5EftSJm5Fret8R7MnpSlMhnrj3PU+8+sBC1h9
|
19
|
+
viGaFXSwIPJCdx83gLlXmpDtdV7k7qsPCDWIYYLlF2e+zZ1ZX+KPo0jcTeQBnoy3
|
20
|
+
OeyTPzJEjIHI8BA1nyap654xLPhC4se1mSZTV0Rhk42mX876ky93q3KvjsWWQwq0
|
21
|
+
pLeJ9rONTXzERKye1+/vl063YJrMWc17LD0E7MJY+RUdIMNBg11LVuIzGbSAIN6B
|
22
|
+
Q2CGWYAS3/x5RgKj5KUnYkppHKqk340yeFefoSM5E3rnkqT/7OyDX085OHMBc92A
|
23
|
+
CbwxPuXACCQUCun3XFNJnoKjQ20CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQULSg466zux38UxCR6UTKYv3eIXxswJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEALZy3TuZw
|
27
|
+
k3hP94CW3SlxNrtWU6ndknePBduzLHY4jEHk8czDte4/d3OvPW0YX9uNwqcMGEqo
|
28
|
+
BO4URpq8xHYfcAuNVwBhxrreErJTgflCvU61r77uHzyDLGf68D+2Gxz2hu1pXtjS
|
29
|
+
gfhJU1I7GuINJtZG1sKp2UvxErVdFJkIbZEYvhjsPVF733peyB/+Mkl0QNOOuirC
|
30
|
+
I2nDdwmxck4IGmmAnrFj4q/FJQP8Q7S6RRoaAYJEHGoW4ZsuKVLm3Lg7aTv2VScu
|
31
|
+
KMY1lCVvrbrmYrVgu7ojJDKT2xxjc9ClhHOcDYuLgpIK9Te5N8dffKPpGT+xy14R
|
32
|
+
GujWBdJUCTsjwg==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
35
|
+
dependencies: []
|
36
|
+
description:
|
37
|
+
email: james@jamesrobertson.eu
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- lib/omah-plugin-taxonomy.rb
|
43
|
+
homepage: https://github.com/jrobertson/omah-plugin-taxonomy
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.6.8
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: An OMAH plugin to tag email messages by matching known recipients or by subject
|
67
|
+
keyword matching.
|
68
|
+
test_files: []
|
metadata.gz.sig
ADDED