Autoop / Gives operator status to authed users

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

Autoop / Gives operator status to authed users

Postby Cristian » Mon Jun 02, 2008 2:30 pm

As promised, an update.

variables to customize:
  • rawid, for easier handle of scripts
  • flagexempts, doesn't give operator status to users with +d flag.
  • status1, if user is authed, what type of status should s/he receive.
  • status2, if user isn't authed, what type of status should s/he receive.
  • strictuserid, if user doesn't have identd enabled, s/he will not receive status1.

Commands:
    !aop
    !aop on
    !aop off

The script support use on multiple channels.
Please report bugs and errors here.

Code: Select all
setudef flag aop

namespace eval aop {

   namespace eval variable {

      variable rawid       678
      variable flagexempts    "d|d"
      variable status1      "+o"
      variable status2      "+v"
      
      variable strictuserid   "1"

   }
   bind time -|- "* * * * *" [namespace current]::scantime

   proc scantime {minute hour day month year} {
      bind RAW -|- {354} [namespace current]::raw354
      foreach channel [channels] {
         if {[channel get $channel aop]} {
            if {[botisop $channel]} {
               putserv "WHO $channel n%cnahuft,$::aop::variable::rawid"
            }
         }
      }
   }
   proc raw354 {s r a} {
      global aop
      set rawid "[lindex [split $a] 1]"
      set channel "[string tolower [lindex [split $a] 2]]"
      set userid "[string tolower [lindex [split $a] 3]]"
      #set hostname "[string tolower [lindex [split $a] 4]]"
      set nickname "[string tolower [lindex [split $a] 5]]"
      set flags "[lindex [split $a] 6]"

      set v "*+*"
      set o "*@*"
      if {[string equal -nocase $rawid $::aop::variable::rawid]} {
         if {[botisop $channel]} {
            if {[channel get $channel aop] == 1} {
               if {[matchattr [nick2hand $nickname] $::aop::variable::flagexempts $channel] == 0} {
                  if {![string match [lindex [split $a] 7] 0] > 0} {
                     set authname "[string tolower [lindex [split $a] 7]]"
                  
                     if {[string match "*~*" $userid] == $::aop::variable::strictuserid} { return }

                     if {[string match "$o" "$flags"] == 0} {
                        pushmode $channel $::aop::variable::status1 $nickname
                     }
                  } else {
                     pushmode $channel $::aop::variable::status2 $nickname
                  }
               }
            }
         }
      }
   }

   bind PUB o !aop [namespace current]::public
   putlog "\00304[string range [info script] 0 end]\00304 \002loaded\003\002. By \002S\002umsar \002W\002ebsite: http://sp00fed.org"
   proc public {nickname hostname handle channel arg} {
      set s [lindex $arg 0]
      switch $s {
         on {
            if {[channel get $channel aop]} {
               putserv "NOTICE $nickname :Auto op is already \002on\002 for $channel"
            } else {
               channel set $channel +aop
               putserv "NOTICE $nickname :Auto op is now \002on\002 for $channel"
            }
         }
         off {
            channel set $channel -aop
            putserv "NOTICE $nickname :Auto op is now \002off\002 for $channel"
         }
         default {
            if {[channel get $channel aop]} {
               putserv "NOTICE $nickname :Auto op is \002on\002 for $channel"
            } else {
               putserv "NOTICE $nickname :Auto op is \002off\002 for $channel"
            }
         }
      }
   }
}
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: Autoop / Gives operator status to authed users

Postby jonlar » Mon Jun 02, 2008 3:42 pm

Thanks for the nice work.
jonlar
 

Re: Autoop / Gives operator status to authed users

Postby Cristian » Mon Jun 09, 2008 3:30 pm

you are welcome. ;)
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Re: Autoop / Gives operator status to authed users

Postby Lukemob » Tue Jun 17, 2008 3:12 pm

Looks pr0 :-) Nice work ;-)
Lukemob
 


Return to TCL Scripting Release

Who is online

Users browsing this forum: No registered users and 1 guest

cron