2014-09-20 00:56:39 +02:00
# ##############################################################################
# ## Preconfiguration please don't change...
# ## Script Logic ## Handle with care!
# ##############################################################################
set scriptname " S h i v e r i n g - I s l e s Z N C m a n a g m e n t s c r i p t "
set scriptOwner " C h r i s t o p h K e r n "
set scriptOwnerMail " S h e o g o r a t h @ s h i v e r i n g - i s l e s . d e "
set scriptchannel " # P a l a s t V o n S h e o g o r a t h "
set scriptOwnerNetwork " i r c . s h i v e r i n g - i s l e s . d e "
2014-09-23 09:48:29 +02:00
set scriptversion " 0 . 7 . 0 . 1 "
2014-09-20 00:56:39 +02:00
set scriptdebug 0
putlog " $ s c r i p t n a m e l o a d i n g c o n f i g u r a t i o n . . . "
# ##############################################################################
# ## End of Preconfig
# ##############################################################################
# ##############################################################################
# ## Start of config
# ##############################################################################
# ## Script --------------------------------------------------------------------
# Script specific settings
#
#
# ##----------------------------------------------------------------------------
# # set to 0 to minimize script putlog part
set scriptUseBigHeader 1
# # Advertice ScriptOwner
set adverticeScriptOwner 0
# # Prefix for triggering Bot Commands things like !request or .request
set scriptCommandPrefix " ! "
# # Sendmailpath !!!!! YOU REALLY NEED TO CHECK THE PATH !!!!!
set sendmailPath " / u s r / s b i n / s e n d m a i l "
# ## ZNC -----------------------------------------------------------------------
# Here you can configure your whole ZNC settings
#
#
# ##----------------------------------------------------------------------------
# # ZNC Network name
set zncnetworkname " S h i v e r i n g - I s l e s Z N C "
# # The prefix set for Modules for Bot's ZNC-User
set zncprefix " * "
# # The DNS-Host of your ZNC Server
set znchost " z n c . s h i v e r i n g - i s l e s . d e "
# # The ZNC NON-SSL Port, if not exists set ""
set zncNonSSLPort " 6 5 5 3 4 "
# # The ZNC SSL Port, if not exists set ""
set zncSSLPort " 6 5 5 3 5 "
# # The ZNC-Webinterface NON-SSL Port, if not exists set ""
set zncWebNonSSLPort " 6 5 5 3 4 "
# # The ZNC-Webinterface SSL Port, if not exists set ""
set zncWebSSLPort " 6 5 5 3 5 "
# # The Name of server support/admin
set zncAdminName " S h e o g o r a t h "
# # The E-Mail address of server support/admin
set zncAdminMail " z n c @ s h i v e r i n g - i s l e s . d e "
# # The Level of Security for the random generated password for new ZNC-users (recommanded is 3 means [a-zA-Z0-9])
set zncPasswordSecurityLevel 3
# # The Length of the automatic generated password)
set zncPasswordLength 16
# ## Optional - Preconfiguration -----------------------------------------------
# Default Modules and Networks
2014-09-24 01:50:15 +02:00
# !!!!!!! DISABLED !!!!!!!! FEATURE COMMING SOON !!!!!!!!
2014-09-20 00:56:39 +02:00
#
# ##----------------------------------------------------------------------------
# # Default User Modules loaded, if not exists set { } if you use arguments do it like that: "autoreply \"I'll be back soon\""
# set defaultUserModules { "chansaver" "controlpanel" "buffextras" "autoreply \"I'll be back soon\""}
set zncDefaultUserModules { }
# # Default User Modules loaded, if not exists set { } if you use arguments do it like that: "autoreply \"I'll be back soon\""
# set defaultUserModules { "chansaver" "controlpanel" "buffextras" "autoreply \"I'll be back soon\""}
set zncDefaultNetworkModules { }
# ## Preconfigured Networks
# # Enable Preconfigured Networks
set usePreconfiguredNetworks 1
# # Array of Preconfigured Networks (only works if usePreconfiguredNetworks is set to 1 )
array set knownNetworks {
shivering-isles " i r c . s h i v e r i n g - i s l e s . d e + 6 6 9 7 "
freenode " i r c . f r e e n o d e . n e t + 7 0 0 0 "
euircnet " i r c . e u i r c . n e t + 6 6 9 7 "
}
# # Forces to 1 Network !!!!!!! DISABLED !!!!!!!! FEATURE COMMING SOON !!!!!!!!
# set zncEnforcedNetwork "irc.shivering-isles.de +6697"
set zncEnforcedNetwork " "
# ## Optional - Topic Settings -------------------------------------------------
# Topic Settings
# !!!!!!! DISABLED !!!!!!!! FEATURE COMMING SOON !!!!!!!!
#
# ##----------------------------------------------------------------------------
# # Change Topic 1 means on 0 means off
set zncTopic 0
# # Show Number of ZNC users in Topic
set zncTopicUsercount 1
# # Show Serverdata in Topic
set zncTopicServerdata 1
# # Show Name of server support/admin
set zncTopicShowAdmin 1
# # Topicprefix
set zncTopicPrefix " "
# # GreetSuffix
set zncTopicSuffix " "
# ## Optional - Greeting Settings ----------------------------------------------
# Settings for Greeting
# !!!!!!! DISABLED !!!!!!!! FEATURE COMMING SOON !!!!!!!!
#
# ##----------------------------------------------------------------------------
# # Show Greeting 1 means on 0 means off
set zncGreeting 0
# # Greet prefix (possible values for replace: %nick% %channel%)
set zncGreetPrefix " \00300 , 0 1 "
# # Greet suffix (possible values for replace: %nick% %channel%)
set zncGreetSuffix " \003 "
# # Greet Messages (possible values for replace: %nick% %channel% %zncAdminName% %zncAdminMail% %zncNonSSLPort% %zncSSLPort% %zncWebSSLPort% %zncWebNonSSLPort% %znchost%)
set zncGreetings {
" H e l l o % n i c k % , s t a y h e r e o r m a n a g e y o u Z N C A c c o u n t v i a h t t p s : / / % z n c h o s t % : % z n c W e b S S L P o r t % ! "
" H e l l o % n i c k % , w e l c o m e t o % c h a n n e l % ! "
" W e l c o m e % n i c k % , % c h a n n e l % i s f o r Z N C m a n a g e m e n t . T o r e q u e s t a Z N C - A c c o u n t u s e ! h e l p r e q u e s t "
}
# ## Optional - Advertice ------------------------------------------------------
# Settings for advertice your network
# !!!!!!! DISABLED !!!!!!!! FEATURE COMMING SOON !!!!!!!!
#
# ##----------------------------------------------------------------------------
# # Do Advertice 1 means on 0 means off (if 0 scriptAdvertice is off, too)
set zncAdvertice 0
# # Show Number of ZNC users in Advertice
set zncAdverticeUsercount 1
# # Show Serverdata in Topic
set zncAdverticeServerdata 1
# # Show Name of server support/admin
set zncAdverticeShowAdmin 1
# # Sentences for Advertice
# set zncAdverticeSenteces { } #disabled
set zncAdverticeSenteces {
" G e t y o u r F r e e Z N C n o w ! "
" " }
# ##############################################################################
# ## End of Config
# ##############################################################################
# ##############################################################################
# ## Script Logic ## Handle with care! (If you change 1 character my support ends)
# ##############################################################################
putlog " $ s c r i p t n a m e c o n f i g u r a t i o n l o a d e d "
putlog " $ s c r i p t n a m e l o a d i n g s c r i p t . . . "
if { $scriptUseBigHeader } {
putlog " $ s c r i p t n a m e i s w i r t t e n b y $ s c r i p t O w n e r "
putlog " I f y o u n e e d h e l p j o i n i r c : / / $ s c r i p t O w n e r N e t w o r k / $ s c r i p t c h a n n e l "
putlog " I f y o u c a n ' t j o i n o r w a n t t o c o n t a c t m e i n a n o t h e r w a y , y o u c a n E - M a i l t o $ s c r i p t O w n e r M a i l "
putlog " E n j o i n y o u r w o r k w i t h $ s c r i p t n a m e "
}
if { $scriptdebug } {
putlog " ! ! ! ! ! ! ! ! ! ! ! ! W A R N I N G ! ! ! ! ! ! ! ! ! ! ! ! ! ! "
putlog " R U N N I N G S C R I P T I N D E B U G M O D E ! D O N O T R U N P R O D U C T I V E ! "
}
# ## Bot Commands --------------------------------------------------------------
proc znc:request { nick host handle chan text } {
global scriptCommandPrefix zncPasswordSecurityLevel zncPasswordLength zncnetworkname zncDefaultUserModules zncDefaultNetworkModules
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 " N O T I C E $ n i c k : $ { s c r i p t C o m m a n d P r e f i x } r e q u e s t s y n t a x i s \" $ { s c r i p t C o m m a n d P r e f i x } r e q u e s t < z n c u s e r n a m e > < e - m a i l - a d d r e s s > \[ < n e t w o r k n a m e > \[ < s e r v e r a d d r e s s > < \[ + \] p o r t > \] \] \" f o r m o r e p l e a s e u s e \" $ { s c r i p t C o m m a n d P r e f i x } h e l p r e q e s t \" "
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 " $ s e r v e r $ p o r t "
}
}
}
puthelp " N O T I C E $ n i c k : H e y $ n i c k , y o u r r e q u e s t f o r $ u s e r n a m e i s n o t i c e d a n d a f t e r c o n f i r m b y a n a d m i n i s t r a t o r y o u ' l l g e t a n e m a i l w i t h a l l n e e d e d d a t a . "
} else {
puthelp " N O T I C E $ n i c k : S r y , b u t y o u r w a n t e d u s e r n a m e i s a l r e a d y i n u s e . . . "
}
}
}
proc znc:confirm { nick host handle chan text} {
global scriptCommandPrefix zncPasswordSecurityLevel zncPasswordLength
set username [ lindex $text 0 ]
if { $username == " " } {
puthelp " N O T I C E $ n i c k : $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m s y n t a x i s \" $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m < z n c u s e r n a m e > \" f o r m o r e p l e a s e u s e \" $ { s c r i p t C o m m a n d P r e f i x } h e l p C o n f i r m "
}
if [ matchattr $username C] {
set password [ znc : helpfunction:generatePassword $zncPasswordSecurityLevel $zncPasswordLength ]
znc : controlpanel:Set " p a s s w o r d " $username $password
mail : simply:sendUserRequest $username $password
znc : blockuser:unblock $username
chattr $username - C
puthelp " N O T I C E $ n i c k : $ u s e r n a m e i s n o w c o n f i r m e d . "
} elseif { validuser $username } {
puthelp " N O T I C E $ n i c k : $ u s e r n a m e i s a l r e a d y c o n f i r m e d . "
} else {
puthelp " N O T I C E $ n i c k : $ u s e r n a m e d o e s n o t e x i s t "
}
}
proc znc:deny { nick host handle chan text} {
global scriptCommandPrefix
set username [ lindex $text 0 ]
if { $username == " " } {
puthelp " N O T I C E $ n i c k : $ { s c r i p t C o m m a n d P r e f i x } D e n y s y n t a x i s \" $ { s c r i p t C o m m a n d P r e f i x } D e n y < z n c u s e r n a m e > \" f o r m o r e p l e a s e u s e \" $ { s c r i p t C o m m a n d P r e f i x } h e l p D e n y "
}
if [ matchattr $username C ] {
znc : controlpanel:DelUser $username
deluser $username
puthelp " N O T I C E $ n i c k : $ u s e r n a m e i s n o w d e n i e d . "
} elseif { validuser $username } {
puthelp " N O T I C E $ n i c k : $ u s e r n a m e i s a l r e a d y c o n f i r m e d . U s e \" $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r < u s e r n a m e > \" t o r e m o v e "
} else {
puthelp " N O T I C E $ n i c k : $ u s e r n a m e d o e s n o t e x i s t "
}
}
proc znc:delUser { nick host handle chan text} {
global scriptCommandPrefix
set username [ lindex $text 0 ]
if { $username == " " } {
puthelp " N O T I C E $ n i c k : $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r s y n t a x i s \" $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r < z n c u s e r n a m e > \" f o r m o r e p l e a s e u s e \" $ { s c r i p t C o m m a n d P r e f i x } h e l p D e l U s e r "
}
if [ validuser $username ] {
znc : controlpanel:DelUser $username
deluser $username
puthelp " N O T I C E $ n i c k : $ u s e r n a m e i s n o w d e l e t e d . "
} else {
puthelp " N O T I C E $ n i c k : $ u s e r n a m e d o e s n o t e x i s t "
}
}
proc znc:listUnconfirmed { nick host handle chan text} {
global scriptCommandPrefix
set UnConfirmedList [ join [ userlist C ] , ]
if { $UnConfirmedList != " " } {
puthelp " N O T I C E $ n i c k : U n c o n f i r m e d u s e r s : $ U n C o n f i r m e d L i s t "
} else {
puthelp " N O T I C E $ n i c k : n o u n c o n f i r m e d u s e r s "
}
}
proc znc:help { nick host handle chan text} {
global scriptCommandPrefix zncAdminName scriptname botnick
set helpcontext [ lindex $text 0 ]
if { $helpcontext != " " } {
switch [ string tolower $helpcontext ] {
request {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } R e q u e s t "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } R e q u e s t y o u c a n r e q u e s t a n Z N C - A c c o u n t t h a t A c c o u n t "
puthelp " N O T I C E $ n i c k : # i s j u s t w a i t i n g f o r a c o n f i r m o r d e n y b y $ z n c A d m i n N a m e . I f i t i s c o n f i r m e d y o u ' l l "
puthelp " N O T I C E $ n i c k : # g e t a n e - m a i l w i t h a d d r e s s a n d p a s s w o r d f o r y o u r A c c o u n t . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # Y o u c a n i n s t a n t l y a d d a n e t w o r k o r o w n n e t w o r k w i t h o p t i o n a l p a r a m e t e r s . "
puthelp " N O T I C E $ n i c k : # I f y o u w a n t t o c o n n e c t t o I R C u s i n g S S L y o u h a v e t o a d d a + i n f r o n t o f p o r t n u m b e r . "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } r e q u e s t < z n c u s e r n a m e > < e - m a i l - a d d r e s s > \[ < n e t w o r k n a m e > \[ < s e r v e r a d d r e s s > < \[ + \] p o r t > \] \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } r e q u e s t F o o f o o @ b a r . c o m f o o n e t i r c . f o o . n e t + 6 6 9 7 "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k r e q u e s t < z n c u s e r n a m e > < e - m a i l - a d d r e s s > \[ < n e t w o r k n a m e > \[ < s e r v e r a d d r e s s > < \[ + \] p o r t > \] \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k r e q u e s t F o o f o o @ b a r . c o m f o o n e t i r c . f o o . n e t + 6 6 9 7 "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
listunconfirmedusers {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } L i s t U n c o n f i r m e d U s e r s "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } L i s t U n c o n f i r m e d U s e r s $ z n c A d m i n N a m e g e t s a l i s t o f u n c o n f i r m e d "
puthelp " N O T I C E $ n i c k : # u s e r s . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } L i s t U n c o n f i r m e d U s e r s "
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } L i s t U n c o n f i r m e d U s e r s "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k L i s t U n c o n f i r m e d U s e r s "
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k L i s t U n c o n f i r m e d U s e r s "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
confirm {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m $ z n c A d m i n N a m e c a n c o n f i r m Z N C A c c o u n t r e q u e s t s . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m F o o "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k C o n f i r m < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k C o n f i r m F o o "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
deny {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } D e n y "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } D e n y $ z n c A d m i n N a m e c a n d e n y Z N C A c c o u n t r e q u e s t s . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } D e n y < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } D e n y F o o "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k D e n y < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k D e n y F o o "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
deluser {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r $ z n c A d m i n N a m e c a n d e l e t e Z N C A c c o u n t s i f t h e y a r e "
puthelp " N O T I C E $ n i c k : # a l r e a d y c o n f i r m e d . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r F o o "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k D e l U s e r < z n c u s e r n a m e > "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k D e l U s e r F o o "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
help {
puthelp " N O T I C E $ n i c k : # H e l p f o r $ { s c r i p t C o m m a n d P r e f i x } h e l p "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # W i t h $ { s c r i p t C o m m a n d P r e f i x } h e l p y o u ' l l g e t m e s s a g e s l i k e t h i s o n e . . . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } h e l p \[ < c o m m a n d > \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } h e l p r e q u e s t "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k h e l p \[ < c o m m a n d > \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k h e l p r e q u e s t "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
default {
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # p l e a s e u s e $ { s c r i p t C o m m a n d P r e f i x } h e l p w i t h o u t p a r a m e t e r s f o r f u l l c o m m a n d l i s t "
} else {
puthelp " N O T I C E $ n i c k : # p l e a s e u s e / m s g $ b o t n i c k h e l p w i t h o u t p a r a m e t e r s f o r f u l l c o m m a n d l i s t "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
}
} else {
puthelp " N O T I C E $ n i c k : # $ s c r i p t n a m e C o m m a n d l i s t : "
puthelp " N O T I C E $ n i c k : # r e q u e s t | R e q u e s t s a n Z N C A c c o u n t "
puthelp " N O T I C E $ n i c k : # L i s t U n c o n f i r m e d U s e r s | L i s t s u n c o n f i r m e d Z N C A c c o u n t "
puthelp " N O T I C E $ n i c k : # C o n f i r m | C o n f i r m s Z N C A c c o u n t r e q u e s t "
puthelp " N O T I C E $ n i c k : # D e n y | D e n i e s a Z N C A c c o u n t r e q u e s t "
puthelp " N O T I C E $ n i c k : # D e l U s e r | D e l e t e s a c o n f i r m e d Z N C A c c o u n t "
puthelp " N O T I C E $ n i c k : # h e l p | S h o w s h e l p f o r c o m m a n d s "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # U s e \" $ { s c r i p t C o m m a n d P r e f i x } h e l p < c o m m a n d > \" f o r f u l l h e l p c o n t e x t . "
puthelp " N O T I C E $ n i c k : # "
puthelp " N O T I C E $ n i c k : # - - - - - - - - - - - - - - - - - "
if { $chan != $nick } {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } h e l p \[ < c o m m a n d > \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # $ { s c r i p t C o m m a n d P r e f i x } h e l p r e q u e s t "
} else {
puthelp " N O T I C E $ n i c k : # S y n t a x : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k h e l p \[ < c o m m a n d > \] "
puthelp " N O T I C E $ n i c k : # E x a m p l e : "
puthelp " N O T I C E $ n i c k : # / m s g $ b o t n i c k h e l p r e q u e s t "
}
puthelp " N O T I C E $ n i c k : # # # E n d o f H e l p # # # "
}
}
# ## ZNC - Functions -----------------------------------------------------------
proc znc:controlpanel:AddNetwork { username network } {
znc : sendTo:Controlpanel " A d d N e t w o r k $ u s e r n a m e $ n e t w o r k "
}
proc znc:controlpanel:AddServer { username network server } {
znc : sendTo:Controlpanel " A d d S e r v e r $ u s e r n a m e $ n e t w o r k $ s e r v e r "
}
proc znc:controlpanel:AddUser { username password } {
znc : sendTo:Controlpanel " A d d U s e r $ u s e r n a m e $ p a s s w o r d "
}
proc znc:controlpanel:DelNetwork { username network } {
znc : sendTo:Controlpanel " D e l N e t w o r k $ u s e r n a m e $ n e t w o r k "
}
proc znc:controlpanel:DelUser { username } {
znc : sendTo:Controlpanel " D e l U s e r $ u s e r n a m e "
}
proc znc:controlpanel:Disconnect { username network } {
znc : sendTo:Controlpanel " D i s c o n n e c t $ u s e r n a m e $ n e t w o r k "
}
proc znc:controlpanel:LoadModule { username modulename { args " " } } {
if { $args == " " } {
znc : sendTo:Controlpanel " L o a d M o d u l e $ u s e r n a m e $ m o d u l e n a m e "
} else {
znc : sendTo:Controlpanel " L o a d M o d u l e $ u s e r n a m e $ m o d u l e n a m e $ a r g s "
}
}
proc znc:controlpanel:LoadNetModule { username network modulename { args " " } } {
if { $args == " " } {
znc : sendTo:Controlpanel " L o a d N e t M o d u l e $ u s e r n a m e $ n e t w o r k $ m o d u l e n a m e "
} else {
znc : sendTo:Controlpanel " L o a d N e t M o d u l e $ u s e r n a m e $ n e t w o r k $ m o d u l e n a m e $ a r g s "
}
}
proc znc:controlpanel:Reconnect { username network } {
znc : sendTo:Controlpanel " R e c o n n e c t $ u s e r n a m e $ n e t w o r k "
}
proc znc:controlpanel:Set { variable username value } {
znc : sendTo:Controlpanel " S e t $ v a r i a b l e $ u s e r n a m e $ v a l u e "
}
proc znc:controlpanel:SetChan { variable username network chan value } {
znc : sendTo:Controlpanel " S e t C h a n $ v a r i a b l e $ u s e r n a m e $ n e t w o r k $ c h a n $ v a l u e "
}
proc znc:controlpanel:SetNetwork { variable username network value } {
znc : sendTo:Controlpanel " S e t N e t w o r k $ v a r i a b l e $ u s e r n a m e $ n e t w o r k $ v a l u e "
}
proc znc:blockuser:block { username } {
znc : sendTo:blockuser " b l o c k $ u s e r n a m e "
}
proc znc:blockuser:unblock { username } {
znc : sendTo:blockuser " u n b l o c k $ u s e r n a m e "
}
# ## Help functions ------------------------------------------------------------
proc znc:helpfunction:generatePassword { secureityLevel passwordLength } {
set return " "
if { $secureityLevel > 0 } {
set pool { " 1 " " 2 " " 3 " " 4 " " 5 " " 6 " " 7 " " 8 " " 9 " }
}
if { $secureityLevel > 1 } {
lappend pool " a " " b " " c " " d " " e " " f " " g " " h " " i " " j " " k " " l " " m " " n " " o " " p " " q " " r " " s " " t " " u " " v " " w " " x " " y " " z "
}
if { $secureityLevel > 2 } {
lappend pool " A " " B " " C " " D " " E " " F " " G " " H " " T " " I " " J " " K " " L " " M " " N " " O " " P " " Q " " R " " S " " T " " U " " V " " W " " X " " Y " " Z "
}
if { $secureityLevel > 3 } {
lappend pool " % " " & " " @ " " _ " " - " " ! " " \$ " " / " " \\ " " . " " , " " ; " " # " " + " " * " " ~ " " ? " " = "
}
if { $secureityLevel > 4 } {
lappend pool " ä " " ö " " ü " " Ä " " Ü " " Ö " " ß " " < " " > " " | " " á " " ú " " ó " " é " " à " " ò " " ù " " è " " € " " â " " ô " " ê " " û "
}
if { $pool == " " } { return }
for { set i 1 } { $i < $passwordLength } { incr i } {
set return [ string append $return [ znc : helpfunction:randelem $pool ] ]
}
return $return
}
# ## Helpfunction for znc:helpfunction:generatePassword
if { [ catch { string append} ] } then {
rename string STRING_ORIGINAL
proc string { cmd args} {
switch - regexp - - $cmd {
^ a ( p ( p ( e ( n ( d ) ? ) ? ) ? ) ? ) ? $ {
uplevel [ list join $args { } ]
}
default {
if { [ catch {
set result [ uplevel [ list STRING_ORIGINAL $cmd ] $args ]
} err ] } then {
return - code error\
[ STRING_ORIGINAL map\
[ list \
STRING_ORIGINAL string\
" : m u s t b e b y t e l e n g t h , " \
" : m u s t b e a p p e n d , b y t e l e n g t h , " ] \
$err ]
} else {
set result
}
}
}
}
}
# ##----------------------------------------------------------------------------
proc znc:helpfunction:randelem { list } {
lindex $list [ expr { int ( rand ( ) * [ llength $list ] ) } ]
}
proc znc:helpfunction:loadModuleList { username list } {
foreach module $list {
znc : controlpanel:LoadModule $username $module
}
}
proc znc:helpfunction:loadNetModuleList { username network list} {
foreach module $list {
znc : controlpanel:LoadNetModule $username $network $module
}
}
proc mail:simply:send { usermail subject content } {
global zncAdminMail
mail : sendTo:user $zncAdminMail $usermail $subject $content
}
proc mail:simply:sendUserRequest { username password } {
global zncnetworkname znchost zncNonSSLPort zncSSLPort zncWebNonSSLPort zncWebSSLPort zncAdminName zncAdminMail
set email [ getuser $username COMMENT]
set content " H e y $ u s e r n a m e , \n \n Y o u ' v e r e q u e s t e d a Z N C - A c c o u n t h o s t e d b y $ z n c n e t w o r k n a m e \n \n Y o u h a v e t o w a i t f o r t h e c o n f i r m b y a n A d m i n o f o u r Z N C . I f i t ' s d o n e u s e t h e f o l l o w i n g d a t a t o l o g i n : \n \n "
append content \ n\ n " O u r Z N C h o s t i s : $ z n c h o s t "
if { $zncNonSSLPort != " " } {
append content \ n " T o c o n n e c t y o u r I R C C l i e n t v i a N O N - S S L c o n n e c t t o : $ { z n c h o s t } : $ { z n c N o n S S L P o r t } "
}
if { $zncSSLPort != " " } {
append content \ n " T o c o n n e c t y o u r I R C C l i e n t v i a S S L c o n n e c t t o : $ { z n c h o s t } : $ { z n c S S L P o r t } "
}
append content \ n " Y o u r Z N C U s e r n a m e i s : $ u s e r n a m e "
append content \ n " Y o u r Z N C P a s s w o r d i s : $ p a s s w o r d "
append content \ n " T o C o n n e c t t o Z N C - S e r v e r u s e \" $ { u s e r n a m e } : $ { p a s s w o r d } \" a s s e r v e r - p a s s w o r d "
if { $zncWebNonSSLPort != " " } {
append content \ n " T o l o g i n v i a N O N - S S L - W e b i n t e r f a c e g o t o : h t t p : / / $ { z n c h o s t } : $ { z n c W e b N o n S S L P o r t } "
}
if { $zncWebSSLPort != " " } {
append content \ n " T o l o g i n v i a S S L - W e b i n t e r f a c e g o t o : h t t p s : / / $ { z n c h o s t } : $ { z n c W e b S S L P o r t } "
}
if { $zncAdminMail != " " } {
append content \ n\ n\ n\ n " I f t h i s e - m a i l i s s p a m p l e a s e i n s t a n t l y c o n t a c t $ z n c A d m i n M a i l "
}
mail : simply:send $email " R e q u e s t e d Z N C - A c c o u n t a t $ z n c n e t w o r k n a m e " $content
}
proc eggdrop:helpfunction:isNotZNCChannel { chan } {
return [ expr ! [ channel get $chan znc] ]
}
proc debug:helpfunction:test { nick host handle text } {
puthelp " P R I V M S G $ n i c k : C h a n n e l s : [ j o i n [ c h a n n e l s ] , ] "
puthelp " P R I V M S G $ n i c k : [ e g g d r o p : h e l p f u n c t i o n : i s N o t Z N C C h a n n e l " # Z N C " ] "
}
proc debug:helpfunction:testchan { nick host handle chan text } {
global zncPasswordSecurityLevel zncPasswordLength
puthelp " P R I V M S G $ n i c k : $ c h a n "
puthelp " P R I V M S G $ n i c k : [ z n c : h e l p f u n c t i o n : g e n e r a t e P a s s w o r d $ z n c P a s s w o r d S e c u r i t y L e v e l $ z n c P a s s w o r d L e n g t h ] "
}
# ## sendTo - Functions --------------------------------------------------------
proc znc:sendTo:Controlpanel { command } {
global zncprefix
putquick " P R I V M S G $ { z n c p r e f i x } c o n t r o l p a n e l : $ c o m m a n d "
}
proc znc:sendTo:blockuser { command } {
global zncprefix
putquick " P R I V M S G $ { z n c p r e f i x } b l o c k u s e r : $ c o m m a n d "
}
proc mail:sendTo:user { from to subject content { cc " " } } {
global sendmailPath
set msg { From : $from }
append msg \ n " T o : " [ join $to , ]
append msg \ n " C c : " [ join $cc , ]
append msg \ n " S u b j e c t : $ s u b j e c t "
append msg \ n\ n $content
exec $sendmailPath - oi - t << $msg
}
# ## Commands - Functions ------------------------------------------------------
# # Request Commands
proc znc:PUB:request { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : request $nick $host $handle $chan $text
}
proc znc:MSG:request { nick host handle text} {
znc : request $nick $host $handle $nick $text
}
# # Confirm Commands
proc znc:PUB:confirm { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : confirm $nick $host $handle $chan $text
}
proc znc:MSG:confirm { nick host handle text} {
znc : confirm $nick $host $handle $nick $text
}
# # Deny Commands
proc znc:PUB:deny { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : deny $nick $host $handle $chan $text
}
proc znc:MSG:deny { nick host handle text} {
znc : deny $nick $host $handle $nick $text
}
# # DelUser Commands
proc znc:PUB:delUser { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : delUser $nick $host $handle $chan $text
}
proc znc:MSG:delUser { nick host handle text} {
znc : delUser $nick $host $handle $nick $text
}
# # ListUnconfirmedUsers Commands
proc znc:PUB:listUnconfirmed { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : listUnconfirmed $nick $host $handle $chan $text
}
proc znc:MSG:listUnconfirmed { nick host handle text} {
znc : listUnconfirmed $nick $host $handle $nick $text
}
# # Help Commands
proc znc:PUB:help { nick host handle chan text} {
if [ eggdrop : helpfunction:isNotZNCChannel $chan ] { return }
znc : help $nick $host $handle $chan $text
}
proc znc:MSG:help { nick host handle text} {
znc : help $nick $host $handle $nick $text
}
# ## custom flags --------------------------------------------------------------
# # ZNC Channel flag
setudef flag znc
# ## binds ---------------------------------------------------------------------
# # public binds ---------------------------------------------------------------
bind PUB - " $ { s c r i p t C o m m a n d P r e f i x } R e q u e s t " znc:PUB:request
2014-09-23 09:48:05 +02:00
bind PUB Y " $ { s c r i p t C o m m a n d P r e f i x } C o n f i r m " znc:PUB:confirm
bind PUB Y " $ { s c r i p t C o m m a n d P r e f i x } D e n y " znc:PUB:deny
bind PUB Y " $ { s c r i p t C o m m a n d P r e f i x } D e l U s e r " znc:PUB:delUser
bind PUB Y " $ { s c r i p t C o m m a n d P r e f i x } L i s t U n c o n f i r m e d U s e r s " znc:PUB:listUnconfirmed
bind PUB Y " $ { s c r i p t C o m m a n d P r e f i x } L U U " znc:PUB:listUnconfirmed
2014-09-20 00:56:39 +02:00
bind PUB - " $ { s c r i p t C o m m a n d P r e f i x } h e l p " znc:PUB:help
# # private binds --------------------------------------------------------------
bind MSG - " R e q u e s t " znc:MSG:request
bind MSG Y " C o n f i r m " znc:MSG:confirm
bind MSG Y " D e n y " znc:MSG:deny
bind MSG Y " D e l U s e r " znc:MSG:delUser
bind MSG Y " L i s t U n c o n f i r m e d U s e r s " znc:MSG:listUnconfirmed
2014-09-23 09:48:05 +02:00
bind MSG Y " L U U " znc:MSG:listUnconfirmed
2014-09-20 00:56:39 +02:00
bind MSG - " h e l p " znc:MSG:help
# # debug binds ----------------------------------------------------------------
if { $scriptdebug } {
bind PUB n " ! t e s t " debug:helpfunction:testchan
bind MSG n " t e s t " debug:helpfunction:test
}
# ## End of Script -------------------------------------------------------------
putlog " $ s c r i p t n a m e v e r s i o n $ s c r i p t v e r s i o n l o a d e d "