Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Feature suggestion for hooks
@ 2007-12-15 23:27 Ismo Puustinen
  2007-12-19  4:36 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Ismo Puustinen @ 2007-12-15 23:27 UTC (permalink / raw)


Hi,

I have a small script that works as a biff-like new mail indicator. 
The script would need as input the amount of unread mail in the 
inbox. The problem is that the after-poll hook apparently has no 
way of knowing how much unread mail there currenly is -- it only 
knows the number added during this poll. I think that after-poll 
is the only non-interactive place where the number of total unread 
mail might change. Would it be possible to add that number as an 
internal variable to be accessible from the after-poll hook? 

An even better option might be to add these computationally 
intensive operations to an internal API that would be callable from 
the hooks. This way the variables would not need to be computed 
if the hook didn't need them. 

-- 
Ismo Puustinen <ismo at iki.fi>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [sup-talk] Feature suggestion for hooks
  2007-12-15 23:27 [sup-talk] Feature suggestion for hooks Ismo Puustinen
@ 2007-12-19  4:36 ` William Morgan
  0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2007-12-19  4:36 UTC (permalink / raw)


Excerpts from Ismo Puustinen's message of Sat Dec 15 15:27:59 -0800 2007:
> I have a small script that works as a biff-like new mail indicator. 
> The script would need as input the amount of unread mail in the 
> inbox. The problem is that the after-poll hook apparently has no 
> way of knowing how much unread mail there currenly is -- it only 
> knows the number added during this poll.

I've added a num_inbox_total_unread variable to the after-poll hook.

> An even better option might be to add these computationally intensive
> operations to an internal API that would be callable from the hooks.
> This way the variables would not need to be computed if the hook
> didn't need them. 

The hook system supports this though its "variables" already---passed in
variables can be lambdas which are not evaluated unless needed (and then
they're cached). I do this for the above, although it's not really an
expensive operation thanks to Ferret.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-19  4:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-15 23:27 [sup-talk] Feature suggestion for hooks Ismo Puustinen
2007-12-19  4:36 ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox