Auto identify dialog

Auto identify dialog

mIRC snippet to identify with nickname and password on unrealircd servers

Postat de Copyright Categorie Review user Vizualizari Data
BLKoldSUN Nikolas activity Cod netestat 369 2023-12-05 19:54:56

menu * {
  Auto Identify:/dialog -m _auto_ident _auto_ident
}
dialog -l _auto_ident {
  title "Auto Identify"
  size -1 -1 92 96
  option dbu
  list 1, 2 8 89 34, size vsbar
  box "", 2, 0 0 92 87
  edit "", 3, 3 43 50 10, disable autohs
  edit "", 4, 3 53 50 10, disable pass autohs
  text "Nickname", 5, 53 45 36 8, right
  text "Password", 6, 53 55 36 8, right
  button "Add", 8, 2 73 16 12, disable
  button "Edit", 9, 39 73 17 12, disable
  button "Cancel", 10, 56 73 33 12, disable
  button "Del", 20, 18 73 21 12, disable
  edit "", 21, 3 63 50 10, disable autohs
  text "Network", 22, 53 65 36 8, right
  text "Developed by Nikolas", 23, 1 87 90 8, disable center
}
on *:dialog:_auto_ident:*:*:{
  if ($devent == init) {
    _auto_ident_init
  }
  elseif ($devent == sclick) {
    if ($did == 8) { 
      if (!$hget(_auto_ident,$+($did($dname,3).text,.,$did($dname,21).text))) {
        hadd -m _auto_ident $+($did($dname,3).text,.,$did($dname,21).text) $did($dname,4).text
        did -r $dname 3,4,21
        did -b $dname 8
        _auto_ident_refresh
        _auto_ident_save
      }
      else { noop $input("This Nickname is allready added on your list on the same network,o,Auto Identify) }
    }
    elseif ($did == 1) && ($did($dname,1).seltext) {
      set %_auto_ident_edit 1
      var %name = $gettok($did($dname,1).seltext,1,32)
      var %network = $remove($gettok($did($dname,1).seltext,2,32),$chr(40),$chr(41))
      did -ra $dname 3 %name
      did -ra $dname 4 $+($chr(1),$chr(2),$chr(3),$chr(4))
      did -ra $dname 21 %network
      did -e $dname 9,10,4,20
      did -b $dname 3,8
    }
    elseif ($did == 9) {
      hadd -m _auto_ident $+($did($dname,3).text,.,$did($dname,21).text) $iif($did($dname,4).text == $+($chr(1),$chr(2),$chr(3),$chr(4)),$hget(_auto_ident,$did($dname,3).text),$v1)) 
      did -r $dname 3,4,21 | did -b $dname 9,10,8,20 | did -e $dname 3 | did -u $dname 1
      set %_auto_ident_edit 0  
      _auto_ident_refresh
      _auto_ident_save
    }
    elseif ($did == 10) { 
      did -r $dname 3,4,21
      did -b $dname 9,10,8,20
      did -e $dname 3 
      did -u $dname 1
      set %_auto_ident_edit 0
    }
    elseif ($did == 20) {
      hdel _auto_ident $+($did($dname,3).text,.,$did($dname,21).text)
      did -r $dname 3,4,21
      did -b $dname 9,10,8,20
      did -e $dname 3 
      did -u $dname 1
      set %_auto_ident_edit 0
      _auto_ident_refresh
      _auto_ident_save

    }
  }
  elseif ($devent == edit) {
    if ($did($dname,3).text) && ($did($dname,4).text) && ($did($dname,21).text) && (%_auto_ident_edit != 1) { did -e $dname 8 }
    else { did -b $dname 8 }
  }
}
alias -l _auto_ident_init {
  if (!$hget(_auto_ident)) hmake _auto_ident
  if ($exists(_auto_ident.hsh)) hload _auto_ident _auto_ident.hsh
  else hsave _auto_ident _auto_ident.hsh
  if ($dialog(_auto_ident)) {
    did -e _auto_ident 3,4,21
    _auto_ident_refresh
  }
}
alias -l _auto_ident_refresh {
  did -r _auto_ident 1
  var %i = 1
  var %e = $hfind(_auto_ident,*,0,w)
  while (%i <= %e) {
    var %entry = $hfind(_auto_ident,*,%i,w)
    var %value = $hget(_auto_ident,%entry)
    did -a _auto_ident 1 $gettok(%entry,1,46) ( $+ $gettok(%entry,2,46) $+ )
    inc %i
  }
}
alias -l _auto_ident_save {
  hsave _auto_ident _auto_ident.hsh
}

on *:notice:*:?:{ 
  if ($nick == NickServ) && (*This nickname is registered and protected* iswm $1-) {
    if (!$hget(_auto_ident)) { _auto_ident_init }
    .msg NickServ identify $$hget(_auto_ident,$+($me,.,$network))
  }
}