pastebin - collaborative debugging tool
kpaste.net RSS


ZNC mIRC Buffer
Posted by Admin on Sun 7th Mar 2010 10:40
raw | new post

  1. alias -l config {
  2.   ; Mandatory settings
  3.   var %TIMESTAMP_PATTERN = ^\[(\d\d:\d\d:\d\d)\].*$
  4.   var %PLAYBACK_BEGIN    = Buffer Playback...
  5.   var %PLAYBACK_END      = Playback Complete.
  6.   var %VARIABLE_PREFIX   = gbuffer
  7.   ; Optional settings
  8.  
  9.   ; Indent wrapped lines
  10.   var %INDENT_LINES = $false
  11.  
  12.   ; Add the mode prefix to the nick (if possible)
  13.   var %PREFIX_NICKS = $false
  14.  
  15.   ; Are there other ON TEXT processors in place?
  16.   var %EXTERNAL_RENDERER = $true
  17.  
  18.   ; Possible values are NORMAL/LINESEP/NONE
  19.   var %STATUS_DISPLAY = LINESEP
  20.  
  21.   ; Make use of space-preserving spaces.dll
  22.   var %USE_SPACES_DLL = $false
  23.  
  24.   return $eval( $+( %, $1 ), 2 )
  25. }
  26.  
  27. alias -l makeNick {
  28.   var %nick = $nick( $1, $2 ).pnick
  29.   if ( ( 0 == $len( %nick ) ) || ( $true != $config( PREFIX_NICKS ) ) ) %nick = $2
  30.   return %nick
  31. }
  32.  
  33. alias -l handleMessage {
  34.   var %chan = $1
  35.   var %nick = $2
  36.   var %color = $3
  37.   var %pattern = $4
  38.   var %text = $5
  39.  
  40.   var %pnick = $makeNick( %chan, %nick )
  41.  
  42.   ; Buffered input
  43.   if ( $true == $eval( $+( %, $config( VARIABLE_PREFIX ), ., $cid, ., %chan, ., playback ), 2 ) ) {
  44.     noop $regex( %text, $config( TIMESTAMP_PATTERN ) ) )
  45.     var %timestamp = $+([,$regml( 1 ),])
  46.  
  47.     var %params
  48.     if ( $config( INDENT_LINES ) ) %params = $+( i, $calc( $len( %timestamp ) + $len( %pnick ) + 4 ) )
  49.     if ( %nick != $me ) %params = $+( %params, lmr )
  50.     if ( 0 != $len( %params ) ) %params = $+( -, %params )
  51.  
  52.  
  53.     if ( $true == $config( USE_SPACES_DLL ) ) {
  54.       var %result
  55.       noop $regex( %text, ^.*? (.*)$ )
  56.       noop $regsub( $regml( 1 ), /\\/g, \\\\, %result )
  57.       noop $regsub( %pattern, &TEXT&, %result, %result )
  58.       noop $regsub( %result , &NICK&, %pnick, %result )
  59.       noop $dll( spaces.dll, echo, $color( %color ) %params $chan %timestamp %result )
  60.     }
  61.     else {
  62.       echo $color( %color ) %params $chan %timestamp $replacecs( %pattern, &NICK&, %pnick, &TEXT&, $gettok( %text, 2-, 32 ) )
  63.     }
  64.   }
  65.  
  66.   else {
  67.     ; Current events (optional)
  68.     if ( $true == $config( EXTERNAL_RENDERER ) ) return $false
  69.  
  70.     if ( $true == $config( USE_SPACES_DLL ) ) {
  71.       var %result
  72.       noop $regsub( %pattern, &NICK&, %pnick, %result )
  73.       noop $regsub( %text, /\\/g, \\\\, %text )
  74.       noop $regsub( %result, &TEXT&, %text, %result )
  75.       noop $dll( spaces.dll, echo, $color( %color ) $+( -i, $calc( $len( $timestamp ) + $len( %pnick ) + 5 ), lmrt ) $chan %result )
  76.     }
  77.     else {
  78.       echo $color( %color ) $+( -i, $calc( $len( $timestamp ) + $len( %pnick ) + 4 ), lmrt ) $chan $replacecs( %pattern, &NICK&, %pnick, &TEXT&, %text )
  79.     }
  80.   }
  81.   return $true
  82. }
  83.  
  84. on ^*:text:*:#:{
  85.   ; Handle savebuff output
  86.   if ( $nick == *savebuff ) {
  87.     var %nick = $gettok( $2, 1, $asc( ! ) )
  88.     var %timestamp = $asctime( $1, $timestampfmt )
  89.     if ( $3 == MODE )     echo $color( mode ) $chan %timestamp * %nick sets mode: $4-
  90.     elseif ( $3 == JOIN ) echo $color( join ) $chan %timestamp * %nick ( $+ $gettok( $2, 2, $asc( ! ) ) $+ ) has joined $chan
  91.     elseif ( $3 == QUIT ) echo $color( quit ) $chan %timestamp * %nick ( $+ $gettok( $2, 2, $asc( ! ) ) $+ ) Quit ( $+ $4- $+ )
  92.     elseif ( $3 == PART ) echo $color( part ) $chan %timestamp * %nick ( $+ $gettok( $2, 2, $asc( ! ) ) $+ ) has left $chan
  93.     elseif ( $3 == NICK ) echo $color( nick ) $chan %timestamp * %nick is now known as $4
  94.     elseif ( $3 == KICK ) echo $color( kick ) $chan %timestamp * $2 was kicked by $gettok( $4, 1, $asc( ! ) ) ( $+ $5- $+ )
  95.     elseif ( $3 == TOPIC ) echo $color( topic ) $chan %timestamp * %nick changes topic to ' $+ $right($4-, -1) $+ '
  96.     else                  echo $color( erro ) $chan *** UNHANDLED LINE < $+ $1- $+ >
  97.   }
  98.  
  99.   ; Handle playback state notifications
  100.   elseif ( $nick == *** ) {
  101.     if ( $1- == $config( PLAYBACK_BEGIN ) ) {
  102.       set -e $+( %, $config( VARIABLE_PREFIX ), ., $cid, ., $chan, ., playback ) $true
  103.     }
  104.     elseif ( $1- == $config( PLAYBACK_END ) ) {
  105.       unset $eval( $+( %, $config( VARIABLE_PREFIX ), ., $cid, ., $chan, ., playback ), 1 )
  106.     }
  107.  
  108.     if ( $config( STATUS_DISPLAY ) == NORMAL ) {
  109.       echo $color( notice ) $chan *** $1-
  110.     }
  111.     elseif ( $config( STATUS_DISPLAY ) == LINESEP ) {
  112.       linesep $chan
  113.     }
  114.     halt
  115.   }
  116.  
  117.   ; Handle usual input
  118.   else {
  119.     var %pattern = ^:.*? :(.*)$
  120.     noop $regex( $rawmsg, %pattern )
  121.     if ( $false == $handleMessage( $chan, $nick, normal, $+(<,$nick($chan, $nick).color,&NICK&,>) &TEXT&, $regml( 1 ) ) ) return
  122.   }
  123.  
  124.   halt
  125. }
  126.  
  127. on ^*:action:*:#:{
  128.   ;noop $dll( spaces.dll, echo, $chan $rawmsg )
  129.   var %pattern = ^:.*? :\x01ACTION (.*)\x01$
  130.   noop $regex( $rawmsg, %pattern )
  131.   if ( $true == $handleMessage( $chan, $nick, action, * &NICK& &TEXT&, $regml( 1 ) ) ) halt
  132. }
  133.  
  134. on ^*:notice:*:#:{
  135.   ;noop $dll( spaces.dll, echo, $chan $rawmsg )
  136.   var %pattern = ^:.*? :(.*)$
  137.   noop $regex( $rawmsg, %pattern )
  138.   if ( $true == $handleMessage( $chan, $nick, notice, -&NICK&- &TEXT&, $regml( 1 ) ) ) halt
  139. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at