Subject: [sup-talk] Hooks?

From: [email-masked] (Magnus Therning)
Date: Sun, 02 Sep 2007 00:47:03 +0100

There seems to be extended support for inserting hooks in sup.  However,
any sort of hint as to how to add a hook is missing.  I assume they have
to be written in Ruby, they should probably live in ~/.sup/hooks.
Beyond that it's a little difficult for someone who's never read Ruby
source before to figure things out.  Can anyone offer any example on how
to implement a hook?

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus?therning?org             Jabber: magnus?therning?gmail?com
http://therning.org/magnus

As we enjoy great advantages from the inventions of others we should
be glad of an opportunity to serve others by any invention of
ours, and this we should do freely and generously.
     -- Benjamin Franklin

---

From: [email-masked] (William Morgan)
Date: Sat, 01 Sep 2007 23:28:52 -0700

Excerpts from Magnus Therning's message of Sat Sep 01 16:47:03 -0700 2007:
> There seems to be extended support for inserting hooks in sup.
> However, any sort of hint as to how to add a hook is missing.  I
> assume they have to be written in Ruby, they should probably live in
> ~/.sup/hooks.

Hooks were added just a couple SVN revisions ago so documentation isn't
great. Running sup -l will give you a list of possible hooks and their
corresponding locations on disk. Here's my current set of hooks (and if
you search the list archives I've posted a couple more examples):

$ head .sup/hooks/*.rb
==> .sup/hooks/before-poll.rb <==
if (@last_fetchmail_time || Time.at(0)) < Time.now - 60
  say "Running fetchmail..."
  system "fetchmail >& /dev/null"
  say "Done running fetchmail."
end
@last_fetchmail_time = Time.now

==> .sup/hooks/mime-decode.rb <==
unless sibling_types.member? "text/plain"
  case content_type
  when "text/html"
    `/usr/bin/w3m -dump -T #{content_type} '#{filename}'`
  end
end

==> .sup/hooks/signature.rb <==
"William <#{from_email}>"

-- 
William <wmorgan-sup at masanjin.net>