On open
The on OPEN events trigger for various events relating to the opening of a window.
on <level>:OPEN:<?|@|=|!|*>:<matchtext>:<commands>
The matchtext can be a wildcard match or even a regular expression.
To use regular expressions as matchtext, you need the $-Prefix.
Read access levels to get more info about the <level> field.
The location where this event occurrs can be either a channel (#), a query (?), a DCC-window (=) or a fileserver-window (!) or everything (*).
Note that in the case of dcc sessions, it is trigger when a dcc connection has opened.
Example
on *:Open:?:*: { echo -a $target has just opened a query window with you! }
This example reacts on every opening query and echos it to the active window.
on ^*:Open:?:*: { if ($target == idiot) { halt } }
This example also reacts on every opening query but before the window has opened, checks if the nick is idiot and if it is, halts the opening.
See Also
To trigger on the closing of a window, check the On close event.