Posted to tcl by oldschool at Wed Feb 13 00:22:24 GMT 2019view raw

  1. proc znc:request { nick host handle chan text } {
  2. global scriptCommandPrefix zncPasswordSecurityLevel zncPasswordLength zncnetworkname zncrealname zncquitmsg zncvhost zncDefaultUserModules zncDefaultNetworkModules usePreconfiguredNetworks bannednetworks
  3. set username [lindex $text 0]
  4. set email [lindex $text 1]
  5. set networkname [lindex $text 2]
  6. set server [lindex $text 3]
  7. set port [lindex $text 4]
  8. if { $email == ""} {
  9. puthelp "privmsg $chan :\002Syntax\002: ${scriptCommandPrefix}request \037Username\037 \037Email\037 \037Networkname\037 \037IRC.SERVER\037 \037Port\037"
  10. puthelp "privmsg $chan :\002For SSL\002: add a + in front of the port!"
  11. puthelp "privmsg $chan :1 free account per user and 2 networks available."
  12. return
  13. }
  14. if {[string tolower $networkname] in $bannednetworks} {
  15. putserv "PRIVMSG $chan :The network \002$networkname\002 is 7BANNED1."
  16. return
  17. } else {
  18. set password [znc:helpfunction:generatePassword $zncPasswordSecurityLevel $zncPasswordLength ]
  19. if [ adduser $username ] {
  20. setuser $username COMMENT $email
  21. chattr $username +ZC
  22. znc:controlpanel:AddUser $username $password
  23. znc:controlpanel:Set realname $username $zncrealname
  24. znc:controlpanel:Set quitmsg $username $zncquitmsg
  25. znc:controlpanel:Set bindhost $username $zncvhost
  26. znc:blockuser:block $username
  27. znc:helpfunction:loadModuleList $username $zncDefaultUserModules
  28. if { $networkname != ""} {
  29. set preServer ""
  30. if { $usePreconfiguredNetworks } {
  31. set preServer [array names knownNetworks -exact [string tolower $networkname]]
  32. }
  33. znc:controlpanel:AddNetwork $username $networkname
  34. znc:helpfunction:loadNetModuleList $username $networkname $zncDefaultNetworkModules
  35. if { $preServer != "" } {
  36. foreach {networkname networkserver} [array get knownNetworks [string tolower $networkname]] {
  37. znc:controlpanel:AddServer $username $networkname $networkserver
  38. }
  39. } else {
  40. if { $port != "" } {
  41. znc:controlpanel:AddServer $username $networkname "$server $port"
  42. }
  43. }
  44. }
  45. 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."
  46. puthelp "privmsg $chan :\002Syntax\002: !check $username for the status of your request."
  47. } else {
  48. puthelp "privmsg $chan :\0024Error1\002: Sorry \002$username\002 that username is already taken, please choose another one."
  49. }
  50. }
  51. }
  52.