Snippets

* Note: All code snippets were made by myself (Pass) unless stated otherwise.

/iecho

* Note: Snippets containing "iecho" require this snippet as well
alias iecho echo -a $color(info) $1-

/mass

alias mass {
  if ($istok(+o -o +h -h +v -v -i,$1,32)) {
    if ($1 == -i) iecho -a * /mass SYNTAX: /mass <+,-|o,h,v> <nick> performs multiple mode actions on users in a specified channel 
    else {
      if ($2 ischan) {
        var %+- = $left($1,1),%mode = $left($1,2),%chan = $nick($2,0),%nicks,%modes
        while (%chan) {
          if ($nick != $me) var %nicks = %nicks $nick($2,%chan))
          dec %chan
        }
        mode $2 $+(%+-,$str(%mode,$numtok(%nicks,32))) %nicks 
      }
    }
  }
  elseif ($istok(+b -b,$1,32)) {
    if ($2 ischan) { 
      if ($3) {
        var %+- = $left($1,1)
        var %3 = $remove($3,$chr(42)),%3 = $+($chr(42),$3,$chr(42))
        if (%+- == -) {
          var %ibl = $ibl($2,0),%bans 
          while (%ibl) {
            var %addy = $ibl($2,%ibl)
            if (%3 iswm %addy) var %bans = %bans %addy
            dec %ibl
          }
        }
        elseif (%+- == +) {
          if ($3 isnum 1-20) {
            var %chan = $nick($2,0),%bans
            while (%chan) {
              var %nick = $nick($2,%chan),%address = $address(%nick,$3)  
              if ($nick($2,%chan) != $me) var %bans = %bans %address
              dec %chan
            }
          }
        }
        if (%bans) mode $2 $+(%+-,$str(b,$numtok(%bans,32))) %bans
      }
    }
  }
  else iecho -a * /mass: /mass <+,-|o,h,v> <#channel>
}

$text().[r|r2|case]

alias text {
  if ($1-) {
    if ($prop == r) { 
      var %x = $numtok($1-,32),%words
      while (%x) {
        var %words = %words $gettok($1-,%x,32)
        dec %x
      }
      if (%words) return %words
    }
    if ($prop == r2) || ($prop == case) {
      var %x = 1,%words
      while ($gettok($1-,%x,32)) {
        var %text = $gettok($1-,%x,32),%lentext = $iif($prop == r2,$len(%text),1),%word
        while ($iif($prop == r2,%lentext,$mid(%text,%lentext,1))) {
          if ($prop == r2) {
            var %word = %word $+ $mid(%text,%lentext,1)
          }
          elseif ($prop == case) {
            var %word = %word $+ $iif($mid(%text,%lentext,1) isupper,$lower($mid(%text,%lentext,1)),$upper($mid(%text,%lentext,1)))
          }
          $iif($prop == r2,dec,inc) %lentext
        }
        var %words = %words %word
        inc %x
      }
      if (%words) return %words
    }
  }
  else return $1-
}

Auto-Identifier/Ghoster [Buggy]

alias add {
  if ($1 == ident) {
    if ($2) {
      if ($3) {
        if ($4) {
          if (!$ini(ident.ini,$2,$3)) {
            writeini ident.ini $2 $3 $4
            if ($notify($3)) {
              var %networks = $gettok($notify($3).note,2,32),%password = $gettok($notify($3).note,3,32)
              if (!$istok(%networks,$2,44)) {
                var %networks = $addtok(%networks,$2,44)
                .notify -r $3 
              }
            }
            else var %networks = $2
            .notify $3 autoghost %networks $4
            iecho -a * Added $qt($3) to $+($2,'s) auto-ident list
          }
          else iecho -a * $qt($3) is already on $+($2,'s) auto-ident list
        }
        else { writeini ident.ini $2 $me $3 | iecho -a * Added $qt($me) to $+($2,'s) auto-ident list }
      }
      else iecho -a * /add: /add ident < network> < name> < password>
    }
    else iecho -a * /add: /add ident < network> < name> < password>
  }
}

alias del {
  if ($1 == ident) {
    if ($2) {
      if ($3 === -c) {
        if ($ini(ident.ini,$2)) {
          remini ident.ini $2
          iecho -a * Cleared auto-ident list for $2
        }
        else iecho -a * /del: invalid network
      }
      elseif ($3) {
        if ($ini(ident.ini,$2,$3)) {
          remini ident.ini $2 $3
          if ($notify($3)) && ($gettok($notify($3).note,1,32) == autoghost) {
            var %networks = $gettok($notify($3).note,2,32),%pass = $gettok($notify($3).note,3,32)
            if ($numtok(%networks,44) > 1) {
              var %networks = $remtok(%networks,$2,44)
              .notify -r $3
              .notify $3 autoghost %networks %pass
            }
            else .notify -r $3
          }
          iecho -a * Removed $qt($3) from $+($2,'s) auto-ident list
        }
        else iecho -a * /del: $qt($3) isn't on $+($2,'s) auto-ident list
      }
      else iecho -a * /del: /del ident < network> < -c/name>
    }
    else iecho -a * /del: /del ident < network> < -c/name>
  }
}

alias _list {
  if ($ini(ident.ini,$1)) {
    var %x = 1
    while ($ini(ident.ini,$1,%x)) {
      iecho -a $chr(35) $+ %x $+ . $ini(ident.ini,$1,%x) $+ : $readini(ident.ini,$ini(ident.ini,$1),$ini(ident.ini,$1,%x))
      inc %x
    }
    if (%x) iecho -a * End of /_list
    else iecho -a * No such entry 
  }
  else {
    var %x = 1 
    while ($ini(ident.ini,%x)) {
      iecho -a $chr(35) $+ %x $+ . $ini(ident.ini,%x)
      inc %x
    }
    if (%x) iecho -a * End of /_list
    else iecho -a * No such entry
  }
}

on *:notice:*:*:{ 
  if (nickserv* iswm $nick) { 
    if (*nick*is registered* iswm $1-) { 
      if ($ini(ident.ini,$network,$me)) {
        .msg nickserv identify $readini(ident.ini,$network,$me)
        set -u2 %nickserv.reply. $+ $me $+ . $+ $network $true 
      }
    }
    if (*password incorrect* iswm $1-) {
      if ($+(%nickserv.reply.,$($me),.,$($network))) { 
        iecho -a * Error: Stored password incorrect.. 
        ; remini ident.ini $network $me | iecho -a * Removed incorrect password
        ; var %nick = $_rnick($network),%pass = $gettok(%nick,1,32),%nick = $gettok(%nick,1,32)
        ; .nick %nick | .msg nickserv identify %pass | set -u2 %nickserv.reply. $+ $me $+ . $+ $network $true
      }
    } 
  }
}

on ^*:notify:{
  if ($gettok($notify($nick).note,1,32) == autoghost) && ($nick != $me) {
    var %pass = $gettok($notify($nick).note,3,32),%network = $gettok($notify($nick).note,2,32)
    if ($istok(%network,$network,44)) { 
      msg nickserv ghost $nick $readini(ident.ini,$network,$nick)
      halt
    }
  }
}