Posted to tcl by gg at Fri Sep 20 14:03:02 GMT 2019view raw
- proc znc:request { nick host handle chan text } {
- global scriptCommandPrefix zncPasswordSecurityLevel zncPasswordLength zncnetworkname zncDefaultUserModules zncDefaultNetworkModules usePreconfiguredNetworks
- 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 { $email == ""} {
- puthelp "NOTICE $nick :${scriptCommandPrefix}request syntax is \"${scriptCommandPrefix}request <zncusername> <e-mail-address> \[<networkname> \[<serveraddress> <\[+\]port>\]\]\" for more please use \"${scriptCommandPrefix}help reqest\""
- 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: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 "NOTICE $nick :Hey $nick, your request for $username is noticed and after confirm by an administrator you'll get an email with all needed data."
- } else {
- puthelp "NOTICE $nick :Sry, but your wanted username is already in use..."
- }
- }
- }