Guest User

Untitled

a guest
Jun 24th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.41 KB | None | 0 0
  1. ;this is actually needed to bypass mIRC's parsing behavior of strtok(str, ":")
  2. alias urlreg return /((?:(?:(?:http|ftp|gopher)\72\/\/)|(?:www|ftp)\.)\S+)/Sig
  3.  
  4. ;the coloring alias, blue (12), underline (31)
  5. alias urlcolor return $+($chr(3), 12, $chr(31), $1-, $chr(31), $chr(3))
  6. alias selfurlcolor return $+($chr(3), 12, $chr(31), $1-, $chr(31), $chr(3), 14)
  7.  
  8. ;trigger for the regex event only
  9. on ^&$*:text:$($urlreg):*:{
  10.   ;if we are in a channel, turn nick into @nick if applicable
  11.   var %nick = $iif($chan, $nick($chan, $nick).pnick, $nick)
  12.  
  13.   ;color all the linkes using the predefined alias above
  14.   var %msgs = $regsubex($1-, $urlreg, $urlcolor(\t))
  15.  
  16.   var %color = $cnick($nick).color
  17.   if ( $nick isop $chan ) {
  18.     %color = 5
  19.     if (destin isin %nick) {
  20.       %color = 4
  21.     }
  22.   }
  23.  
  24.   ;print the message, default timestamp, highlighting options, and nick coloring
  25.   echo -tcrl normal $iif($chan, $v1, $nick) $+(<, $chr(3), %color, %nick, $chr(3), >) %msgs
  26.  
  27.   ;prevent mIRC's default echo
  28.   haltdef
  29. }
  30.  
  31. on &*:INPUT:*:{
  32.   if ($regex($1-,$urlreg) > 0) {
  33.     var %nick = $iif($chan, $nick($chan, $nick).pnick, $nick)
  34.     var %msgs = $regsubex($1-, $urlreg, $selfurlcolor(\t))
  35.     var %color = $cnick($nick).color
  36.     if ( $nick isop $chan ) { %color = 5 }
  37.     echo -atcr normal $+($chr(3), 14, <, $chr(3), %color, %nick, $chr(3), 14, >) %msgs
  38.     .msg $iif($chan, $v1, $target) $1-
  39.     haltdef
  40.   }
  41. }
Add Comment
Please, Sign In to add comment