on OPEN/CLOSE
The on OPEN and on CLOSE events trigger for various events relating to the opening and closing of a window of different types of windows. In the case of dcc sessions, they trigger when a dcc connection has opened or closed.
Format: on <level>:OPEN|CLOSE:<?|@|=|!|*>:<matchtext>:<commands> Example: on 1:CLOSE:?:echo -s closed $target query window
For an explanation of matchtext see the on TEXT event.
Examples
on ^1:OPEN:?:*:if ($nick == goat) halt
The above open event is an example of a ^ prefix event, which allows you to halt events. In this example, if the incoming message is from a user with the nickname goat, the query window is prevented from opening by using the /halt command.
Note: If you halt an on ^open event triggered by an incoming private message, no on TEXT/ACTION events are triggered.
on 1:OPEN:?:*:/echo -s Just opened $target query window
The above example triggers just after a query window is opened.
on 1:OPEN:?:*hello*:/echo -s $nick just said hello!
This example triggers if the message which trigger on OPEN contained the word hello. This allows you to react to user message in on OPEN instead of waiting for on TEXT to trigger.
on 1:CLOSE:?:/echo -s you just closed $target query window
This triggers when you close a query window.
on 1:OPEN:=:/msg =$nick Hi! I will be with you in a second...
This triggers when a dcc chat connection is first established. The equal sign in =$nick is required to send the reply as a dcc chat message.
on 1:CLOSE:=:/notice $me $nick just left the discussion!
This triggers when a dcc chat session ends, or when you close your chat window manually.
on 1:OPEN:!:/msg =$nick Welcome to my fileserver! on 1:CLOSE:!:/echo -s $nick just ended her fileserver session
These trigger when a dcc filserver session is first established and when it is closed.
Note: DCC events react to all users level 1 and above because of the way DCCs work.
on 1:CLOSE:@:/echo -s Just closed $target custom window
The above triggers when a custom window is closed. The OPEN event does not trigger for custom windows.
Note: These events do not trigger for any other types of windows. Channel windows are handled by the on JOIN/PART events. |