Code: Select all
bind notc - {[VERBOSE]* => akick * add *} check:akick
bind notc - {* has * access to * Reason:*} check:why
catch {unset akick:queue}
proc check:akick {nick host hand text {dest ""}} {
 putlog "Recieved chanserv-notice \"$text\" from \"$nick!$host\" to \"$dest\""
 if {$dest == "" || [isbotnick $dest] || ![string equal -nocase "chanserv!service@dal.net" "$nick!$host"]} {
  putlog "Possible forged ChanServ. Ignoring..."
  return
 }
 if {[regexp -- {^\[VERBOSE\] (.+?)!(.+?) => akick (.+?) add (.+?)$} [stripcodes bcruag $text] match tnick thost tchan tmask] && ![isbotnick $tnick]} {
  putlog "Data extracted: $tnick $thost $tchan $tmask"
  set ::akick:queue([list [string tolower $tchan] [string tolower $tnick]]) $tmask
  putlog "Sending: CHANSERV WHY $tchan $tnick"
  putserv "CHANSERV WHY $tchan $tnick"
 }
}
proc check:why {nick host hand text {dest ""}} {
 putlog "Recieved chanserv-notice \"$text\" from \"$nick!$host\" to \"$dest\""
 if {![string equal -nocase "chanserv!service@dal.net" "$nick!$host"]} {
  putlog "Possible forged ChanServ. Ignoring..."
  return
 }
 if {$dest == "" || [isbotnick $dest]} {
  putlog "Origin appears authentic, continuing..."
  if {[regexp -- {^(.+?) has (SOp|AOp) access to (.+?)\. +Reason: Identification to the nickname (.+?)\. Channel Frozen: (YES|NO)$} [stripcodes bcruag $text] match tnick tacc tchan trnick tfrozen]} {
   putlog "Data extracted: $tnick $tacc $tchan $trnick $tfrozen"
   if {[info exists ::akick:queue] && [info exists ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])]} {
    putlog "Sending: CHANSERV AKICK $tchan DEL [set ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])]"
    putserv "CHANSERV AKICK $tchan DEL [set ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])]"
    puthelp "PRIVMSG $tnick :Only Founder may add AKICK's to $tchan"
    unset ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])
   } {
    putlog "Did not find scheduled check. Ignoring (Status: [info exists ::akick:queue] [info exists ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])]"
   }
  }
 }
}
Code: Select all
if {[info exists ::akick:queue] && [info exists ::akick:queue([list [string tolower $tchan] [string tolower $tnick]])]} {