on PARSELINE

 

The on PARSELINE event triggers before incoming/outgoing server lines are received/sent and allows a script to modify them.

 

Format:        on <level>:PARSELINE:<in|out|*>:matchtext:<commands>

Example:        on *:PARSELINE:*:*:echo $parsetype $parseline

 

The /parseline command

The incoming/outgoing server line can be modified using the following command:

 

/parseline -iotbqpnuN [text|&binvar]

 

-i or -o = required to specify an in/out line.

 

-t or -b = required to specify text or &binvar.

 

-q = add a new line to the end of the in/out queue. It can be used inside and outside the PARSELINE event. New lines are processed after the script/event exits.

 

-p = use with -q to indicate that the new line should trigger the PARSELINE event.

 

-n = add a CRLF to the end of the line if it does not have one.

 

-uN = where N is 0 or 1 and either disables or enables UTF-8 encoding/decoding for the line.

 

Notes: A script must check $parseutf to know whether mIRC will be UTF-8 encoding/decoding a line. For outgoing lines, if $parseutf is $true, after the PARSELINE event, mIRC will UTF-8 encode the line before sending it to the server. You can prevent this by using -u0. For incoming lines, if $parseutf is $true, after the PARSELINE event, mIRC will UTF-8 decode the line before processing it. You can prevent this by using -u0.

 

Warning: This feature should only be used, for example, to support features and/or protocols that mIRC does not already support, not to modify standard lines. mIRC maintains internal states based on incoming and outgoing lines. If lines are modified, mIRC may not work correctly.

 

Examples

 

; This example converts incoming/outgoing lines to upper case

on *:PARSELINE:*:*:{

 echo PARSELINE: $parsetype : $parseutf : $parseline

 

 if ($parsetype == in) {

   var %pl = $parseline

 

   ; UTF decode the line ourselves

   if ($parseutf) %pl = $utfdecode(%pl)

 

   ; Convert the line to upper case

   %pl = $upper(%pl)

 

   ; Replace the current incoming line with our line

   ; We use -u0 to prevent mIRC from UTF decoding the line as we have already done that

   parseline -itu0 %pl

 

   ; The line will only be processed after our script returns

   return

 }

 

 if ($parsetype == out) {

   var %pl = $parseline

 

   ; Convert line to upper case

   %pl = $upper(%pl)

 

   ; UTF encode the line ourselves

   if ($parseutf) %pl = $utfencode(%pl)

 

   ; Replace the current outgoing line with our line

   ; We use -u0 to prevent mIRC from UTF encoding the line as we have already done that

   parseline -otu0 %pl

 

   ; The line will only be processed after our script returns

   return

 }

 

 ; The original incoming/outgoing line will be processed as normal

}