Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rmail to Mail: initial work #61

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
100d196
Revert "Use old 'syck' module for YAML parsing"
gauteh Apr 13, 2013
613d5c7
Revert "Fix #12: Require 'iconv' before patching it"
gauteh Apr 13, 2013
39405d4
Add tool to convert YAML objects from syck to psych.
jof Apr 14, 2013
4412d49
Merge pull request #1 from jof/prepare-for-psych
gauteh Apr 14, 2013
e86fdf0
Use supmua.org for YAML_DOMAIN
gauteh Apr 15, 2013
8de4efa
Merge branch 'prepare-for-psych' into ruby_2.0.0_compatibilty_fixes
gauteh Apr 17, 2013
ebcb569
Use different backup name as .bak already is used in lib/sup.rb and +x
gauteh Apr 17, 2013
ef4efce
Merge branch 'prepare-for-psych' into gdevelop
gauteh Apr 17, 2013
f4418b5
Merge branch 'ruby_2.0.0_compatibilty_fixes' into gdevelop
gauteh Apr 17, 2013
fff2013
WIP: getting maildir loading working with psych
gauteh Apr 17, 2013
90c32eb
add some encoding lines + fix some ws errors
gauteh Apr 18, 2013
1b9a02d
cleanup
gauteh Apr 18, 2013
b95ce64
init with on mbox and sent source
gauteh Apr 19, 2013
6cc3b9d
WIP: change to Mail
gauteh Apr 19, 2013
f5391a5
dont change scope
gauteh Apr 19, 2013
a92f264
WIP: an email has been read and indexed.
gauteh Apr 19, 2013
fbae8fd
load unread state from source
gauteh Apr 20, 2013
277733f
WIP: tests, rm server test
gauteh Apr 20, 2013
67d1381
Fix problem with account selector
bloovis Apr 13, 2013
d1cc6e3
rm sup-server
gauteh Apr 20, 2013
56552b5
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh Apr 20, 2013
b93d1e3
Revert "Merge #16: Fix YAML regression in 1.9"
gauteh Apr 20, 2013
d380c03
Get the relevant stuff from issue #16.
gauteh Apr 20, 2013
97a43ad
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh Apr 21, 2013
64a196a
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh Apr 22, 2013
bb1e9af
Upgrade ncursesw-sup to 1.3
5long May 1, 2013
b1830e7
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh May 1, 2013
5e7074a
Merge branch 'depend-on-ncursesw-fork' into rmail-to-mail-remove-icon…
gauteh May 1, 2013
914fb7b
allow travis fail
gauteh May 2, 2013
30d925a
fix travis syntax
gauteh May 2, 2013
95b435e
using Mail for message parsing
gauteh May 2, 2013
eb69998
read chunks
gauteh May 2, 2013
243adc2
WIP: going safe_ref
gauteh May 3, 2013
801bc88
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh May 3, 2013
71f9587
console for 1.9
gauteh May 3, 2013
0094c8f
WIP: tagging
gauteh May 3, 2013
58f60db
Merge branch 'develop' into rmail-to-mail-remove-iconv-ruby-2-comp
gauteh May 4, 2013
a98f5c9
WIP: join threads
gauteh May 4, 2013
903d54a
rescue on missing message_ids, still bad join thread matching
gauteh May 4, 2013
3a829aa
bump index version
gauteh May 4, 2013
47def78
wip: migration tool
gauteh May 4, 2013
6a899ac
add mail dep
gauteh May 5, 2013
cdade9f
fix typo in dep
gauteh May 5, 2013
9145527
add relay to static method
gauteh May 5, 2013
23b75d7
dont fail too hard on unimplemented message chunks
gauteh May 5, 2013
4d9a572
Fix error when a source has no labels
May 5, 2013
0b44f69
add fix_encoding method to string, working on large amounts of mail now
gauteh May 6, 2013
1d9841e
use each_safe_id_*
gauteh May 6, 2013
68d656e
use to_enum in place of Enumerator.new
gauteh May 7, 2013
130d8c9
add psych-ify to executables
gauteh May 7, 2013
0768a05
Merge branch 'develop' into sup-for-two
gauteh May 7, 2013
ace2774
Remove dead code: accessing curpos
5long May 18, 2013
1c39e61
Use _ to ignore unused splats
5long May 18, 2013
259a0ce
Remove warnings about variable shadowing
5long May 18, 2013
ffab039
Make chronic a hard dependency
5long May 18, 2013
d40d122
Remove doc/NewUserGuide.txt since it's in the wiki now.
5long May 18, 2013
d72e116
Replace dash with underscore in filename
5long May 18, 2013
fac701f
Merge branch 'develop' into sup-for-two
gauteh May 20, 2013
e619e3f
Merge branch 'maildir-sync' into sup-for-two
gauteh May 20, 2013
5137038
Merge branch 'rmail-to-mail' into rmail-to-mail-initial
gauteh May 20, 2013
8818a4e
Merge pull request #57 from 5long/develop
5long May 20, 2013
8df45b7
Initial attempt that works
5long May 19, 2013
5127833
Show processed message count and tell user to refresh
5long May 19, 2013
50bd997
Make sup/index require-able on its own
5long May 19, 2013
a6cfac2
Introduce RR as the mocking framework.
5long May 19, 2013
ab3ab3b
Implement LabelService#{add,remove}_labels
5long May 19, 2013
f2f21ae
Console#{add,remove}_labels delegates to LabelService
5long May 19, 2013
3068986
Merge pull request #63 from 5long/batch-label-operation
5long May 22, 2013
d21f027
Ruby 1.8 needs requiring rubygems manually
5long May 22, 2013
9912422
Make HorizontalSelector solid
5long May 23, 2013
bb89f0a
Handle unknown From account as customized
5long May 23, 2013
8d38421
Merge branch 'sup-heliotrope/develop' into maildir-sync
ericweikl May 23, 2013
aa09969
Merge pull request #66 from 5long/more-solid-account-selector
5long May 25, 2013
4862baa
Merge branch 'develop' into rmail-to-mail-initial
gauteh May 26, 2013
8e66a8c
Replace Iconv with built-ins for Ruby >=1.9
gauteh May 26, 2013
a6b73f9
'polling' and 'new messages' flashing is now down by default poll hoo…
zevv May 25, 2013
6938172
HookContext#flash should fallback to log()
5long May 26, 2013
d16bebc
Merge #70 'no-poll-flashing'
5long May 26, 2013
49d55db
patch RMail field parser to use UTF-8 regexps and fix_encoding before…
gauteh May 26, 2013
f1af647
more robust fix_encoding
gauteh May 26, 2013
593f0f2
Don't require iconv anymore
gauteh May 26, 2013
3c4ec67
Revert "Use old 'syck' module for YAML parsing"
gauteh Apr 13, 2013
c9847a8
Add tool to convert YAML objects from syck to psych.
jof Apr 14, 2013
210fd40
Use supmua.org for YAML_DOMAIN
gauteh Apr 15, 2013
8eed69a
Use different backup name as .bak already is used in lib/sup.rb and +x
gauteh Apr 17, 2013
bb50992
add sup-psych-ify--- to SUP_EXECUTABLES
gauteh May 20, 2013
98d8200
Only support Ruby 1.9.2+, dropping 1.8
5long May 27, 2013
db1aa14
Support loading legacy YAML for now.
5long May 28, 2013
bbf48f7
Remove redundant self.instance_eval
5long May 28, 2013
9ae66dc
Remove dead & deprecated code
5long May 28, 2013
817efdf
Now sources.yaml migration is just load & save
5long May 28, 2013
2fc25f9
Mention psych-ify in gemspec.post_install_message
5long May 28, 2013
192531b
Set yamler explicitly for 1.9.2
5long May 28, 2013
e2391b6
use fix_encoding, not force_encoding
gauteh May 28, 2013
c578ee6
Merge pull request #75 from 5long/migrate-to-psych
5long May 30, 2013
46fd866
support setting the color of normal text
mklinik Apr 29, 2012
c7088ed
refactor transcode
gauteh May 31, 2013
414ae18
Merge #76: Accept UTF8 as UTF-8 and test encoding with fallback to UTF-8
gauteh May 31, 2013
a84ebe8
Merge pull request #78 from mklinik/color-normal-text
5long Jun 2, 2013
1540012
Get rid of gettext
5long Jun 2, 2013
3d4b1f0
Merge branch 'sup-heliotrope/develop' into maildir-sync
ericweikl Jun 2, 2013
346c733
Switch xapian binding to xapian-ruby
5long Jun 2, 2013
4c94418
Use ~> in gemspec correctly
5long Jun 2, 2013
aa7691d
Notify user to remove xapian-full-alaveteli
5long Jun 2, 2013
1d86d78
Use add_runtime_dependency in gemspec
5long Jun 2, 2013
25ef349
labels got lost
ericweikl Jun 2, 2013
ee9349d
Merge branch 'sup-heliotrope/develop' into maildir-sync
ericweikl Jun 2, 2013
c253707
Merge branch 'develop' into rmail-to-mail-initial
gauteh Jun 12, 2013
50de83b
Merge branch 'maildir-sync' into rmail-to-mail-initial
gauteh Jun 12, 2013
0e780dc
Merge branch 'get-rid-of-iconv' into rmail-to-mail-initial
gauteh Jun 12, 2013
1f80f68
Merge remote-tracking branch '5long/switch-xapian-binding' into sup-f…
gauteh Jun 12, 2013
3f31116
s/charset/encoding/
gauteh Jun 13, 2013
985b78f
send message using Mail and use Mail in mbox parsing
gauteh Jun 13, 2013
2387e96
wip: test_message pass
gauteh Jun 13, 2013
c2840cb
tests pass
gauteh Jun 13, 2013
97f7e3d
drop 1.9.2 support
gauteh Jun 13, 2013
896ab66
Merge #83: Switch xapian binding to xapian-ruby
gauteh Jun 13, 2013
b74ad36
tweak-labels: use to_enum and safe_id
gauteh Jun 13, 2013
ab55fe2
Merge branch 'sup-for-two-dev' into rmail-to-mail-initial
gauteh Jun 13, 2013
63f4098
rescue on invalid date crash in Mail
gauteh Jun 15, 2013
8f59263
poll.rb: remove some ws bs
gauteh Jun 20, 2013
d1eea42
Source poll thread safety: lock source polling
gauteh Jun 20, 2013
6f090d5
move go_idle to ensure
gauteh Jun 20, 2013
2b939a7
change @polling to Mutex for thread safety
gauteh Jun 20, 2013
53da884
Merge #85: Check if GPG end marker exists
michitux Jun 22, 2013
f5bf85c
Grammar :-)
MichaelRevell Jun 23, 2013
2ad8706
Merge #84: Lock source poll: Thread safe polling
gauteh Jun 24, 2013
c54156c
Replace Iconv with built-ins for Ruby >=1.9
gauteh May 26, 2013
6ef251d
patch RMail field parser to use UTF-8 regexps and fix_encoding before…
gauteh May 26, 2013
c7cb79b
more robust fix_encoding
gauteh May 26, 2013
4a396c5
Don't require iconv anymore
gauteh May 26, 2013
ad5d92b
use fix_encoding, not force_encoding
gauteh May 28, 2013
ff4751d
refactor transcode
gauteh May 31, 2013
05971f6
un-support ruby 1.9.2
gauteh Jun 24, 2013
d127f1f
Merge branch 'develop' into rmail-to-mail-initial
gauteh Jun 24, 2013
2ee93b2
less debug
gauteh Jun 24, 2013
4a9c299
prepare for 0.13.1
gauteh Jun 21, 2013
ec82ad2
Load libc.so.7 instead of .6 on FreeBSD
stlawrance Jun 24, 2013
f53aa68
Prepare for release 0.13.2 (CONTRIBUTORS for this branch)
gauteh Jun 26, 2013
5473803
Implement Redwood::Util::Query.describe(query)
5long Jul 1, 2013
e692f39
Apply Util::Query.describe when parsing query
5long Jul 1, 2013
4d685e3
Merge pull request #96 from 5long/fix-encoding-of-query-desc
5long Jul 7, 2013
6d6d2e1
require Util::Query to prevent crash on search
ericweikl Jul 7, 2013
0891e46
Merge pull request #100 from ericweikl/fix-missing-require
5long Jul 7, 2013
6d91498
Enable CJK n-gram tokenization
5long Jul 9, 2013
5728946
Merge pull request #102 from 5long/enable-cjk-tokenization
5long Jul 14, 2013
98112f8
s/methods.include?/respond_to?
5long Jul 14, 2013
9a544e3
Hoist NORMAL_PREFIX and BOOLEAN_PREFIX
5long Jul 14, 2013
b76b7a9
Collect query prefixes in Index::COMPL_PREFIXES
5long Jul 14, 2013
e22fd7e
Add failing test for bad input to query
gauteh Jul 15, 2013
256e36a
raise exception for bad string in query description
gauteh Jul 21, 2013
fc36a8f
Remove ws
gauteh Jul 22, 2013
ffca8c4
Merge branch 'test_invalid_sequence' into develop
gauteh Jul 22, 2013
99ff924
Debug output more details when a message cannot be loaded
gauteh Jul 22, 2013
90c45f6
s/inspect?/inspect/
gauteh Jul 23, 2013
48987e0
Ensure sent message is polled / re-read after storing
gauteh Jul 23, 2013
9efb32f
Merge #107: Use fix_encoding and transcode in place of force_encoding
gauteh Jul 22, 2013
1728fa2
Launch a new thread inside trap
Jul 23, 2013
6b24e17
Implement String#display_length w/ unicode library
5long May 26, 2013
5e222ea
Implement String#slice_by_display_length
5long Jun 30, 2013
b0db013
Rename test file to conform to test_* convention
5long Jun 30, 2013
2a76b64
Use slice_by_display_length in Buffer#write
5long Jun 30, 2013
5fa434f
Use with slice_by_display_length when composing threadline
5long Jun 30, 2013
ba9ae24
Make String#wrap display_length aware
5long Jun 30, 2013
07763b0
Rename test file to conform to test_* convetion
5long Jun 30, 2013
6718c56
Update source.rb documentation comments
gauteh Jul 29, 2013
29985bd
Fix Gemfile rubygem source address.
Jul 30, 2013
38789a4
Fail if alternate emails are not specified as array in config.yaml
gauteh Aug 3, 2013
e473648
handle utf-8 completions and r/w encodings for labels and contacts
gauteh Aug 3, 2013
c6bd0a6
encoding header for lib/sup.rb
gauteh Aug 3, 2013
9b36d1c
add encoding header to compose_mode.rb
gauteh Aug 3, 2013
401cb4a
Merge branch 'develop' into rmail-to-mail-initial
gauteh Aug 3, 2013
2e1c07d
re-add safe_id
gauteh Aug 3, 2013
bf389cd
re-add safe_ref to prefix
gauteh Aug 3, 2013
23b5af1
Merge branch 'utf-8_completions' into rmail-to-mail-initial
gauteh Aug 3, 2013
afd6392
typo in poll.rb debug message
gauteh Aug 9, 2013
08ebfc4
Run write sent message in separate ::Thread
gauteh Aug 10, 2013
bfb9045
Merge #119
gauteh Aug 11, 2013
b424243
Merge #120
gauteh Aug 11, 2013
455f28f
Merge #121
gauteh Aug 11, 2013
9ce9c17
Merge branch 'develop' into rmail-to-mail-initial
gauteh Aug 12, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,7 +3,6 @@ language: ruby
rvm:
- 2.0.0
- 1.9.3
- 1.8.7

before_install:
- sudo apt-get update -qq
Expand All @@ -14,3 +13,4 @@ script: bundle exec rake travis
matrix:
allow_failures:
- rvm: 2.0.0
- rvm: 1.9.3
37 changes: 18 additions & 19 deletions CONTRIBUTORS
@@ -1,8 +1,8 @@
William Morgan <wmorgan-sup at the masanjin dot nets>
William Morgan <william at the twitter dot coms>
Rich Lane <rlane at the club.cc.cmu dot edus>
Gaute Hope <eg at the gaute.vetsj dot coms>
Hamish Downer <dmishd at the gmail dot coms>
Whyme Lyu <callme5long at the gmail dot coms>
Hamish Downer <dmishd at the gmail dot coms>
Sascha Silbe <sascha-pgp at the silbe dot orgs>
Ismo Puustinen <ismo at the iki dot fis>
Nicolas Pouillard <nicolas.pouillard at the gmail dot coms>
Expand All @@ -21,47 +21,46 @@ Eric Weikl <eric.weikl at the tngtech dot coms>
Christopher Warrington <chrisw at the rice dot edus>
W. Trevor King <wking at the drexel dot edus>
Richard Brown <rbrown at the exherbo dot orgs>
Anthony Martinez <pi+sup at the pihost dot uss>
Marc Hartstein <marc.hartstein at the alum.vassar dot edus>
Israel Herraiz <israel.herraiz at the gmail dot coms>
Anthony Martinez <pi+sup at the pihost dot uss>
Bo Borgerson <gigabo at the gmail dot coms>
William Erik Baxter <web at the superscript dot coms>
Michael Hamann <michael at the content-space dot des>
William Erik Baxter <web at the superscript dot coms>
Jonathan Lassoff <jof at the thejof dot coms>
Grant Hollingworth <grant at the antiflux dot orgs>
Markus Klinik <markus.klinik at the gmx dot des>
Ico Doornekamp <ico at the pruts dot nls>
Adeodato Simó <dato at the net.com.org dot ess>
Daniel Schoepe <daniel.schoepe at the googlemail dot coms>
Jason Petsod <jason at the petsod dot orgs>
Steve Goldman <sgoldman at the tower-research dot coms>
Edward Z. Yang <edwardzyang at the thewritingpot dot coms>
Robin Burchell <viroteck at the viroteck dot nets>
Steve Goldman <sgoldman at the tower-research dot coms>
Peter Harkins <ph at the malaprop dot orgs>
Edward Z. Yang <ezyang at the MIT dot EDUs>
Decklin Foster <decklin at the red-bean dot coms>
Cameron Matheson <cam+sup at the cammunism dot orgs>
Carl Worth <cworth at the cworth dot orgs>
Alex Vandiver <alex at the chmrr dot nets>
Jeff Balogh <its.jeff.balogh at the gmail dot coms>
Alex Vandiver <alexmv at the mit dot edus>
Andrew Pimlott <andrew at the pimlott dot nets>
Matías Aguirre <matiasaguirre at the gmail dot coms>
Anthony Martinez <pi at the pihost dot uss>
Kornilios Kourtis <kkourt at the cslab.ece.ntua dot grs>
Kevin Riggle <kevinr at the free-dissociation dot coms>
Giorgio Lando <patroclo7 at the gmail dot coms>
Kevin Riggle <kevinr at the free-dissociation dot coms>
Benoît PIERRE <benoit.pierre at the gmail dot coms>
Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
Eric Weikl <eric.weikl at the gmx dot nets>
Steven Lawrance <stl at the koffein dot nets>
Jonah <Jonah at the GoodCoffee dot cas>
ian <ian at the lorf dot orgs>
Adam Lloyd <adam at the alloy-d dot nets>
ian <itaylor at the uark dot edus>
MichaelRevell <mikearevell at the gmail dot coms>
Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
Adam Lloyd <adam at the alloy-d dot nets>
Steven Walter <swalter at the monarch.(none)>
Alex Vandiver <alex at the chmrr dot nets>
Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
Jon M. Dugan <jdugan at the es dot nets>
Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
Stefan Lundström <lundst at the snabb.(none)>
Matthias Vallentin <vallentin at the icir dot orgs>
Steven Lawrance <stl at the redhat dot coms>
Jonathan Lassoff <jof at the thejof dot coms>
ian <itaylor at the uark dot edus>
Gregor Hoffleit <gregor at the hoffleit dot des>
Stefan Lundström <lundst at the snabb.(none)>
Whyme.Lyu <callme5long at the gmail dot coms>
Kirill Smelkov <kirr at the landau.phys.spbu dot rus>
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,3 +1,3 @@
source 'http://rubygems.org/'
source 'https://rubygems.org/'

gemspec
9 changes: 9 additions & 0 deletions History.txt
@@ -1,3 +1,12 @@
== 0.13.2 / 2013-06-26

* FreeBSD 10 comptability
* More threadsafe polling

== 0.13.1 / 2013-06-21

* Bugfixes

== 0.13.0 / 2013-05-15

* Bugfixes
Expand Down
8 changes: 8 additions & 0 deletions ReleaseNotes
@@ -1,3 +1,11 @@
Release 0.13.2:

FreeBSD compatability and more thread safe polling.

Release 0.13.1:

Another ruby 1.8 compatible release, various fixes.

Release 0.13.0:

Collection of bugfixes and stability fixes since 0.12.1. We now depend on our
Expand Down
22 changes: 12 additions & 10 deletions bin/sup
@@ -1,3 +1,5 @@
# encoding: utf-8

#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
Expand Down Expand Up @@ -106,15 +108,14 @@ end
## ncurses.so that's been compiled against libncursesw. (note the w.) why
## this works, i have no idea. much like pretty much every aspect of
## dealing with curses. cargo cult programming at its best.
##
## BSD users: if libc.so.6 is not found, try installing compat6x.
require 'dl/import'
require 'rbconfig'
module LibC
extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
setlocale_lib = case RbConfig::CONFIG['arch']
when /darwin/; "libc.dylib"
when /cygwin/; "cygwin1.dll"
when /freebsd/; "libc.so.7"
else; "libc.so.6"
end

Expand All @@ -127,9 +128,6 @@ module LibC
rescue RuntimeError => e
warn "cannot dlload setlocale(); ncurses wide character support probably broken."
warn "dlload error was #{e.class}: #{e.message}"
if RbConfig::CONFIG['arch'] =~ /bsd/
warn "BSD variant detected. You may have to install a compat6x package to acquire libc."
end
end
end

Expand Down Expand Up @@ -162,7 +160,11 @@ begin

$die = false
trap("TERM") { |x| $die = true }
trap("WINCH") { |x| BufferManager.sigwinch_happened! }
trap("WINCH") do |x|
::Thread.new do
BufferManager.sigwinch_happened!
end
end

if(s = Redwood::SourceManager.source_for DraftManager.source_name)
DraftManager.source = s
Expand Down Expand Up @@ -294,8 +296,8 @@ begin
b.mode.load_in_background if new
when :search
completions = LabelManager.all_labels.map { |l| "label:#{LabelManager.string_for l}" }
completions = completions.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) }
completions += ["from:", "to:", "after:", "before:", "date:", "limit:", "AND", "OR", "NOT"]
completions = completions.each { |l| l.fix_encoding }
completions += Index::COMPL_PREFIXES
query = BufferManager.ask_many_with_completions :search, "Search all messages (enter for saved searches): ", completions
unless query.nil?
if query.empty?
Expand All @@ -308,7 +310,7 @@ begin
SearchResultsMode.spawn_from_query "is:unread"
when :list_labels
labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
labels = labels.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) }
labels = labels.each { |l| l.fix_encoding }

user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
unless user_label.nil?
Expand Down Expand Up @@ -416,7 +418,7 @@ unless Redwood::exceptions.empty?
We are very sorry. It seems that an error occurred in Sup. Please
accept our sincere apologies. Please submit the contents of
#{BASE_DIR}/exception-log.txt and a brief report of the
circumstances to https://github.com/sup-heliotrope/sup/issues so that
circumstances to https://github.com/sup-heliotrope/sup/issues so that
we might address this problem. Thank you!

Sincerely,
Expand Down
110 changes: 110 additions & 0 deletions bin/sup-migrate-index
@@ -0,0 +1,110 @@
#!/usr/bin/env ruby

require 'uri'
require 'rubygems'
require 'trollop'
require "sup"; Redwood::check_library_version_against "git"

PROGRESS_UPDATE_INTERVAL = 15 # seconds

class AbortExecution < SystemExit
end

opts = Trollop::options do
version "sup-migrate-index (sup #{Redwood::VERSION})"
banner <<EOS
Updates the index from version 4 to 5 by changing ids and references to safe
ids.

Usage:
sup-migrate-index [options]

Options:
EOS
opt :verbose, "Print message ids as they're processed."
opt :ignore_missing, "Silently skip over messages that are not in the index."
opt :warn_missing, "Warn about messages that are not in the index, but continue."
opt :abort_missing, "Abort on encountering messages that are not in the index. (default)"
opt :atomic, "Use transaction to apply all changes atomically."
opt :dry_run, "Don't actually modify the index. Probably only useful with --verbose.", :short => "-n"
opt :version, "Show version information", :short => :none

conflicts :ignore_missing, :warn_missing, :abort_missing
end
Trollop::die "Extra arguments given" if ARGV.length > 1
missing_action = [:ignore_missing, :warn_missing, :abort_missing].find { |x| opts[x] } || :abort_missing

BASE_DIR = ENV["SUP_BASE"] || File.join(ENV["HOME"], ".sup")


Redwood::start
index = Redwood::Index.init

#index.lock_interactively or exit


info "Starting migration to version 5.."

index.load true

xapian = index.get_xapian
db_version = xapian.get_metadata 'version'
db_version = '0' if db_version.empty?

fail "It only makes sense to migrate from version 4 to 5, you have an index version #{db_version}" unless db_version == '4'

num_docs = 0
xapian.postlist('Kmail').each do |x|
info "Updating document: #{x.inspect}"
num_docs += 1

doc = xapian.document(x.docid)
entry = doc.entry

debug "Working on entry: #{entry[:message_id]}."

debug "Adding missing fields.."
entry[:safe_id] = Redwood::Message.munge_msgid(entry[:message_id])
entry[:safe_refs] += entry[:refs].nil? ? [] : entry[:refs].compact.map { |r| rr = Redwood::Message.munge_msgid(r); debug "addin ref #{r} -> #{rr}.."; rr }
entry[:safe_refs] = entry[:safe_refs].uniq


entry[:safe_replytos] = entry[:replytos].nil? ? [] : entry[:replytos].compact.map { |r| rr = Redwood::Message.munge_msgid(r); debug "addin replyto #{r} -> #{rr}.."; rr }

next if opts[:dry_run]
doc.entry = entry

info "Storing message.."
xapian.replace_document x.docid, doc
k = xapian.document x.docid
info "stored safe_id: " + k.value(0)

debug "Loading message.."
#locations = entry[:locations].map do |source_id,source_info|
#source = Redwood::SourceManager[source_id]
#raise "invalid source #{source_id}" unless source
#Redwood::Location.new source, source_info
#end

#m = Redwood::Message.new :locations => locations,
#:labels => entry[:labels],
#:snippet => entry[:snippet]

## Try to find person from contacts before falling back to
## generating it from the address.
#mk_person = lambda { |x| Redwood::Person.from_name_and_email(*x.reverse!) }
#entry[:from] = mk_person[entry[:from]]
#entry[:to].map!(&mk_person)
#entry[:cc].map!(&mk_person)
#entry[:bcc].map!(&mk_person)

#m.load_from_index! entry
#m.load_from_source!

break


end

info "done, updated: #{num_docs} documents."

16 changes: 16 additions & 0 deletions bin/sup-psych-ify-config-files
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require "sup"
require "fileutils"

Redwood.start

fn = Redwood::SOURCE_FN
FileUtils.cp fn, "#{fn}.syck_bak"

Redwood::SourceManager.load_sources fn
Redwood::SourceManager.save_sources fn, true

Redwood.finish
2 changes: 1 addition & 1 deletion bin/sup-tweak-labels
Expand Up @@ -85,7 +85,7 @@ begin

parsed_query = index.parse_query query
parsed_query.merge! :load_spam => true, :load_deleted => true, :load_killed => true
ids = Enumerator.new(index, :each_id, parsed_query)
ids = index.to_enum(:each_safe_id, parsed_query)
num_total = index.num_results_for parsed_query

$stderr.puts "Found #{num_total} documents across #{source_ids.length} sources. Scanning..."
Expand Down
2 changes: 1 addition & 1 deletion devel/console.sh 100644 → 100755
@@ -1,3 +1,3 @@
#!/bin/sh

irb -I lib -r devel/start-console.rb
irb -I lib -r ./devel/start-console.rb
4 changes: 2 additions & 2 deletions doc/FAQ.txt
Expand Up @@ -21,8 +21,8 @@ A: I hate ads, I hate using a mouse, and I hate non-programmability and

Q: Why the console?
A: Because a keystroke is worth a hundred mouse clicks, as any Unix
user knows. Because you don't need web browser. Because you get
instantaneous response and a simple interface.
user knows. Because you don't need a web browser. Because you get
an instantaneous response and a simple interface.

Q: How does Sup deal with spam?
A: You can manually mark messages as spam, which prevents them from
Expand Down