westor

AKA (based on IPs) for GaMbiTo v1.0

Dec 4th, 2020
1,032
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ------- Settings --------
  2.  
  3. alias -l ipn_file { return ipnicks.ini } ; = The database file.
  4. alias -l ipn_excepts { return network1~nickname1~#channel1 network2~nickname2~#channel2 } ; = format is NETWORK~NICKAME~#CHANNEL so e.g ChatHUB~westor~#mSL
  5.  
  6. ; ------- Settings --------
  7.  
  8. ON *:TEXT:*:#: {
  9.   tokenize 32 $strip($1-)
  10.  
  11.   if ($1 == !ipnick) {
  12.     if (!$2) { msg $chan ( $+ $nick $+ ): Error, Please insert an IP Address! | return }
  13.     if (!$check_ipv4($2)) { msg $chan ( $+ $nick $+ ): Error, Please insert a valid IP Address! | return }
  14.  
  15.     var %r = $readini($ipn_file,n,$2,nicks)
  16.     var %t = $numtok(%r,32)
  17.  
  18.     if (!%r) { msg $chan ( $+ $nick $+ ): No results founded for $bold($2) IP Address! | return }
  19.  
  20.     msg $chan ( $+ $nick $+ ): $iif(%t == 1,There is $bold(%t) nickname change,There are $bold(%t) nickname changes) from $bold($2) IP Address.
  21.     msg $chan ( $+ $nick $+ ): $iif(%t == 1,Nickname was:,Nicknames were:) $bold(%r)
  22.   }
  23.  
  24. }
  25.  
  26. ON !*:NICK: {
  27.   var %p = $gettok($msgtags(unrealircd.org/userip).key,2,64)
  28.  
  29.   if (!%p) || (!$check_ipv4(%p)) { return }
  30.  
  31.   var %t = $comchan($newnick,0)
  32.   var %i = 1
  33.  
  34.   while (%i <= %t) {
  35.     var %c = $comchan($newnick,%i)
  36.     var %nc1 = $+($network,~,$nick,~,%c)
  37.     var %nc2 = $+($network,~,$newnick,~,%c)
  38.  
  39.     if (!%c) { goto next }
  40.  
  41.     var %r = $readini($ipn_file,n,%p,nicks)
  42.  
  43.     if (!$istok($ipn_excepts,%nc1,32)) { var %r = $addtok(%r,$nick,32) }
  44.     if (!$istok($ipn_excepts,%nc2,32)) { var %r = $addtok(%r,$newnick,32) }
  45.  
  46.     if (%r) { writeini -n $qt($ipn_file) %p nicks %r }
  47.  
  48.     :next
  49.     inc %i
  50.   }
  51.  
  52. }
  53.  
  54. alias -l bold { return $+($chr(2),$1-,$chr(2)) }
  55. alias -l check_ipv4 {
  56.   if (!$1) { return 0 }
  57.  
  58.   if ($regex($1,/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})$/Sx)) && ($iptype($1) == ipv4) { return 1 }
  59.  
  60.   return 0
  61. }
RAW Paste Data