Advertisement
Tiago_f

SASL

Nov 11th, 2022 (edited)
2,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.65 KB | None | 0 0
  1. on *:logon:*:{
  2.   if ($wd($readini($_sdir(identify.ini), $network, $me),1,44) == 1) { xidentify }
  3. }
  4. on *:notice:*:*:{
  5.   if ($nick == NickServ) {
  6.     if (This nick is owned by someone else. Please choose another. iswm $1-) || (This nickname is registered and protected* iswm $1-) { .autojoin -s | xidentify }
  7.     elseif (Password incorrect* iswm $1-) || (Invalid password* iswm $1-) { identset identify }
  8.     elseif (Ghost with your nick has been killed. iswm $1-) { unset $+(%,recover.,$cid) }
  9.   }
  10. }
  11. on ^*:usermode:{
  12.   if ($($+(%,saslstate.,$cid),2)) { unset $+(%,saslstate.,$cid) }
  13. }
  14. alias identset { nickserv $1- $$input(Enter the password:,vp,NickServ) }
  15. alias xghost {
  16.   if ($readini($_sdir(identify.ini), $network, $1)) {
  17.     var %password = $wd($readini($_sdir(identify.ini), $network, $1),2,44)
  18.     nickserv recover $1 $decode(%password,m)
  19.   }
  20.   else { identset recover $1 }
  21. }
  22. alias pcb { echo $1 $+ $msgstamp $2- }
  23. alias wd { return $gettok($1,$2,$3) }
  24. alias _sdir { return $+($scriptdir,system\,$1) }
  25. alias xidentify {
  26.   if ($readini($_sdir(identify.ini), $network, $me)) {
  27.     var %password = $wd($readini($_sdir(identify.ini), $network, $me),2,44)
  28.  
  29.     if ($wd($readini($_sdir(identify.ini), $network, $me),1,44) == 1) { .raw CAP REQ :sasl | set $($+(%,saslstate.,$cid)) 1 $me %password }
  30.     elseif ($wd($readini($_sdir(identify.ini), $network, $me),1,44) == 2) { msg nickserv identify $decode(%password,m) }
  31.     elseif ($wd($readini($_sdir(identify.ini), $network, $me),1,44) == 3) { nickserv identify $decode(%password,m) }
  32.   }
  33.   else { identset identify }
  34. }
  35. raw cap:*:{
  36.   if ($1- == $me ACK sasl) && ($wd($($+(%,saslstate.,$cid),2),1,32) == 1) { set $+(%,saslstate.,$cid) $puttok($($+(%,saslstate.,$cid),2),2,1,32) | .raw AUTHENTICATE PLAIN }
  37. }
  38. raw AUTHENTICATE:+:{
  39.   var %nick = $wd($($+(%,saslstate.,$cid),2),2,32), %pass = $decode($wd($($+(%,saslstate.,$cid),2),3,32),m)
  40.   if ($wd($($+(%,saslstate.,$cid),2),1,32) == 2) {
  41.     bset -tc &auth 1 %nick $+ $lf $+ %nick $+ $lf $+ %pass
  42.     breplace &auth 10 0
  43.     noop $encode(&auth,mb)
  44.     .raw AUTHENTICATE $bvar(&auth,1-).text
  45.   }
  46. }
  47. on *:parseline:out:*CAP END*:{ if ($wd($($+(%,saslstate.,$cid),2),1,32) == 2) .parseline -ot }
  48. raw *:*:{
  49.   var %raw = $right(00 $+ $numeric,3), %query = $iif($query($2),$2,-s)
  50.   if (%raw == 251) && ($($+(%,recover.,$cid),2)) { xghost $($+(%,recover.,$cid),2) }
  51.   elseif (%raw == 433) {
  52.     set -u20 $($+(%,recover.,$cid)) $2
  53.     if ($anick == $null) { .nick $2 $+ $cid }
  54.   }
  55.   elseif (%raw isnum 900-910) {
  56.     if ($($+(%,saslstate.,$cid),2)) {
  57.       unset $+(%,saslstate.,$cid)
  58.       if ($numeric == 900) || ($numeric == 904) { .raw CAP END }
  59.     }
  60.   }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement