]> git.cworth.org Git - sup/commitdiff
add extra-contact-addresses hook
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 6 Apr 2008 00:02:35 +0000 (17:02 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 6 Apr 2008 00:02:35 +0000 (17:02 -0700)
lib/sup/buffer.rb

index 92180adebfbd332800de5c74c96b18cdcc069985..ebc3587bb44ea547ce2ef665fdf893b10296e23e 100644 (file)
@@ -165,6 +165,15 @@ called at least once per keystroke, so excessive computation is discouraged.
 
 Variables: the same as status-bar-text hook.
 Return value: a string to be used as the terminal title.
+EOS
+
+  HookManager.register "extra-contact-addresses", <<EOS
+A list of extra addresses to propose for tab completion, etc. when the
+user is entering an email address. Can be plain email addresses or can
+be full "User Name <email@domain.tld>" entries.
+
+Variables: none
+Return value: an array of email address strings.
 EOS
 
   def initialize
@@ -493,6 +502,7 @@ EOS
     contacts = ContactManager.contacts.map { |c| [ContactManager.alias_for(c), c.full_address, c.email] }
 
     completions = (recent + contacts).flatten.uniq.sort
+    completions += HookManager.run("extra-contact-addresses") || []
     answer = BufferManager.ask_many_emails_with_completions domain, question, completions, default
 
     if answer