sup-heliotrope/sup — pull request #276 by gauteh (2014-03-25 17:59:18+00:00)
Title: New hooks when opening thread-view: determine inital state and modify threads

One hook is run upon opening the thread, so you can loop over the
messages and make modifications upon opening the thread:

Description:
"thread-view-opened"
Executed when a thread is opened

Variables:
thread: thread object with messages (where they exist)
Return value:
None.

Unuseful example:
```rb
log "got thread: #{thread}"

thread.each do |m,d,p|
next unless m

log "message: #{m}"

if m.has_label? :read
log "message: #{m} is :read"
end
end

```

Next is: message-initial-state, determine whether a message should be
toggled opened or closed.

Description:
"message-initial-state"
Executed when determining whether a message should be open
or closed when rendering a thread.

The default behaviour is that :unread and :starred messages
are open.

Variables:
message: message to be rendered
Return value:
state: either :open or :close (default)

Unuseful example, always open all threads:
```rb
log "got message: #{message}"

state = :open # yup, all open

state
```