Platform SDK: Chat Server

Canceling Events

The administrator can load several extensions onto the chat service simultaneously. These extensions will be ordered (prioritized) so that each one has a chance to act in turn on an event.

An extension can either modify events in progress or prevent them from completing. Some callback methods (those with a Cancel parameter) can return either a failure code or a zero during the pre-update invocation to either cancel an event or allow it to complete, respectively. Canceling the event notification blocks subsequent calls to any lower priority extensions that may be installed.

The following table associates the value returned in the Cancel parameter with the action performed by the chat server in response.

Return value Action performed
False (0) The event is passed to the next extension in descending priority order. If no other extension callbacks cancel the event, the server finalizes the event.

True ( – 1) The event is canceled. No further extension callbacks are invoked. The server does not send any response or error message to the user who caused the event.

IRC/IRCX error The event is canceled and an error message is returned to the user. The return value may be any IRC or IRCX numeric error code. (See section 6.1 of RFC1459 and 9.2 in the IRCX draft.) If the error code is recognized, a response is sent in the format

<server> <nick> 999 :Extension issued error <code> <title>

where title is the text description of the IRC/IRCX error code. If the error code is unrecognized, title is not displayed.

Extensions can return additional error information, as required. If you need to return a specifically formatted error message so as to affect the user's client in a specific manner, you should cancel the event with True ( – 1) and use ProtocolMessageOut to transmit the specific error text.