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

Use Mail gem over RMail #127

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require 'fileutils'
require 'locale'
require 'ncursesw'
require 'rmail'
require 'mail'
begin
require 'fastthread'
rescue LoadError
Expand Down
1 change: 1 addition & 0 deletions lib/sup/crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def initialize
@mutex = Mutex.new

@not_working_reason = nil
@not_working_reason = "The crypto code needs to be ported to use Mail not RMail"

# test if the gpgme gem is available
@gpgme_present =
Expand Down
3 changes: 2 additions & 1 deletion lib/sup/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ def load_index failsafe=false
if false
info "Upgrading index format #{db_version} to #{INDEX_VERSION}"
@xapian.set_metadata 'version', INDEX_VERSION

elsif db_version != INDEX_VERSION
fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please run sup-dump to save your labels, move #{path} out of the way, and run sup-sync --restore."
fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please run sup-dump to save your labels, move #{path} out of the way, and run sup-sync --restore." unless failsafe
end
else
@xapian = Xapian::WritableDatabase.new(path, Xapian::DB_CREATE)
Expand Down
8 changes: 7 additions & 1 deletion lib/sup/maildir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def load_header id
end

def load_message id
with_file_for(id) { |f| RMail::Parser.read f }
with_file_for(id) do |f|
begin
Mail.read_from_string f.read
rescue
raise SourceError
end
end
end

def sync_back id, labels
Expand Down
4 changes: 2 additions & 2 deletions lib/sup/mbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def load_message offset
until @f.eof? || MBox::is_break_line?(l = @f.gets)
string << l
end
RMail::Parser.read string
rescue RMail::Parser::Error => e
Mail.read_from_string string
rescue e
raise FatalSourceError, "error parsing mbox file: #{e.message}"
end
end
Expand Down
Loading