tglogo.png
0 LIKES

Snippet


Buzzen Nick/Address Logger

In Category Buzzen Posted by err0r On 09/06/10

This is an old nick logger that I made for buzzen. Keeps up with the last 5 nick changes. It also has custom @window to view and search entries.

Feel free to use/edit/re-release this however you choose.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;   NickLogger v1.2    ;;;
;;;   Created by err0r   ;;;
;;; http://www.tg007.net ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menu channel {
  History Per Chan
  .$iif($istok(%History.Log,$chan,44),$style(1)) Log $chan : $iif($istok(%History.Log,$chan,44),set %History.Log $remtok(%History.Log,$chan,1,44),set %History.Log $addtok(%History.Log,$chan,44))
  .$iif($istok(%History.Msg,$chan,44),$style(1)) Msg Room : $iif($istok(%History.Msg,$chan,44),set %History.Msg $remtok(%History.Msg,$chan,1,44),set %History.Msg $addtok(%History.Msg,$chan,44))
  .$iif($istok(%History.Echo,$chan,44),$style(1)) Echo Room : $iif($istok(%History.Echo,$chan,44),set %History.Echo $remtok(%History.Echo,$chan,1,44),set %History.Echo $addtok(%History.Echo,$chan,44))
  History Global Settings
  .$iif(%History.NoGuest,$style(1)) No Guest Log : $iif(%History.NoGuest,unset %History.NoGuest,set %History.NoGuest on)
  .$iif(%History.NoGhost,$style(1)) No Ghost Log : $iif(%History.NoGhost,unset %History.NoGhost,set %History.NoGhost on)
  .-
  .Clear Log : hfree history | $iif($exists(historyhash.txt),/remove -d historyhash.txt) | hmake history 500
  .View Log : historylog
  -
}
on *:start: { hmake history 100 |  if ($exists(historyhash.txt)) { hload history historyhash.txt } }
on *:exit: { hsave -o history historyhash.txt | hfree history }
on !*:JOIN:#:{
  if ((!$istok(%History.Log,$chan,44)) || (%History.Join)) { halt }
  if (%History.NoGuest) && ($left($nick,1) == >) { halt }
  set -eu2 %History.Join on
  if ($hget(history,$address($nick,1))) {
    if (%History.NoGhost) {
      var %hs 1
      while ($gettok($hget(history,$address($nick,1)),%hs,44)) { if ($regsubex($nick, /[0-9]+$/gi,$null) == $v1) { set %match yes } | inc %hs  }
    }
    if (!%match) {
      if (!$istok($hget(history,$address($nick,1)),$nick,44)) {
        if ($istok(%History.Msg,$chan,44)) { msg $chan $nick has made a nick change. Previous $iif($gettok($hget(history,$address($nick,1)),2,44),nicks have been,nick was) $replace($sorttok($hget(history,$address($nick,1)),44,c),$chr(44),$chr(44) $chr(32)) }
        if ($istok(%History.Echo,$chan,44)) { echo $chan 7  $nick has made a nick change. Previous $iif($gettok($hget(history,$address($nick,1)),2,44),nicks have been,nick was) $replace($sorttok($hget(history,$address($nick,1)),44,c),$chr(44),$chr(44) $chr(32)) }
        if ($numtok($hget(history,$address($nick,1)),44) >= 5) { hadd -m history $address($nick,1) $+($deltok($hget(history,$address($nick,1)),1,44),$chr(44),$nick)  }
        else { hadd -m history $address($nick,1) $+($hget(history,$address($nick,1)),$chr(44),$nick) }
      }
    }
  }
  else { if ($istok(%History.Msg,$chan,44)) { msg $chan Haven't seen you before $nick ( logged ) } | hadd -m history $address($nick,1) $nick }
  hsave -o history historyhash.txt | unset %match
}
menu @historylog {
  Search: $iif(!$dialog(search),dialog -m hsearch hsearch)
  Remove Selected: { /hdel -s history $gettok($sline(@historylog,1),4,32) | historylog }
  Clear Log: { hfree history | $iif($exists(historyhash.txt),/remove -d historyhash.txt) | hmake history 500 | historylog }
}
alias historylog {
  if (!$window(@historylog)) { /window -blk -t2,21 +benstx @historylog verdana 11 }
  clear @historylog | aline @historylog $chr(9) Address $chr(9) Logged Nicks | aline @historylog $chr(160)
  %hh = 1 | %hhn = $hget(history, 0).item
  while (%hh <= %hhn) { aline -p @historylog $+(14,%hh,.) $chr(9) 1 $hget(history,%hh).item $chr(9) 1 $hget(history,%hh).data |  inc %hh  }
}

dialog hsearch {
  title "History Search"
  size -1 -1 150 25
  option dbu
  edit "", 1, 2 2 145 10
  button "Search/Find Next", 2, 3 13 50 10
  button "Close", 4, 105 13 41 10
  button "Remove Selected", 3, 54 13 50 10
}
on *:DIALOG:hsearch:sclick:2: {
  if (%hsearch.item != $did(hsearch,1).text) {
    set %hsearch.item $did(hsearch,1).text | set %hsearch.start 0 | set %hsearch.num $fline(@historylog,* $+ %hsearch.item $+ *,0,1)
  }
  set %hsearch.start $calc(%hsearch.start +1)
  if (%hsearch.start > %hsearch.num) { $input(End of Search,uodw,Attention!) | halt }
  /sline -s @historylog $fline(@historylog,* $+ %hsearch.item $+ *, $+ %hsearch.start $+ ,1)
}
on *:dialog:hsearch:sclick:3: { if ($gettok($sline(@historylog,1),4,32)) { /hdel -s history $gettok($sline(@historylog,1),4,32) | unset %hsearch.* | dialog -x hsearch | historylog } }
on *:dialog:hsearch:sclick:4: { unset %hsearch.* | dialog -x hsearch }
on *:dialog:hsearch:close:*: { unset %hsearch.* }


Comments 0


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand