custom CTCP debug

By l0wner on May 12, 2011

quick and dirty

Uses debug command with hidden window and custom identifier to parse ctcp requests instead of timer. should ignore all ctcps with /ignore -t !@* for best results

shows request in active window in normal ctcp fashion
replies to version and ping as of now should be obvious how to add more.

alias dscan {
  var %dscan.line = $1-
  tokenize 32 %dscan.line
  if ($3 == PRIVMSG) && ($mid($5,2,1) == ) && ($right(%dscan.line,1) == ) {
    var %dscan.request = $remove($5,,:)
    var %dscan.nick = $mid($2,2,$calc($pos($2,!,1) -2))
    if (%dscan.request == ACTION) || ($numtok(%dscan.nick,46) > 1) return
    echo -a $chr(3) $+ $timestamp $+  $+ $color(ctcp) $+($chr(91),%dscan.nick,$chr(32),%dscan.request,$chr(93))
    if (%dscan.request == VERSION) .ctcpreply %dscan.nick VERSION irssi 0.8.12
    if (%dscan.request == PING) .ctcpreply %dscan.nick PING $ctime
    return
  }
  return
}
alias chgver {
  .debug -pi @vchg $+ $network $+($chr(36),dscan,$chr(40),$chr(36),1,-,$chr(41))
  window -h @vchg $+ $network
}
on 1:CONNECT: {
  if (!$window(@vchg $+ $network)) chgver
}

Comments

Sign in to comment.
jaytea   -  May 14, 2011

sure, multiple servers may even share the same debug @window or filename when it IS possible to write to it ;P

 Respond  
l0wner   -  May 14, 2011

would using NUL still work properly with multiple servers?

 Respond  
l0wner   -  May 14, 2011

wonderful thanks, been a long time for me with mirc

 Respond  
jaytea   -  May 14, 2011

ah the ol' /debug version spoof. the first time i saw this i was convinced it was witchcraft :P

just a couple of things about your /debug command: you can prevent mIRC from both opening a window and writing to a file by specifying an invalid/reserved Windows filename as the target. in mIRC scripting circles, it is common to use 'NUL', but other reserved names such as 'AUX', 'CON', 'PRN', etc. are just as effective (or, indeed, ineffective).

also, with /debug -i, it is easier to understand and remember that the arguments you pass as [identifier] (plural since the value for [identifier] may contain spaces) are simply enclosed in '$' and '($1-)', and the result is evaluated in a context where $1 is the raw message.

thus when you use:

.debug -pi @vchg $+ $network $+($chr(36),dscan,$chr(40),$chr(36),1,-,$chr(41))

the value for [identifier] is '$dscan($1-)' which mIRC then transforms into:

  $$dscan($1-)($1-)

it still works as needed, since extraneous characters at the end of an $identifier() are ignored, but knowing exactly what mIRC is doing and taking advantage of its interpreter wherever possible can be interesting and rewarding.

given the above facts, it follows that /debug -i NUL dscan is enough to create the desired outcome

 Respond  
l0wner   -  May 13, 2011

edited to filter out ctcp action on /me command from being shown and some odd echos caused only on efnet (that I noticed)

 Respond  
l0wner   -  May 12, 2011

fixed

 Respond  
l0wner   -  May 12, 2011

LOL messed up the nick parsing fixing it now will correct shortly

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.