bcbiff 0.2.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.
- data/.document +5 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +29 -0
- data/LICENSE.txt +24 -0
- data/README.md +103 -0
- data/Rakefile +65 -0
- data/bcbiff.gemspec +59 -0
- data/bin/bcbiff +10 -0
- data/lib/bcbiff.rb +170 -0
- metadata +139 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "mail"
|
4
|
+
|
5
|
+
# Add dependencies to develop your gem here.
|
6
|
+
# Include everything needed to run rake, tests, features, etc.
|
7
|
+
group :development do
|
8
|
+
gem "bundler", "~> 1.0.0"
|
9
|
+
gem "jeweler", "~> 1.6.4"
|
10
|
+
gem "rcov", ">= 0"
|
11
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
i18n (0.6.0)
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
mail (2.3.0)
|
11
|
+
i18n (>= 0.4.0)
|
12
|
+
mime-types (~> 1.16)
|
13
|
+
treetop (~> 1.4.8)
|
14
|
+
mime-types (1.16)
|
15
|
+
polyglot (0.3.2)
|
16
|
+
rake (0.9.2)
|
17
|
+
rcov (0.9.10)
|
18
|
+
treetop (1.4.10)
|
19
|
+
polyglot
|
20
|
+
polyglot (>= 0.3.1)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.0.0)
|
27
|
+
jeweler (~> 1.6.4)
|
28
|
+
mail
|
29
|
+
rcov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2011 Akinori MUSHA
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions
|
7
|
+
are met:
|
8
|
+
1. Redistributions of source code must retain the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
12
|
+
documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
20
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
21
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
22
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
23
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# bcbiff
|
2
|
+
|
3
|
+
## NAME
|
4
|
+
|
5
|
+
`bcbiff(1) - Boxcar based IMAP biff`
|
6
|
+
|
7
|
+
## SYNOPSIS
|
8
|
+
|
9
|
+
`bcbiff`
|
10
|
+
|
11
|
+
## DESCRIPTION
|
12
|
+
|
13
|
+
Bcbiff checks the Inbox folder on an IMAP server for unread mails and
|
14
|
+
sends a notification mail for each.
|
15
|
+
|
16
|
+
This tool was made to send push notification to your iPhone via Boxcar
|
17
|
+
when you have received a mail in Inbox on an IMAP server, primarily
|
18
|
+
with Gmail in mind. Bcbiff composes a notification mail that has
|
19
|
+
From, Date and Subject header fields copied from the original, with
|
20
|
+
other fields and the body part removed.
|
21
|
+
|
22
|
+
Simple mail forwarding using a filter on Gmail has a couple of
|
23
|
+
problems. First, there is no easy way to write a filter that only
|
24
|
+
matches mails that will be dropping in Inbox. Second, mail bodies and
|
25
|
+
sensitive header fields will be leaked. Bcbiff solves both.
|
26
|
+
|
27
|
+
Bcbiff caches the Message-Id's of the latest 100 unread mails so that
|
28
|
+
you get just one notification per mail, even if you leave a mail
|
29
|
+
unread despite a notification.
|
30
|
+
|
31
|
+
## FILES
|
32
|
+
|
33
|
+
* `~/.bcbiff`
|
34
|
+
|
35
|
+
User configuration file that would look like below.
|
36
|
+
|
37
|
+
---
|
38
|
+
:accounts:
|
39
|
+
- :host: imap.gmail.com
|
40
|
+
:port: 993
|
41
|
+
:ssl: true
|
42
|
+
:username: "account1"
|
43
|
+
:password: "********"
|
44
|
+
:mailto: "******.*******@push.boxcar.io"
|
45
|
+
- :host: imap.gmail.com
|
46
|
+
:port: 993
|
47
|
+
:ssl: true
|
48
|
+
:username: "account2@your.domain"
|
49
|
+
:password: "********"
|
50
|
+
:mailto: "******.*******@push.boxcar.io"
|
51
|
+
:folders:
|
52
|
+
- Inbox
|
53
|
+
- work/important
|
54
|
+
|
55
|
+
You can list as many account entries as you want. The server
|
56
|
+
needs not be of Gmail, and the mailto address needs not be of
|
57
|
+
Boxcar.
|
58
|
+
|
59
|
+
If you want to check folders other than the default of `Inbox`,
|
60
|
+
specify them in the `:folders` field, in which case you need to
|
61
|
+
specify `Inbox` if you want it checked.
|
62
|
+
|
63
|
+
* `~/Maildir/idcache.*.yml`
|
64
|
+
|
65
|
+
Message-Id cache files, one for each notification account.
|
66
|
+
|
67
|
+
## USAGE
|
68
|
+
|
69
|
+
Prepare your `~/.bcbiff`, adjust constants defined in `bcbiff` for
|
70
|
+
your system and run bcbiff once a minute or so.
|
71
|
+
|
72
|
+
## REQUIREMENTS
|
73
|
+
|
74
|
+
Bcbiff will run with Ruby 1.8.7+ and 1.9.2+.
|
75
|
+
|
76
|
+
See `Gemfile` for dependency. Run `bundle install` to install what's
|
77
|
+
missing.
|
78
|
+
|
79
|
+
Bcbiff calls the `sendmail` command to send a mail. Sendmail (or any
|
80
|
+
compatible software such as qmail or Postfix) must be properly
|
81
|
+
configured.
|
82
|
+
|
83
|
+
To use SSL connections, you must have the certificates file/directory
|
84
|
+
configured. Some of the common paths are determined by default, but
|
85
|
+
if bcbiff(1) fails to locate the one on your system, follow the
|
86
|
+
instruction displayed, and let me know if it's pretty much common on
|
87
|
+
the platform.
|
88
|
+
|
89
|
+
## SEE ALSO
|
90
|
+
|
91
|
+
* [Boxcar](http://boxcar.io/)
|
92
|
+
|
93
|
+
* [Gmail](https://mail.google.com/)
|
94
|
+
|
95
|
+
## AUTHOR
|
96
|
+
|
97
|
+
Copyright (c) 2011 Akinori MUSHA.
|
98
|
+
|
99
|
+
Licensed under the 2-clause BSD license. See `LICENSE.txt` for
|
100
|
+
details.
|
101
|
+
|
102
|
+
Visit [GitHub Repository](https://github.com/knu/bcbiff) for the
|
103
|
+
latest information and feedback.
|
data/Rakefile
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
eval File.read('./lib/bcbiff.rb').lines.find { |line|
|
17
|
+
/BCBIFF_VERSION/ =~ line
|
18
|
+
} if !defined?(BCBIFF_VERSION)
|
19
|
+
|
20
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
21
|
+
gem.name = "bcbiff"
|
22
|
+
gem.homepage = "http://github.com/knu/bcbiff"
|
23
|
+
gem.license = "2-clause BSDL"
|
24
|
+
gem.summary = %Q{bcbiff(1) - Boxcar based IMAP biff}
|
25
|
+
gem.description = <<-'EOS'
|
26
|
+
Bcbiff checks the Inbox folder on an IMAP server for unread mails and
|
27
|
+
sends a notification for each. Ideal for enabling push notification
|
28
|
+
for your Gmail account using Boxcar.
|
29
|
+
EOS
|
30
|
+
gem.email = "knu@idaemons.org"
|
31
|
+
gem.authors = ["Akinori MUSHA"]
|
32
|
+
gem.executables = ["bcbiff"]
|
33
|
+
gem.version = BCBIFF_VERSION
|
34
|
+
|
35
|
+
gem.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
36
|
+
# dependencies defined in Gemfile
|
37
|
+
end
|
38
|
+
Jeweler::RubygemsDotOrgTasks.new
|
39
|
+
|
40
|
+
require 'rake/testtask'
|
41
|
+
Rake::TestTask.new(:test) do |test|
|
42
|
+
test.libs << 'lib' << 'test'
|
43
|
+
test.pattern = 'test/**/test_*.rb'
|
44
|
+
test.verbose = true
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'rcov/rcovtask'
|
48
|
+
Rcov::RcovTask.new do |test|
|
49
|
+
test.libs << 'test'
|
50
|
+
test.pattern = 'test/**/test_*.rb'
|
51
|
+
test.verbose = true
|
52
|
+
test.rcov_opts << '--exclude "gems/*"'
|
53
|
+
end
|
54
|
+
|
55
|
+
task :default => :test
|
56
|
+
|
57
|
+
require 'rake/rdoctask'
|
58
|
+
Rake::RDocTask.new do |rdoc|
|
59
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
60
|
+
|
61
|
+
rdoc.rdoc_dir = 'rdoc'
|
62
|
+
rdoc.title = "bcbiff #{version}"
|
63
|
+
rdoc.rdoc_files.include('README*')
|
64
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
65
|
+
end
|
data/bcbiff.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "bcbiff"
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Akinori MUSHA"]
|
12
|
+
s.date = "2011-09-26"
|
13
|
+
s.description = "Bcbiff checks the Inbox folder on an IMAP server for unread mails and\nsends a notification for each. Ideal for enabling push notification\nfor your Gmail account using Boxcar.\n"
|
14
|
+
s.email = "knu@idaemons.org"
|
15
|
+
s.executables = ["bcbiff"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"bcbiff.gemspec",
|
28
|
+
"bin/bcbiff",
|
29
|
+
"lib/bcbiff.rb"
|
30
|
+
]
|
31
|
+
s.homepage = "http://github.com/knu/bcbiff"
|
32
|
+
s.licenses = ["2-clause BSDL"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
35
|
+
s.rubygems_version = "1.8.10"
|
36
|
+
s.summary = "bcbiff(1) - Boxcar based IMAP biff"
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<mail>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
45
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
50
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<mail>, [">= 0"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
56
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
data/bin/bcbiff
ADDED
data/lib/bcbiff.rb
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# bcbiff(1) - Boxcar based IMAP biff
|
5
|
+
#
|
6
|
+
# Copyright (c) 2011 Akinori MUSHA
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions
|
12
|
+
# are met:
|
13
|
+
# 1. Redistributions of source code must retain the above copyright
|
14
|
+
# notice, this list of conditions and the following disclaimer.
|
15
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
16
|
+
# notice, this list of conditions and the following disclaimer in the
|
17
|
+
# documentation and/or other materials provided with the distribution.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
23
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
25
|
+
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
26
|
+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
27
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
28
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
29
|
+
# SUCH DAMAGE.
|
30
|
+
|
31
|
+
require 'rubygems'
|
32
|
+
require 'net/imap'
|
33
|
+
require 'yaml'
|
34
|
+
require 'mail'
|
35
|
+
require 'shellwords'
|
36
|
+
|
37
|
+
BCBIFF_VERSION = '0.2.0'
|
38
|
+
|
39
|
+
CERTS_PATHS = [
|
40
|
+
'/etc/ssl/cert.pem', # FreeBSD
|
41
|
+
'/etc/ssl/certs', # Ubuntu
|
42
|
+
'/usr/share/ssl/certs', # RHEL4
|
43
|
+
'/etc/pki/tls/certs', # RHEL5
|
44
|
+
'/opt/local/share/curl/curl-ca-bundle.crt', # OS X; MacPorts
|
45
|
+
]
|
46
|
+
CERTS_PATH = CERTS_PATHS.find { |f| File.exist?(f) }
|
47
|
+
IDCACHE_FILE = '~/Maildir/idcache.%s.yml'
|
48
|
+
IDCACHE_SIZE = 100
|
49
|
+
BCBIFF_FILE = '~/.bcbiff'
|
50
|
+
|
51
|
+
def main(argv)
|
52
|
+
accounts = config[:accounts]
|
53
|
+
|
54
|
+
maildir = File.dirname(File.expand_path(IDCACHE_FILE))
|
55
|
+
Dir.mkdir(maildir, 0700) unless File.directory?(maildir)
|
56
|
+
|
57
|
+
if accounts.any? { |account| account[:ssl] } && !certs_path
|
58
|
+
STDERR.print <<-EOS
|
59
|
+
The system path for SSL certificates is not found.
|
60
|
+
Install SSL certificates in one of the following locations:
|
61
|
+
EOS
|
62
|
+
CERTS_PATHS.each { |path|
|
63
|
+
STDERR.puts "\t#{path}"
|
64
|
+
}
|
65
|
+
STDERR.print <<-EOS if RUBY_PLATFORM =~ /darwin/
|
66
|
+
|
67
|
+
If you are on OS X and have MacPorts installed, running the
|
68
|
+
following command is an easy way to have one installed:
|
69
|
+
\tport install curl-ca-bundle
|
70
|
+
EOS
|
71
|
+
STDERR.print <<-EOS
|
72
|
+
|
73
|
+
Otherwise, refer to the following site and place the pem
|
74
|
+
file somewhere:
|
75
|
+
\thttp://curl.haxx.se/docs/caextract.html
|
76
|
+
|
77
|
+
Then add `:certs_path: /path/to/pem` to #{BCBIFF_FILE}.
|
78
|
+
EOS
|
79
|
+
exit 1
|
80
|
+
end
|
81
|
+
|
82
|
+
accounts.each { |options|
|
83
|
+
check_mails(options)
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
def config
|
88
|
+
$config ||=
|
89
|
+
begin
|
90
|
+
value = YAML.load_file(File.expand_path(BCBIFF_FILE))
|
91
|
+
raise unless value.is_a?(Hash) && value.key?(:accounts)
|
92
|
+
value
|
93
|
+
end
|
94
|
+
rescue
|
95
|
+
STDERR.puts "Put your configuration in #{BCBIFF_FILE} that looks like below.", ''
|
96
|
+
STDERR.print YAML.dump({
|
97
|
+
:accounts => [
|
98
|
+
{
|
99
|
+
:host => 'imap.gmail.com',
|
100
|
+
:port => 993,
|
101
|
+
:ssl => true,
|
102
|
+
:username => 'your.account',
|
103
|
+
:password => 'password1',
|
104
|
+
:mailto => 'dead.beef@push.boxcar.io',
|
105
|
+
},
|
106
|
+
{
|
107
|
+
:host => 'imap.gmail.com',
|
108
|
+
:port => 993,
|
109
|
+
:ssl => true,
|
110
|
+
:username => 'you@your.domain',
|
111
|
+
:password => 'password2',
|
112
|
+
:mailto => 'feed.babe@push.boxcar.io',
|
113
|
+
:folders => %w[Inbox work/important],
|
114
|
+
}
|
115
|
+
]
|
116
|
+
})
|
117
|
+
exit 1
|
118
|
+
end
|
119
|
+
|
120
|
+
def certs_path
|
121
|
+
$certs_path ||= config[:certs_path] || CERTS_PATH
|
122
|
+
end
|
123
|
+
|
124
|
+
def check_mails(options)
|
125
|
+
#Net::IMAP.debug = true
|
126
|
+
mailto = options[:mailto]
|
127
|
+
msgids_file = File.expand_path(IDCACHE_FILE % mailto)
|
128
|
+
|
129
|
+
File.open(msgids_file, File::RDWR | File::CREAT, 0600) {|f|
|
130
|
+
f.flock(File::LOCK_EX | File::LOCK_NB) or break
|
131
|
+
|
132
|
+
imap = Net::IMAP.new(options[:host], options[:port], options[:ssl], certs_path, true)
|
133
|
+
imap.login(options[:username], options[:password])
|
134
|
+
folders = options[:folders] || ['Inbox']
|
135
|
+
unseen = folders.inject([]) { |unseen, folder|
|
136
|
+
imap.select(folder)
|
137
|
+
unseen.concat(imap.search('UNSEEN'))
|
138
|
+
}
|
139
|
+
return if unseen.empty?
|
140
|
+
|
141
|
+
msgids = YAML.load(f) || []
|
142
|
+
|
143
|
+
imap.fetch(unseen, item = 'RFC822.HEADER').each { |data|
|
144
|
+
mail = Mail.read_from_string(data.attr[item])
|
145
|
+
msgid = mail.message_id
|
146
|
+
next if msgids.include?(msgid)
|
147
|
+
msgids << msgid
|
148
|
+
|
149
|
+
(header = mail.header).fields.each { |field|
|
150
|
+
case name = field.name
|
151
|
+
when /\A(From|Subject|Date)\z/i
|
152
|
+
# preserve
|
153
|
+
else
|
154
|
+
header[name] = nil
|
155
|
+
end
|
156
|
+
}
|
157
|
+
|
158
|
+
open("| sendmail #{mailto.shellescape}", 'w') { |sendmail|
|
159
|
+
sendmail.print mail.encoded
|
160
|
+
}
|
161
|
+
}
|
162
|
+
msgids.slice!(0...-IDCACHE_SIZE) if msgids.size > IDCACHE_SIZE
|
163
|
+
|
164
|
+
f.rewind
|
165
|
+
f.print YAML.dump(msgids)
|
166
|
+
f.truncate(f.pos)
|
167
|
+
}
|
168
|
+
end
|
169
|
+
|
170
|
+
main(ARGV) if $0 == __FILE__
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bcbiff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Akinori MUSHA
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-26 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
version_requirements: *id001
|
31
|
+
name: mail
|
32
|
+
prerelease: false
|
33
|
+
type: :runtime
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
hash: 23
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 0
|
44
|
+
- 0
|
45
|
+
version: 1.0.0
|
46
|
+
version_requirements: *id002
|
47
|
+
name: bundler
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 7
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 6
|
60
|
+
- 4
|
61
|
+
version: 1.6.4
|
62
|
+
version_requirements: *id003
|
63
|
+
name: jeweler
|
64
|
+
prerelease: false
|
65
|
+
type: :development
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
version_requirements: *id004
|
77
|
+
name: rcov
|
78
|
+
prerelease: false
|
79
|
+
type: :development
|
80
|
+
description: |
|
81
|
+
Bcbiff checks the Inbox folder on an IMAP server for unread mails and
|
82
|
+
sends a notification for each. Ideal for enabling push notification
|
83
|
+
for your Gmail account using Boxcar.
|
84
|
+
|
85
|
+
email: knu@idaemons.org
|
86
|
+
executables:
|
87
|
+
- bcbiff
|
88
|
+
extensions: []
|
89
|
+
|
90
|
+
extra_rdoc_files:
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
files:
|
94
|
+
- .document
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bcbiff.gemspec
|
101
|
+
- bin/bcbiff
|
102
|
+
- lib/bcbiff.rb
|
103
|
+
homepage: http://github.com/knu/bcbiff
|
104
|
+
licenses:
|
105
|
+
- 2-clause BSDL
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 57
|
117
|
+
segments:
|
118
|
+
- 1
|
119
|
+
- 8
|
120
|
+
- 7
|
121
|
+
version: 1.8.7
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
requirements: []
|
132
|
+
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 1.8.10
|
135
|
+
signing_key:
|
136
|
+
specification_version: 3
|
137
|
+
summary: bcbiff(1) - Boxcar based IMAP biff
|
138
|
+
test_files: []
|
139
|
+
|