Getting started
Channel hooks are set up by creating a configuration file that has a .HOOK extension. The main parameters are defined like this:
[Config]
ScriptFilename=...
DisplayName=...
AuthorName=...
AuthorEmailAddress=...
Notes=...
ScriptFilename specifies where the actual channel hook script lives. If it is not an absolute path then it is assumed that it is in the same directory as the .HOOK file.
Registering for events
Channel hooks must register for the events that they want to be called for. The available events are:
- ChannelHookLoaded
Raised when the channel hook has been loaded.
- ChannelHookAttached
Raised when the channel hook has been attached to the channel.
- ChannelHookDetached
Raised when the channel hook has been detached from the channel.
- BeginChannelUpdate
Raised just before the channel is updated.
- EndChannelUpdate
Raised after the channel has been updated.
- NewFeedItem
Raised when a new feed item has been received for the channel.
A new process is started to run the channel hook for every event. If a hook wants to be notified of new feed items, it is far better to register for the ConsolidatedNewFeedItems event (to handle all the new feed items in one go), rather than the NewFeedItem event (which will be much slower since it will incur a run of the channel hook for each new feed item).
- ConsolidatedNewFeedItems
Raised when one or more new feed items have been received for the channel.
- ChannelAutoDownloadCompleted
Raised after an enclosure has finished being downloaded.
- ChannelAutoDownloadCleanup
Raised just before a previously-downloaded enclosure is deleted (because it is too old).
- MarkFeedItemAsViewed
Raised when a feed item is marked as read/unread.
- MarkAllFeedItemsAsViewed
Raised when all feed items are marked as read/unread.
- ChannelConfigChanged
Raised whenever the channel's configuration is changed.
- ChannelError
Raised whenever an error occurs on the channel.
A channel hook indicates that it wants to be notified of an event by including it in the [Events] section in the .HOOK file. For example:
[Events]
BeginChannelUpdate=1
ConsolidatedNewFeedItems=1
Whenever an event the channel hook has registered for occurs, it will be called and passed an INI file that contains detailed information about the event.