Posted to tcl by hypnotoad at Wed Feb 13 00:24:06 GMT 2019view raw
- proc znc:request { nick host handle chan text } {
- global scriptCommandPrefix zncPasswordSecurityLevel zncPasswordLength zncnetworkname zncrealname zncquitmsg zncvhost zncDefaultUserModules zncDefaultNetworkModules usePreconfiguredNetworks bannednetworks
- set username [lindex $text 0]
- set email [lindex $text 1]
- set networkname [lindex $text 2]
- set server [lindex $text 3]
- set port [lindex $text 4]
- if { [llength $text] < 2 || $email == ""} {
- puthelp "privmsg $chan :\002Syntax\002: ${scriptCommandPrefix}request \037Username\037 \037Email\037 \037Networkname\037 \037IRC.SERVER\037 \037Port\037"
- puthelp "privmsg $chan :\002For SSL\002: add a + in front of the port!"
- puthelp "privmsg $chan :1 free account per user and 2 networks available."
- return
- }
- if {[string tolower $networkname] in $bannednetworks} {
- putserv "PRIVMSG $chan :The network \002$networkname\002 is 7BANNED1."
- return
- } else {
- set password [znc:helpfunction:generatePassword $zncPasswordSecurityLevel $zncPasswordLength ]
- if [ adduser $username ] {
- setuser $username COMMENT $email
- chattr $username +ZC
- znc:controlpanel:AddUser $username $password
- znc:controlpanel:Set realname $username $zncrealname
- znc:controlpanel:Set quitmsg $username $zncquitmsg
- znc:controlpanel:Set bindhost $username $zncvhost
- znc:blockuser:block $username
- znc:helpfunction:loadModuleList $username $zncDefaultUserModules
- if { $networkname != ""} {
- set preServer ""
- if { $usePreconfiguredNetworks } {
- set preServer [array names knownNetworks -exact [string tolower $networkname]]
- }
- znc:controlpanel:AddNetwork $username $networkname
- znc:helpfunction:loadNetModuleList $username $networkname $zncDefaultNetworkModules
- if { $preServer != "" } {
- foreach {networkname networkserver} [array get knownNetworks [string tolower $networkname]] {
- znc:controlpanel:AddServer $username $networkname $networkserver
- }
- } else {
- if { $port != "" } {
- znc:controlpanel:AddServer $username $networkname "$server $port"
- }
- }
- }
- puthelp "privmsg $chan :\002Success!\002 Your new ZNC \002\(\002with ident $username\002\)\002 will now be handled by a staff member. If your request is accepted, our bot will e-mail you with your new ZNC details and with login information."
- puthelp "privmsg $chan :\002Syntax\002: !check $username for the status of your request."
- } else {
- puthelp "privmsg $chan :\0024Error1\002: Sorry \002$username\002 that username is already taken, please choose another one."
- }
- }
- }