Dupe

By Ayon on May 24, 2009

I've done some major updates on the script now, added a configuration dialog, and a more complete logging system...

Next will be to add a watch list... Hope to have it ready during this week..

;=====[ Dupe ]======================================================
; Written by Ayon @ #ScriptElite
; 
; Dupe is a handy script that will help you find people even if they
; have a different nick. It will also give you all nicks logged to their
; address.
; Type /dupe to get help on how to use the script
;========================================================================
on 1:start:{ hmake dupe 10000 | if ($exists(dupe.hsh)) { hload -i dupe dupe.hsh dupes } | if ($regex(%dupe.oj,/^(on|off)$/g)) { set %dupe.oja off } }
on 1:exit:{ if ($hget(dupe)) { hsave -i dupe dupe.hsh dupes } }
on 1:load:{ 
  if ($hget(dupe)) { echo -atg  Dupe could not be loaded. (Reason: Conflicting hashs table) | unload -rs $script | return } 
  hmake dupe 10000
  set %dupe.oja off
  echo -atg Dupe was loaded succsessfully.
  echo -atg --------------------------------------
  echo -atg » /dupe -n <nick> ~ Find dupes for nickname (You must be on the same channel as nick)
  echo -atg » /dupe -h <host> ~ Find dupes for a host address
  echo -atg » /dupe -c <#channel> ~ Find registered dupes on a channel (You must be on <#channel>)
  echo -atg » /dupe -d <nick|host> ~ Delete the a dupe entry from the archive (If using nick, you must be on the same channel)
  echo -atg » /dupe -cfg ~ Opens the configuration dialog
  echo -atg Type /dupe to bring up the command list
}
on 1:unload:{ if ($hget(dupe)) { hfree dupe } | if ($exists(dupe.hsh)) { remove dupe.hsh } | echo -atg  Dupe was unloaded succsessfully }
dialog dupe {
  title "Dupe v1.5 - Configuration [/dupe -cfg]"
  size -1 -1 154 96
  option dbu
  tab "Configuration", 1, 4 0 147 79
  box "Logging", 3, 8 16 78 34, tab 1
  check "Enable Dupe", 4, 12 24 42 10, tab 1
  check "Joins", 5, 60 24 22 10, tab 1
  check "Parts", 6, 12 36 22 10, tab 1
  check "Quit", 7, 60 36 22 10, tab 1
  button "Save archive", 8, 88 20 61 12, tab 1
  button "Reload saved archive", 9, 88 36 61 12, tab 1
  button "Clear archive", 16, 88 52 61 12, tab 1
  box "Notifications", 17, 8 52 78 22, tab 1
  check "On join", 18, 12 60 30 10, tab 1
  check "On part", 19, 48 60 30 10, tab 1
  tab "About", 2
  text "Dupe v1.5", 12, 12 16 33 8, tab 2
  text "Written by Ayon", 13, 12 24 45 8, tab 2
  text "About Dupe", 14, 12 36 37 8, tab 2
  text "Dupe is a handy script that will help you find people even if they have a different nick. It will also give you all nicks logged to their address.", 15, 12 44 133 32, tab 2
  button "OK", 10, 74 82 37 12, ok
  button "Close", 11, 114 82 37 12, cancel
}
on 1:dialog:dupe:init:0:{
  if ($group(#dupe).status == on) { did -c $dname 4 }
  if ($group(#dupe.join).status == on) { did -c $dname 5 }
  if ($group(#dupe.part).status == on) { did -c $dname 6 }
  if ($group(#dupe.quit).status == on) { did -c $dname 7 }
  if ($group(#dupe.onjoin).status == on) { did -c $dname 18 }
  if ($group(#dupe.onpart).status == on) { did -c $dname 19 }
}
on 1:dialog:dupe:sclick:8:{
  hsave -i dupe dupe.hsh dupes
  echo -atg » Dupe archive was succsessfully stored
}
on 1:dialog:dupe:sclick:9:{
  if ($exists(dupe.hsh)) {
    if ($input($+(If you choose to reload the previous saved archive,$chr(44),$chr(32),all newer data will be lost.,$crlf,Continue?),yw,Dupe Warning)) {
      hfree dupe
      hmake dupe 10000
      hload -i dupe dupe.hsh dupes
      echo -atg » Succsessfully reloaded last saved dupe archive
    }
  }
  else { echo -atg » No previous saved archive was found. }
}
on 1:dialog:dupe:sclick:10:{
  $iif($did($dname,4).state,.enable,.disable) #dupe
  $iif($did($dname,5).state,$iif($did($dname,4).state,.enable,.disable),.disable) #dupe.join
  $iif($did($dname,6).state,$iif($did($dname,4).state,.enable,.disable),.disable) #dupe.part
  $iif($did($dname,7).state,$iif($did($dname,4).state,.enable,.disable),.disable) #dupe.quit
  $iif($did($dname,18).state,.enable,.disable) #dupe.onjoin
  $iif($did($dname,19).state,.enable,.disable) #dupe.onpart
}
on 1:dialog:dupe:sclick:16:{
  if ($input($+(When clearing the archive all dupes will be lost.,$crlf,Continue?),yw,Dupe Warning)) {
    hfree dupe
    hmake dupe 10000
    if ($exists(dupe.hsh)) { remini dupe.hsh dupes }
    echo -atg » Dupe archive has been cleared
  }
}
#dupe on
on 1:NICK:{
  if ($newnick == $me) { return }
  var %d.addr = $address($newnick,3)
  if (!$hget(dupe,%d.addr)) { 
    var %d.addnick = $iif($newnick == $nick,$+($nick,$chr(44)),$+($nick,$chr(44),$newnick,$chr(44)))
    hadd dupe %d.addr %d.addnick
  }
  else {
    var %d.dupes = $hget(dupe,%d.addr), %i = 1
    while ($gettok(%d.dupes,0,44) >= %i) {
      if ($newnick == $gettok(%d.dupes,%i,44)) { var %d.exist = 1 | break }
      inc %i
    }
    if (!%d.exist) { hadd dupe %d.addr $+(%d.dupes,$newnick,$chr(44)) }
  }
}
#dupe end
#dupe.join on
on 1:JOIN:#:{
  var %d.addr = $address($nick,3)
  if ($hget(dupe,%d.addr)) { 
    var %d.dupes = $hget(dupe,%d.addr), %i = 1
    while ($dupes(%d.addr) >= %i) {
      if ($nick == $gettok(%d.dupes,%i,44)) { var %d.exist = 1 | break }
      inc %i
    }
    if (!%d.exist) { hadd dupe %d.addr $+(%d.dupes,$nick,$chr(44)) }
    if ($group(#dupe.onjoin).status == on) { echo -tg # $nick ( $+ $address($nick,3) $+ ) has been seen earlier with $dupes(%d.addr) dupes. }
  }
}
#dupe.join end
#dupe.part on
on 1:PART:#:{
  var %d.addr = $address($nick,3)
  if ($hget(dupe,%d.addr)) { 
    var %d.dupes = $hget(dupe,%d.addr), %i = 1
    while ($dupes(%d.addr) >= %i) {
      if ($nick == $gettok(%d.dupes,%i,44)) { var %d.exist = 1 | break }
      inc %i
    }
    if (!%d.exist) { hadd dupe %d.addr $+(%d.dupes,$nick,$chr(44)) }
    if ($group(#dupe.onpart).status == on) { echo -tg # $nick ( $+ $address($nick,3) $+ ) has been seen earlier with $dupes(%d.addr) dupes. }
  }
}
#dupe.part end
#dupe.quit on
on 1:QUIT:{
  var %d.addr = $address($nick,3)
  if ($hget(dupe,%d.addr)) { 
    var %d.dupes = $hget(dupe,%d.addr), %i = 1
    while ($dupes(%d.addr) >= %i) {
      if ($nick == $gettok(%d.dupes,%i,44)) { var %d.exist = 1 | break }
      inc %i
    }
    if (!%d.exist) { hadd dupe %d.addr $+(%d.dupes,$nick,$chr(44)) }
  }
}
#dupe.quit end
alias dupes return $gettok($hget(dupe,$iif($chr(64) isin $1,$1,$address($1,3))),0,44)
alias dupe {
  if (!$1) {
    echo -atg » Dupe v1.5 command help
    echo -atg » ------------------------------
    echo -atg » /dupe -n <nick> ~ Find dupes for nickname (You must be on the same channel as nick)
    echo -atg » /dupe -h <host> ~ Find dupes for a host address
    echo -atg » /dupe -c <#channel> ~ Find registered dupes on a channel (You must be on <#channel>)
    echo -atg » /dupe -d <nick|host> ~ Delete the a dupe entry from the archive (If using nick, you must be on the same channel)
    echo -atg » /dupe -cfg ~ Opens the configuration dialog
    return
  }
  if ($1 == -cfg) { dialog -m dupe dupe | return }
  if (!$regex($1,/^(-n|-h|-c|-d)$/g)) || (!$2) { echo -atg  Syntax: /dupe -nhcd <nick|host> | return }
  if ($1 == -cfg) { dialog -m dupe dupe }
  if ($1 == -n) {
    if ($chr(64) isin $2) { echo -atg  The option -n is for nicks only. | echo -atg  Syntax: /dupe -h <host> | return }
    var %d.host = $address($2,3)
    if ($hget(dupe,%d.host)) {
      var %d.aka = $hget(dupe,%d.host), %i = 1, %d.output
      echo -atg $2 ( $+ $address($2,3) $+ ) is also known as:
      while ($dupes(%d.host) >= %i) {
        if ($gettok(%d.output,0,126) == 10) { echo -atg %d.output | var %d.output }
        var %d.output = %d.output $gettok(%d.aka,%i,44)
        if (%d.output) && ($dupes(%d.host) > %i) { var %d.output = %d.output ~ }
        inc %i
      }
      echo -atg  %d.output
    }
    else { echo -atg  No match found for $2 ( $+ $address($2,3) $+ ) }
  }
  elseif ($1 == -h) {
    if ($chr(64) !isin $2) { echo -atg  The option -h is for hosts only. | echo -atg  Syntax: /dupe -n <nick> | return }
    var %d.host = $2
    if ($hget(dupe,%d.host)) {
      var %d.aka = $hget(dupe,%d.host), %i = 1, %d.output
      echo -atg $dupes(%d.host) dupes has been registered on $2 $+ :
      while ($dupes($2) >= %i) {
        var %d.output = %d.output $gettok(%d.aka,%i,44)
        if ($dupes(%d.host) > %i) { var %d.output = %d.output ~ }
        inc %i
      }
      echo -atg  %d.output
    }
    else { echo -atg  No match found for $2 ( $+ $address($2,3) $+ ) }
  }
  elseif ($1 == -c) {
    if ($2 !ischan) { echo -atg  $2 is not a channel | return }
    var %d.users = $nick($2,0), %i = 1, %d.output
    echo -atg -[ Looking up dupes @ $2 ]-
    while (%d.users >= %i) {
      var %d.host = $address($nick($2,%i),3)
      if ($hget(dupe,%d.host)) {
        if ($gettok(%d.output,0,126) == 10) { echo -atg %d.output | var %d.output }
        if (%d.output) && (%d.users > %i) { var %d.output = %d.output ~ }
        var %d.output = %d.output $nick($2,%i) ( $+ $dupes(%d.host) $+ )
      }
      inc %i
    }
    echo -atg $iif(%d.output,$v1, No dupes found.)
  }
  elseif ($1 == -d) {
    var %d.addr = $iif($chr(64) isin $2,$2,$address($2,3))
    if (!$hget(dupe,%d.addr)) { echo -atg  No match found for %d.addr | return }
    hdel dupe %d.addr
    echo -atg  %d.addr $iif(!$hget(dupe,%d.addr), was deleted succsessfully, could not be deleted)
  }
}
; Do not delete these groups
#dupe.onjoin on
#dupe.onjoin end
#dupe.onpart on
#dupe.onpart end

menu nicklist {
  Dupes $chr(9) ( $+ $iif($gettok($hget(dupe,$address($$1,3)),0,44),$v1,0) dupes)
  .$iif(!$dupes($$1),$style(2)) List dupes:dupe -n $$1
  .$iif(!$dupes($$1),$style(2)) Removed dupes:dupe -d $$1
}
menu channel {
  Dupe
  .Configuration $chr(9) (/dupe -cfg):dupe -cfg
  .Dupescan $chr(9) (/dupe -c #chan):dupe -c #
  .-
  .$iif($group(#dupe.onjoin).status == on,$style(1)) Notify on join $+ $chr(58) $group(#dupe.onjoin).status:$iif($group(#dupe.onjoin).status == on,.disable,.enable) #dupe.onjoin
  .$iif($group(#dupe.onpart).status == on,$style(1)) Notify on part $+ $chr(58) $group(#dupe.onpart).status:$iif($group(#dupe.onpart).status == on,.disable,.enable) #dupe.onpart
}

Comments

Sign in to comment.
Ayon   -  May 25, 2009

Removed the old and added a more complete script
And more is on it's way :)

 Respond  
Ayon   -  May 25, 2009

oh dang... thanks for the heads up..

command help has been updated

 Respond  
WorldDMT   -  May 25, 2009

hi

no help for -d

 Respond  
Ayon   -  May 25, 2009

Updated with the rewritten version of the script

 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.