mIRC Homepage
Posted By: FroggieDaFrog Scripted CAP registration - 25/11/15 03:53 AM
With the addition of parseline, scripts can now handle non-standardized CAP modules, but currently there is no way for scripts to register such capabilities with mIRC's native CAP support. The only workaround is to hijack CAP negotiations via parseline events which comes with its own sort of troubles. I suggest adding event handling for CAP negotiations and possibly a way to alter the list of natively supported CAP modules.


Code:
on *:CAP:LIST|LS|ACK|NAK:matchtext:{}


LIST|LS|ACK|NAK|END
The CAP sub-event to listen for.
Can be a wildcard.


matchtext
For LIST, LS, ACK this is the list of modules the server responded with
For NAK it is the characters that caused the request to fail


$capevent
Returns the CAP sub-event that triggered the event
Only usable from with in the CAP event


/capmodule -x module
Adds the specified module to the list of modules mIRC will request for the current connection CAP negotiations

-x: removes the specified module


$capmodule(module|n)
If the specified module is in the list of CAP modules to request, the module name is returned.
If n is specified, the nth module to in the list is returned.


Example:
Code:
on *:CAP:*:*:{

  ; check if the network is 'somenet'
  ; and the cap event is either LS or LIST
  if ($network == somenet && ($capevent == LS || $capevent == LIST)) {

    ; check if 'ModA' is not in the cap module list
    ; and the server supports ModA
    if (!$capmodule(ModA) && ModA isin $1-) {

      ; add 'ModA' to the list of modules to Request
      capmodule ModA
    }

    ; check if 'ModB' is in the list of modules to request
    if ($capmodule(ModB)) {

      ; remove it from the list
      capmodule -x ModB
    }
  }
}
Posted By: westor Re: Scripted CAP registration - 25/11/15 09:57 AM
Very good idea +1.
Posted By: FroggieDaFrog Re: Scripted CAP registration - 03/04/16 02:53 AM
bump
Posted By: BhaaL Re: Scripted CAP registration - 03/04/16 09:37 AM
SGTM. Ship it! cool
© mIRC Discussion Forums