commit ea36cf4f01db6ff15d00594b45cc25a79364f164
parent c6d132ee060a6885a05b696f7cc65bc1b078e21d
Author: Gaute Hope <eg@gaute.vetsj.com>
Date: Sat, 22 Mar 2014 11:51:15 +0100
Various generic changes from use-mail
Diffstat:
8 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
@@ -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_id, parsed_query)
num_total = index.num_results_for parsed_query
$stderr.puts "Found #{num_total} documents across #{source_ids.length} sources. Scanning..."
diff --git a/devel/console.sh b/devel/console.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-irb -I lib -r devel/start-console.rb
+irb -I lib -r ./devel/start-console.rb
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -2,7 +2,6 @@
require 'rubygems'
require 'yaml'
-YAML::ENGINE.yamler = 'psych'
require 'zlib'
require 'thread'
require 'fileutils'
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
@@ -98,9 +98,9 @@ EOS
end
end
- def load
+ def load failsafe=false
SourceManager.load_sources
- load_index
+ load_index failsafe
end
def save
@@ -110,7 +110,11 @@ EOS
save_index
end
- def load_index
+ def get_xapian
+ @xapian
+ end
+
+ def load_index failsafe=false
path = File.join(@dir, 'xapian')
if File.exists? path
@xapian = Xapian::WritableDatabase.new(path, Xapian::DB_OPEN)
@@ -329,7 +333,7 @@ EOS
synchronize { get_entry(id)[:source_id] }
end
- ## Yields each tearm in the index that starts with prefix
+ ## Yields each term in the index that starts with prefix
def each_prefixed_term prefix
term = @xapian._dangerous_allterms_begin prefix
lastTerm = @xapian._dangerous_allterms_end prefix
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'time'
module Redwood
diff --git a/lib/sup/message_chunks.rb b/lib/sup/message_chunks.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'tempfile'
require 'rbconfig'
require 'shellwords'
diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
@@ -105,7 +105,7 @@ EOS
begin
hostname = File.open("/etc/mailname", "r").gets.chomp
rescue
- nil
+ nil
end
hostname = Socket.gethostname if hostname.nil? or hostname.empty?
diff --git a/lib/sup/thread.rb b/lib/sup/thread.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+#
## Herein lies all the code responsible for threading messages. It's
## basically an online version of the JWZ threading algorithm:
## http://www.jwz.org/doc/threading.html