]> git.cworth.org Git - sup/blobdiff - bin/sup
xapian index format versioning
[sup] / bin / sup
diff --git a/bin/sup b/bin/sup
old mode 100644 (file)
new mode 100755 (executable)
index 0af3d11..a8eacca
--- a/bin/sup
+++ b/bin/sup
@@ -5,7 +5,6 @@ require 'ncurses'
 require 'curses'
 require 'fileutils'
 require 'trollop'
-require 'fastthread'
 require "sup"
 
 BIN_VERSION = "git"
@@ -79,6 +78,7 @@ global_keymap = Keymap.new do |k|
   k.add :compose, "Compose new message", 'm', 'c'
   k.add :nothing, "Do nothing", :ctrl_g
   k.add :recall_draft, "Edit most recent draft message", 'R'
+  k.add :show_inbox, "Show the Inbox buffer", 'I'
 end
 
 ## the following magic enables wide characters when used with a ruby
@@ -89,7 +89,7 @@ end
 ## BSD users: if libc.so.6 is not found, try installing compat6x.
 require 'dl/import'
 module LibC
-  extend DL::Importable
+  extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
   setlocale_lib = case Config::CONFIG['arch']
     when /darwin/; "libc.dylib"
     when /cygwin/; "cygwin1.dll"
@@ -161,18 +161,17 @@ begin
   Redwood::start
   Index.load
 
-  if(s = Index.source_for DraftManager.source_name)
+  if(s = Redwood::SourceManager.source_for DraftManager.source_name)
     DraftManager.source = s
   else
     Redwood::log "no draft source, auto-adding..."
-    Index.add_source DraftManager.new_source
+    Redwood::SourceManager.add_source DraftManager.new_source
   end
 
-  if(s = Index.source_for SentManager.source_name)
+  if(s = Redwood::SourceManager.source_for SentManager.source_uri)
     SentManager.source = s
   else
-    Redwood::log "no sent mail source, auto-adding..."
-    Index.add_source SentManager.new_source
+    Redwood::SourceManager.add_source SentManager.default_source
   end
 
   HookManager.run "startup"
@@ -192,7 +191,7 @@ begin
 
   bm.draw_screen
 
-  Index.usual_sources.each do |s|
+  Redwood::SourceManager.usual_sources.each do |s|
     next unless s.respond_to? :connect
     reporting_thread("call #connect on #{s}") do
       begin
@@ -203,7 +202,7 @@ begin
     end
   end unless $opts[:no_initial_poll]
   
-  imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
+  imode.load_threads :num => ibuf.content_height, :when_done => lambda { |num| reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] }
 
   if $opts[:compose]
     ComposeMode.spawn_nicely :to_default => $opts[:compose]
@@ -298,6 +297,8 @@ begin
         b, new = BufferManager.spawn_unless_exists("All drafts") { LabelSearchResultsMode.new [:draft] }
         b.mode.load_threads :num => b.content_height if new
       end
+    when :show_inbox
+      BufferManager.raise_to_front ibuf
     when :nothing, InputSequenceAborted
     when :redraw
       bm.completely_redraw_screen