lib/sup.rb in sup-0.1 vs lib/sup.rb in sup-0.2
- old
+ new
@@ -1,10 +1,11 @@
require 'rubygems'
require 'yaml'
require 'zlib'
require 'thread'
require 'fileutils'
+require 'curses'
class Object
## this is for debugging purposes because i keep calling #id on the
## wrong object and i want it to throw an exception
def id
@@ -29,11 +30,11 @@
end
end
end
module Redwood
- VERSION = "0.1"
+ VERSION = "0.2"
BASE_DIR = ENV["SUP_BASE"] || File.join(ENV["HOME"], ".sup")
CONFIG_FN = File.join(BASE_DIR, "config.yaml")
SOURCE_FN = File.join(BASE_DIR, "sources.yaml")
LABEL_FN = File.join(BASE_DIR, "labels.txt")
@@ -41,10 +42,11 @@
CONTACT_FN = File.join(BASE_DIR, "contacts.txt")
DRAFT_DIR = File.join(BASE_DIR, "drafts")
SENT_FN = File.join(BASE_DIR, "sent.mbox")
LOCK_FN = File.join(BASE_DIR, "lock")
SUICIDE_FN = File.join(BASE_DIR, "please-kill-yourself")
+ HOOK_DIR = File.join(BASE_DIR, "hooks")
YAML_DOMAIN = "masanjin.net"
YAML_DATE = "2006-10-01"
## determine encoding and character set
@@ -109,10 +111,11 @@
Redwood::AccountManager.new $config[:accounts]
Redwood::DraftManager.new Redwood::DRAFT_DIR
Redwood::UpdateManager.new
Redwood::PollManager.new
Redwood::SuicideManager.new Redwood::SUICIDE_FN
+ Redwood::CryptoManager.new
end
def finish
Redwood::LabelManager.save if Redwood::LabelManager.instantiated?
Redwood::ContactManager.save if Redwood::ContactManager.instantiated?
@@ -191,22 +194,34 @@
}
},
:editor => ENV["EDITOR"] || "/usr/bin/vim -f -c 'setlocal spell spelllang=en_us' -c 'set filetype=mail'",
:thread_by_subject => false,
:edit_signature => false,
+ :ask_for_cc => true,
+ :ask_for_bcc => false,
+ :confirm_no_attachments => true,
+ :confirm_top_posting => true,
}
begin
FileUtils.mkdir_p Redwood::BASE_DIR
Redwood::save_yaml_obj $config, Redwood::CONFIG_FN
rescue StandardError => e
$stderr.puts "warning: #{e.message}"
end
end
require "sup/util"
+require "sup/hook"
+
+## we have to initialize this guy first, because other classes must
+## reference it in order to register hooks, and they do that at parse
+## time.
+Redwood::HookManager.new Redwood::HOOK_DIR
+
require "sup/update"
require "sup/suicide"
+require "sup/message-chunks"
require "sup/message"
require "sup/source"
require "sup/mbox"
require "sup/maildir"
require "sup/imap"
@@ -222,9 +237,10 @@
require "sup/label"
require "sup/contact"
require "sup/tagger"
require "sup/draft"
require "sup/poll"
+require "sup/crypto"
require "sup/modes/scroll-mode"
require "sup/modes/text-mode"
require "sup/modes/line-cursor-mode"
require "sup/modes/help-mode"
require "sup/modes/edit-message-mode"