This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

i need help please about protection

Help for those learning Tcl or writing their own scripts.
Post Reply
d
darksis
Voice
Posts: 16
Joined: Sat Aug 04, 2012 8:17 am

i need help please about protection

Post by darksis »

Hello i no very cool in tcl but i try very time to fix code and this no work in code i want put noticeflood nickflood and ctcpflood and if someone flood then bot set mode im and kick+ban this the code

Code: Select all

################################
#   Moderation.tcl de Platine  #
#       Debug par nOf          #
################################


#################
## Salon Logs  ##
#################

set salonm "#Tchat"


######################
##    CAPS mode     ##
######################

#-> Expiration of detection for capitalization (in seconds) ?
set expiration(majuscule) "180"

#-> Number of capital to detect ?
set detect(majuscule) "10"

#-> How much warning before kick ?
set avert(majuscule) "2"

#-> Warning message
set msg(majuscule) "Caution! Thank you not write in CAPITALS"

#-> Reason for kick
set kick(majuscule) "Not to shout to be understood!"



######################
## mode REHEARSALS  ##
######################

#-> Expiration of detection for rehearsals (in seconds) ?
set expiration(repetition) "900"

#-> Number of repetition to detect ?
set detect(repetition) "5"

#-> How much warning before kick ?
set avert(repetition) "2"

#-> Warning message
set msg(repetition) "Caution! watch your rehearsals! The next time you will be expelled!"

#-> Reason for kick
set kick(repetition) "No repetition!"


###################
#      CTCP       #
###################
#-> Number of messages during a mass detection / flood
set mass(ctcp) "4"

#-> Temp to rehash the reset to 0 mass / flood (in seconds)
set mass(rehashctcp) "2"

#-> Temp for removal of the + m (in minutes)
set mass(retraitm) "1"
#-> Reason kickban
set kick(ctcp) "Excluded Spam / Pub!"

###################
## Mode LANGUAGE  ##
###################

#-> Expiration of detection for the language (in seconds) ?
set expiration(mot) "300"

#-> How much warning before kickban ?
set avert(mot) "1"

#-> Warning message
set msg(mot) "Monitors! your language! Next time it's out!"

#-> Reason kickban
set kick(mot) "Excluded 20 minutes! for Bad Language!"



################
## Mode SPAM  ##
################

#-> Expiration of detection for spam (in seconds) ?
set expiration(spam) "120"

#-> How much warning before kickban ?
set avert(spam) "0"

#-> Warning message
set msg(spam) "Avoid your spam! Next time it's out!"

#-> Reason kickban
set kick(spam) "Excluded Spam / Pub!"




#########################
## Mode ANTI/MASSFLOOD ##
#########################

#-> Number of messages during a mass detection / flood
set mass(flood) "4"

#-> Temp to rehash the reset to 0 mass / flood (in seconds)
set mass(rehashflood) "2"

#-> Temp for removal of the + m (in minutes)
set mass(retraitm) "1"
#-> Reason kickban
set kick(flood) "Excluded Spam / Pub!"


########################
## Mode ANTI/MASSJOIN ##
########################

#-> Number of join in a mass detection / join
set mass(join) "3"

#-> Temp to rehash the reset to 0 mass / join (in seconds)
set mass(rehashjoin) "3"

#-> Temp for removal of the + i (in minutes)
set mass(retraiti) "1"
#-> Reason kickban
set kick(join) "Excluded Spam / Pub!"


###############
## Mode NICK ##
###############

#-> Reason kickban
set kick(nick) "Please change your nickname or whatever you just took!"


###############
## Blacklist ##
###############

#-> Reason kickban
set kick(blacklist) "\02\[\002System B.A.V\02]\002 undesirable!!"


###############
## Blacklist ##
###############

#-> Reason kickban
set kick(notice) "No Notice Salon !"



######################################
###   End of Configuration TcL    ###
######################################


###############################################
##  Creating variables and files .txt        ##
##         for the management of TcL         ##
###############################################

set fichier(modchan) "modchan.txt"
set fichier(modmot) "modmot.txt"
set fichier(modspam) "modspam.txt"
set fichier(modnick) "modnick.txt"
set fichier(protect) "protect.txt"
set fichier(blacklist) "blacklist.txt"


set fichiers [list $::fichier(modchan) $::fichier(modmot) $::fichier(modspam) $::fichier(modnick) $::fichier(protect) $::fichier(blacklist)]
foreach txt $fichiers {
     if ![file exists $txt] {
         close [open $txt w+]
     }
}



#################################################
## Recording chan badnick, badwords            ##
#################################################

bind dcc m xhelp dcc:mod

proc dcc:mod {hand idx arg} {
	putdcc $idx "Tcl commands moderation:"
	putdcc $idx ""
	putdcc $idx "Gestion des chans א modיrer  :"
	putdcc $idx "\002.modchan\002	 14 (To list the moderate chan)"
	putdcc $idx "\002.+modchan\002	 <#chan>14 (Adds a moderate chan)"
	putdcc $idx "\002.-modchan\002	 <#chan>14 (Removes a moderate chan)"
	putdcc $idx ""
	putdcc $idx "Management forbidden words  :"
	putdcc $idx "\002.modmot\002	 14 (To list the banned words)"
	putdcc $idx "\002.+modmot\002	 <mot>14 (Adds a forbidden word)"
	putdcc $idx "\002.-modmot\002	 <mot>14 (Removes a banned word)"
	putdcc $idx ""
	putdcc $idx "No spam management :"
	putdcc $idx "\002.modspam\002	 14 (To list spam banned)"
	putdcc $idx "\002.+modspam\002	 <spam>14 (Adds a prohibited spam)"
	putdcc $idx "\002.-modspam\002	 <spam>14 (Removes a banned spam)"
	putdcc $idx ""
             putdcc $idx "ctcp :"
	putdcc $idx "\002.modctcp\002	 14 (To list spam banned)"
	putdcc $idx "\002.+modctcp\002	 <spam>14 (Adds a prohibited spam)"
	putdcc $idx "\002.-modctcp\002	 <spam>14 (Removes a banned spam)"
	putdcc $idx ""
	putdcc $idx "Maintenance of nicknames allowed  :"
	putdcc $idx "\002.modnick\002	 14 (To list the nicknames allowed)"
	putdcc $idx "\002.+modnick\002	 <nick>14 (Adds a nick banned)"
	putdcc $idx "\002.-modnick\002	 <nick>14 (Removes a banned nick)"
	putdcc $idx ""
	putdcc $idx "Management blacklist  :"
	putdcc $idx "\002.blacklist\002	 14 (To list the blacklist)"
	putdcc $idx "\002.+blacklist\002	 <host>14 (Adds a host to the blacklist)"
	putdcc $idx "\002.-blacklist\002	 <host>14 (Removes a host to the blacklist)"
	putdcc $idx ""
	putdcc $idx "Management xtrusts (Anticlones if installed)  :"
	putdcc $idx "\002.xtrust\002	 14 (Should list the hosts protected (exempt)"
	putdcc $idx "\002.+xtrust\002	 <host>14 (Adds a host to exempt)"
	putdcc $idx "\002.-xtrust\002	 <host>14 (Removes a host exempted)"
	putdcc $idx ""
	putdcc $idx "Management protection against moderation  :"
	putdcc $idx "\002.protect\002	 14 (Should list the hosts protected)"
	putdcc $idx "\002.+protect\002	 <host>14 (Adds a host protected)"
	putdcc $idx "\002.-protect\002	 <host>14 (Removes a host protected)"
	putdcc $idx ""
	putdcc $idx "End of the list of commands tcl moderation."
}

##################
### Procיdures ###
##################

## Modיration ##

bind pubm - * moderation	
  proc moderation { nick host handle channel arg } {
     global modmajuscule modrepetition modmot modspam avert rpt
     set arg [split $arg]
     set msg [join [lrange [split $arg] 0 end]]
     set hostv $nick!$host
     set userhost [getchanhost $nick]
     set userhost "*!*[string range $userhost [string first @ $userhost] e]"
         regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $msg "" msg
         regsub -all -- {\{|\}|\\{|[}{|]}} $msg "" msg
     if {![verify:b $::fichier(modchan) $channel]} {
	 return
	 }
     if {[verify:a $::fichier(protect) $hostv]} {
	 return
	 }
     if {![info exists modmajuscule($host)]} {
	 set modmajuscule($host) 0 
	 utimer $::expiration(majuscule) [list unset modmajuscule($host)]
	 }
     set nombre 0
     foreach x [split $msg {}] {
     if [string match \[A-Z\] $x] {
	 incr nombre
	 }
     }
     if {$nombre > $::detect(majuscule)} {
     incr modmajuscule($host) 1
     if {$::avert(majuscule) < $modmajuscule($host)} {
	     putserv "KICK $channel $nick :$::kick(majuscule)" 
	 set modmajuscule($host) 0 
	 return
	 }
         putserv "NOTICE $nick :$::msg(majuscule)"
}
     if {[info exists rpt($nick)]} {
     if {[lrange $rpt($nick) 2 end]  eq  "$msg"} {
     set cnt [lindex $rpt($nick) 1] 
	 incr cnt
     set rpt($nick) "[lindex $rpt($nick) 0] $cnt [lrange $rpt($nick) 2 end]"
     if {[lindex $rpt($nick) 1] > $::detect(repetition)} {
     if {![info exists modrepetition($host)]} {
	 set modrepetition($host) 0 
	 utimer $::expiration(repetition) [list unset modrepetition($host)]
	 }
     incr modrepetition($host) 1
     if {$::avert(repetition) < $modrepetition($host)} {
	 putserv "KICK $channel $nick :$::kick(repetition)" 
	 set modrepetition($host) 0 
	 return
	 }
      putserv "NOTICE $nick :$::msg(repetition)"
      unset rpt($nick)
     }
   } else {
      set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
	  }
   } else {
     set rpt($nick) "[expr [clock seconds] + 10] 1 $msg"
	 }
     if {[verify:a $::fichier(modmot) $msg]} {
     if {![info exists modmot($host)]} {
	 set modmot($host) 0 
	 utimer $::expiration(mot) [list unset modmot($host)]
	 }
     incr modmot($host) 1
     if {$::avert(mot) < $modmot($host)} {
	     putserv "MODE $channel +b $userhost"
		 putserv "KICK $channel $nick :$::kick(mot)"
	 set modmot($host) 0 
	 return
	 }
         putserv "NOTICE $nick :$::msg(mot)"
     }
     if {[verify:a $::fichier(modspam) $msg]} {
     if {![info exists modspam($host)]} {
	 set modspam($host) 0
	 utimer $::expiration(spam) [list unset modspam($host)]
	 }
     incr modspam($host) 1
     if {$::avert(spam) < $modspam($host)} {
	 putserv "MODE $channel +b $userhost"
	 putserv "KICK $channel $nick :$::kick(spam)" 
	 set modspam($host) 0 
	 return
	 }
     putserv "NOTICE $nick :$::msg(spam)"
}
}


## Mass Flood/join ##

bind pubm - * massflood
bind join - * massjoin

proc massflood { nick uhost handle chan arg } {
   global massflood
     set hostv $nick!$uhost
   if {[verify:a $::fichier(protect) $hostv]} {
   return
   }
   if {![verify:b $::fichier(modchan) $chan]} {
   return
   }
   if {![info exists massflood($chan)]} {
   set massflood($chan) 0 
   utimer $::mass(rehashflood) [list unset massflood($chan)]
   }
   incr massflood($chan) 1
   if {$massflood($chan) eq "$::mass(flood)"} {
       putserv "mode $chan +mi"
       putserv "MODE $channel +b $userhost"
	 putserv "KICK $channel $nick :$::kick(spam)"
	   timer $::mass(retraitm) [list putserv "mode $chan -mi"]
   }
}


proc massjoin {nick host hand chan} {
   global massjoin
     set hostv $nick!$host
   if {[verify:a $::fichier(protect) $hostv]} {
   return
   }
   if {![verify:b $::fichier(modchan) $chan]} {
   return
   }
   if {![info exists massjoin($chan)]} {
   set massjoin($chan) 0 
   utimer $::mass(rehashjoin) [list unset massjoin($chan)]
   }
     incr massjoin($chan) 1
   if {$massjoin($chan) eq "$::mass(join)"} {
      putserv "mode $chan +i"
       putserv "MODE $channel +b $userhost"
	 putserv "KICK $channel $nick :$::kick(spam)"
	  timer $::mass(retraiti) [list putserv "mode $chan -i"]
   }
}

bind notc - * noticechan
proc noticechan {nick host handle text chan} {
set hostv $nick!$host
if {[verify:a $::fichier(protect) $hostv]} {return}
if {![verify:b $::fichier(modchan) $chan]} {return}
putquick "MODE $chan +b $userhost"
putquick "kick $chan $nick :$::kick(notice)"
}

bind ctcp - * ctcpchan
proc ctcpchan {nick host handle text chan} {
set hostv $nick!$host
if {[verify:a $::fichier(protect) $hostv]} {return}
if {![verify:b $::fichier(modchan) $chan]} {return}
putserv "mode $chan +mi"
putquick "MODE $chan +b $userhost"
putquick "kick $chan $nick :$::kick(ctcp)"
 timer $::mass(retraitm) [list putserv "mode $chan -mi"]
}

## Ajout des Spams ##

bind dcc m +modspam +modspam
bind dcc n -modspam -modspam
bind dcc m  modspam modspam

proc +modspam {hand idx arg} {
set spam [lindex $arg 0]
if {$spam eq ""} {putdcc $idx "\002Erreur :\002 .+modspam <spam>";putdcc $idx "\002Exemple :\002 .+modspam *.*.com*"; return}
if {[verify:b $::fichier(modspam) $spam]} {putdcc $idx "\002Erreur :\002 $spam est dיjא enregistrי.";return}
putdcc $idx "\002+modspam :\002 $spam a יtי mis dans la liste."
ajouter:donnee $::fichier(modspam) $spam
}

proc -modspam {hand idx arg} {
set spam [lindex $arg 0]
if {$spam eq ""} {putdcc $idx "\002Erreur :\002 .-modspam <spam>"; return}
if {![verify:b $::fichier(modspam) $spam]} {putdcc $idx "\002Erreur :\002 Le spam $spam n'est pas enregistrי.";return }
putdcc $idx "\002-modspam :\002 $spam n'est plus enregistrי."
effacer:donnee $::fichier(modspam) $spam
}

proc modspam {hand idx arg} {
putdcc $idx "---\002 LISTE DES SPAMS \002---";
liste:donnee $idx $::fichier(modspam)
}



bind pub o|o .+spam +spam
bind pub o|o .-spam -spam
bind pub o|o .spamlist pub:spamlist

proc +spam {nick uhost handle chan text} {
set motspam [lindex $text 0]
if {$motspam eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .+spam <mot spam>";putserv "PRIVMSG $chan :\002Exemple :\002 .+spam msn.com"; return}
if {[verify:b $::fichier(modspam) $motspam]} {putserv "PRIVMSG $chan :\002Erreur :\002 $motspam est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Systטme AntiSpam\02]\002 \02$motspam \002a יtי ajoutי א la liste."
ajouter:donnee $::fichier(modspam) $motspam
}

proc -spam {nick uhost handle chan text} {
set motspam [lindex $text 0]
if {$motspam eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .-bav <motspam>"; return}
if {![verify:b $::fichier(modspam) $motspam]} {putserv "PRIVMSG $chan :\002Erreur :\02$motspam \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Systטme AntiSpam\02]\002 \02$motspam \002 est supprimי de la liste."
effacer:donnee $::fichier(modspam) $motspam
}

proc pub:spamlist {nick uhost hand chan args} {
global motspam  
set fp [open $::fichier(modspam) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Spams "
   putserv "PRIVMSG $nick :4#$fc - $data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
   }





## Ajout des Salons א Modיrer ##

bind dcc n +modchan +modchan
bind dcc n -modchan -modchan
bind dcc n modchan modchan


proc +modchan {hand idx arg} {
set chan [lindex $arg 0]
if {$chan eq ""||[string index $chan 0] ne "#"} {putdcc $idx "\002Erreur :\002 .+modchan <#chan>"; return}
if {[verify:b $::fichier(modchan) $chan]} {putdcc $idx "\002Erreur :\002 $chan est dיjא modיrer.";return}
putdcc $idx "\002+modchan :\002 $chan a יtי mis dans la liste."
ajouter:donnee $::fichier(modchan) $chan
}

proc -modchan {hand idx arg} {
set chan [lindex $arg 0]
if {$chan eq ""||[string index $chan 0] ne "#"} {putdcc $idx "\002Erreur :\002 .-modchan <#chan>"; return}
if {![verify:b $::fichier(modchan) $chan]} {putdcc $idx "\002Erreur :\002 Le chan $chan n'est pas modיrer.";return}
putdcc $idx "\002-modchan :\002 $chan n'est plus modיrי."
effacer:donnee $::fichier(modchan) $chan
}

proc modchan {hand idx arg} {
putdcc $idx "---\002 LISTE DES CHANS MODֹRER \002---";
liste:donnee $idx $::fichier(modchan)
}

####################
# Moderation Salon #
####################

bind pub o|o .+chan +chan
bind pub o|o .-chan -chan
bind pub o|o .listchan pub:listchan

proc +chan {nick uhost handle chan text} {
set moderechan [lindex $text 0]
if {$moderechan eq "" ||[string index $chan 0] ne "#"} {putserv "PRIVMSG $chan :\002Erreur :\002 .+chan <#Salon>";putserv "PRIVMSG $chan :\002Exemple :\002 .+chan #Radio"; return}
if {[verify:b $::fichier(modchan) $moderechan]} {putserv "PRIVMSG $chan :\002Erreur :\002 $moderechan est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002a יtי ajoutי א la liste."
ajouter:donnee $::fichier(modchan) $moderechan
}

proc -chan {nick uhost handle chan text} {
set moderechan [lindex $text 0]
if {$moderechan eq "" ||[string index $chan 0] ne "#"} {putserv "PRIVMSG $chan :\002Erreur :\002 .-chan <#Salon>"; return}
if {![verify:b $::fichier(modchan) $moderechan]} {putserv "PRIVMSG $chan :\002Erreur :\02$moderechan \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Moderation Salon\02]\002 \02$moderechan \002 est supprimי de la liste."
effacer:donnee $::fichier(modchan) $moderechan
}

proc pub:listchan {nick uhost hand chan args} {
global modchan  
set fp [open $::fichier(modchan) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Salons"
   putserv "PRIVMSG $nick :4#$fc - $data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
   }








## Ajout des BadWords ##

bind dcc n +modmot +modmot
bind dcc n -modmot -modmot
bind dcc n modmot modmot

proc +modmot {hand idx arg} {
      set mot [lindex $arg 0]
    if {$mot eq ""} {
	    putdcc $idx "\002Erreur :\002 .+modmot <mot>"
	return
	}
    if {[verify:b $::fichier(modmot) $mot]} {
	    putdcc $idx "\002Erreur :\002 $mot est dיjא enregistrי."
    return
	}
        putdcc $idx "\002+modmot :\002 $mot a יtי mis dans la liste."
        ajouter:donnee $::fichier(modmot) $mot
}

proc -modmot {hand idx arg} {
      set mot [lindex $arg 0]
    if {$mot eq ""} {
	     putdcc $idx "\002Erreur :\002 .-modmot <mot>"
	return
	}
    if {![verify:b $::fichier(modmot) $mot]} {
	     putdcc $idx "\002Erreur :\002 Le mot $mot n'est pas enregistrי."
	return
	}
         putdcc $idx "\002-modmot :\002 $mot n'est plus enregistrי."
         effacer:donnee $::fichier(modmot) $mot
}

proc modmot {hand idx arg} {
       putdcc $idx "---\002 LISTE DES MOTS INTERDIT \002---"
       liste:donnee $idx $::fichier(modmot)
}



bind pub o|o .+badmot +badmot
bind pub o|o .-badmot -badmot
bind pub o|o .badmotlist pub:badmotlist

proc +badmot {nick uhost handle chan text} {
set mot [lindex $text 0]
if {$mot eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .+badmot <mot>";putserv "PRIVMSG $chan :\002Exemple :\002 .+badmot con"; return}
if {[verify:b $::fichier(modmot) $mot]} {putserv "PRIVMSG $chan :\002Erreur :\002 $mot est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Systטme Badmot\02]\002 \02$mot \002a יtי ajoutי א la liste."
ajouter:donnee $::fichier(modmot) $mot
}

proc -badmot {nick uhost handle chan text} {
set mot [lindex $text 0]
if {$mot eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .-badmot <mot>"; return}
if {![verify:b $::fichier(modmot) $mot]} {putserv "PRIVMSG $chan :\002Erreur :\02$mot \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Systטme Badmot\02]\002 \02$mot \002 est supprimי de la liste."
effacer:donnee $::fichier(modmot) $mot
}

proc pub:badmotlist {nick uhost hand chan args} {
global modmot  
set fp [open $::fichier(modmot) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Badmot"
   putserv "PRIVMSG $nick :1#$fc - 4$data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
}





## Ajout des Badnicks ##

bind dcc n +modnick +modnick
bind dcc n -modnick -modnick
bind dcc n  modnick dcc:modnick


proc +modnick {hand idx arg} {
     set nick [lindex $arg 0]
   if {$nick eq ""} {
	   putdcc $idx "\002Erreur :\002 .+modnick <nick>"
	   putdcc $idx "\002Exemple :\002 .+modnick *.*.com*"
    return
	}
    if {[verify:b $::fichier(modnick) $nick]} {
	   putdcc $idx "\002Erreur :\002 $nick est dיjא enregistrי."
	return
	}
    putdcc $idx "\002+modnick :\002 $nick a יtי mis dans la liste."
    ajouter:donnee $::fichier(modnick) $nick
}

proc -modnick {hand idx arg} {
     set nick [lindex $arg 0]
   if {$nick eq ""} {
       putdcc $idx "\002Erreur :\002 .-modnick <nick>"
   return
   }
   if {![verify:b $::fichier(modnick) $nick]} {
       putdcc $idx "\002Erreur :\002 Le nick $nick n'est pas enregistrי."
   return 
   }
       putdcc $idx "\002-modnick :\002 $nick n'est plus enregistrי."
       effacer:donnee $::fichier(modnick) $nick
}

proc dcc:modnick {hand idx arg} {
      putdcc $idx "---\002 LISTE DES NICKS \002---"
    liste:donnee $idx $::fichier(modnick)
}


bind pub o|o .+badnick +badnick
bind pub o|o .-badnick -badnick
bind pub o|o .badnicklist pub:badnicklist

proc +badnick {nick uhost handle chan text} {
set nick [lindex $text 0]
if {$nick eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .+badnick <pseudo>";putserv "PRIVMSG $chan :\002Exemple :\002 .+badnick h_pour_cam*!*@*"; return}
if {[verify:b $::fichier(modnick) $nick]} {putserv "PRIVMSG $chan :\002Erreur :\002 $nick est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Systטme Badnick\02]\002 \02$nick \002a יtי ajoutי א la liste."
ajouter:donnee $::fichier(modnick) $nick
}

proc -badnick {nick uhost handle chan text} {
set nick [lindex $text 0]
if {$nick eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .-badnick <pseudo>"; return}
if {![verify:b $::fichier(modnick) $nick]} {putserv "PRIVMSG $chan :\002Erreur :\02$nick \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Systטme badnick\02]\002 \02$nick \002 est supprimי de la liste."
effacer:donnee $::fichier(modnick) $nick
}

proc pub:badnicklist {nick uhost hand chan args} {
global modnick  
set fp [open $::fichier(modnick) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Badnick"
   putserv "PRIVMSG $nick :1#$fc - 4$data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
}




bind join - "*" modnick

proc modnick { nick uhost handle channel } { 
     set hostv $nick!$uhost
   if {[verify:a $::fichier(protect) $hostv]} {
   return
   }
   if {[string equal -nocase $nick $::botnick]} {
   return
   }
   if {![verify:b $::fichier(modchan) $channel]} {
   return
   }
   if {![verify:a $::fichier(modnick) $nick]} {
   return
   }
   putserv "MODE $channel +b $nick*!*"
   putserv "KICK $channel $nick :$::kick(nick)"
}

bind nick - * modnicksuite

proc modnicksuite { nick uhost handle chan newnick } {
     set hostv $nick!$uhost
   if {[verify:a $::fichier(protect) $hostv]} {
   return
   }
   if {[string equal -nocase $nick $::botnick]} {
   return
   }
   if {![verify:b $::fichier(modchan) $chan]} {
   return
   }
   if {![verify:a $::fichier(modnick) $nick]} {
   return
   }
       putserv "MODE $chan +b $newnick*!*"
       putserv "KICK $chan $newnick :$::kick(nick)"
}



#Ajout dans la blackliste :

bind dcc m +blacklist +blacklist
bind dcc m -blacklist -blacklist
bind dcc m blacklist dcc:blacklist

bind pub o|o .+bav +bav
bind pub o|o .-bav -bav
bind pub o|o .bavlist pub:bavlist

proc +bav {nick uhost handle chan text} {
set host [lindex $text 0]
set pseudo [lindex $text 0]
if {$host eq "" } {putserv "PRIVMSG $chan :\002Erreur :\002 .+bav <host>";putserv "PRIVMSG $chan :\002Exemple :\002 .+bav *!*@0000000.com";putserv "PRIVMSG $chan :\002Exemple :\002 .+bav nOf*!*"; return}
if {$pseudo eq "" || ![string match **!*@* $pseudo]} {putserv "PRIVMSG $chan :4Erreur :1.+bav 4<host> 1ou 4<pseudo*!*@*>";putserv "PRIVMSG $chan :1Exemple :4 .+bav *!*@0000000.com";putserv "PRIVMSG $chan :1Exemple :4 .+bav bOulet*!*@*"; return}
if {[verify:b $::fichier(protect) $host]} {
     putserv "PRIVMSG $chan :\4Refusי :\002 Tu ne peux pas Blacklistי un host ou pseudo protיgי." 
	 putserv "PRIVMSG $::salonm :\0034\|Mode.Alerte.Admin\|\003\ \0034ATTENTION: \00314$nick \0034Host: \00314$uhost \0034a tentי de Blacklister \00314$pseudo \0034Host: \00314$host \0034sur: \00314$chan" 
	 return 1
	 }
if {[verify:b $::fichier(blacklist) $host]} {putserv "PRIVMSG $chan :\002Erreur :\002 $host est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Systטme BAV\02]\002 \02$host \002א יtי mis dans la liste."
ajouter:donnee $::fichier(blacklist) $host

}

proc -bav {nick uhost handle chan text} {
set host [lindex $text 0]
if {$host eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .-bav <host>"; return}
if {![verify:b $::fichier(blacklist) $host]} {putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Systטme BAV\02]\002 \02$host \002 n'est plus BAV."
effacer:donnee $::fichier(blacklist) $host

}

proc pub:bavlist {nick uhost hand chan args} {
global blacklist  
set fp [open $::fichier(blacklist) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Blacklistיs"
   putserv "PRIVMSG $nick :1#$fc - 4$data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
}


proc +blacklist {hand idx arg} {
set host [lindex $arg 0]
if {$host eq ""} {putdcc $idx "\002Erreur :\002 .+blacklist <host>";putdcc $idx "\002Exemple :\002 .+blacklist toto*!*@*.ru"; return}
if {[verify:b $::fichier(blacklist) $host]} {putdcc $idx "\002Erreur :\002 $host est dיjא enregistrי.";return}
putdcc $idx "\002+blacklist :\002 $host a יtי mis dans la liste."
ajouter:donnee $::fichier(blacklist) $host
}

proc -blacklist {hand idx arg} {
set host [lindex $arg 0]
if {$host eq ""} {putdcc $idx "\002Erreur :\002 .-blacklist <host>"; return}
if {![verify:b $::fichier(blacklist) $host]} {putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistrי.";return }
putdcc $idx "\002-blacklist :\002 $host n'est plus enregistrי."
effacer:donnee $::fichier(blacklist) $host
}

proc dcc:blacklist {hand idx arg} {
putdcc $idx "\002 Liste des Ban א Vue";
liste:donnee $idx $::fichier(blacklist)
}



bind join - "*" modblacklist
proc modblacklist { nick host handle channel } { 
set hostv $nick!$host
set userhost [getchanhost $nick]
set userhost "*!*[string range $userhost [string first @ $userhost] e]"
set expire "expire le [clock format [expr 3600 + [clock second]] -format "%d/%m/%Y א %H:%M (GMT+1)"]"
set heure "[clock format [clock seconds] -format "%Y/%m/%d %H:%M"]"
if {[string equal -nocase $nick $::botnick]} {return}
if {![verify:b $::fichier(modchan) $channel]} {return}
if {![verify:a $::fichier(blacklist) $hostv]} {return}
putquick "KICK $channel $nick :$::kick(blacklist) $expire"
putquick "MODE $channel +b $nick*!*@*"
putquick "MODE $channel +b $userhost"
putserv "PRIVMSG $::salonm :\0034\|Mod.KickBan.Blacklist\|\003\ \0034KickBan pour: \00314$nick \0034Host: \00314$userhost \0034(Raison: \00314$::kick(blacklist) ($expire)\0034) \0034sur: \00314$channel" 
}


## Ajout des Pseudos/Hosts א protיger ##

bind dcc o|o +xprotect +xprotect
bind dcc o|o -xprotect -xprotect
bind dcc o|o  xprotect xprotect

proc +xprotect {hand idx arg} {
   set host [lindex $arg 0]
   if {$host eq ""} {
      putdcc $idx "\002Erreur :\002 .+protect <host>"
      putdcc $idx "\002Exemple :\002 .+protect platine*!*@*"
   return
   }
   if {[verify:b $::fichier(protect) $host]} {
      putdcc $idx "\002Erreur :\002 $host est dיjא enregistrי."
   return
   }
      putdcc $idx "\002+protect :\002 Le host $host est maintenant protיgי."
      ajouter:donnee $::fichier(protect) $host
}

proc -xprotect {hand idx arg} {
     set host [lindex $arg 0]
     if {$host eq ""} {
	    putdcc $idx "\002Erreur :\002 .-protect <host>"
	 return
	 }
     if {![verify:b $::fichier(protect) $host]} {
	    putdcc $idx "\002Erreur :\002 Le host $host n'est pas enregistrי."
     return 
	 }
        putdcc $idx "\002-protect :\002 Le host $host n'est plus protיgי."
        effacer:donnee $::fichier(protect) $host
}

proc xprotect {hand idx arg} {
     putdcc $idx "---\002 LISTE DES PROTֹGֹ CONTRE LA MODERATION \002---"
     liste:donnee $idx $::fichier(protect)
}


bind pub o|o .+protect +protect
bind pub m .-protect -protect
bind pub o|o .protectlist pub:protectlist

proc +protect {nick uhost handle chan text} {
set host [lindex $text 0]
if {$host eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .+protect <pseudo/host>";putserv "PRIVMSG $chan :\002Exemple :\002 .+protect nOf*!*@*"; return}
if {[verify:b $::fichier(protect) $host]} {putserv "PRIVMSG $chan :\002Erreur :\002 $host est dיjא enregistrי.";return}
putserv "PRIVMSG $chan :\02\[\002Systטme Protect\02]\002 \02$host \002a יtי ajoutי א la liste."
ajouter:donnee $::fichier(protect) $host
}

proc -protect {nick uhost handle chan text} {
set host [lindex $text 0]
if {$host eq ""} {putserv "PRIVMSG $chan :\002Erreur :\002 .-protect <pseudo/host>"; return}
if {![verify:b $::fichier(protect) $host]} {putserv "PRIVMSG $chan :\002Erreur :\02$host \002n'est pas dans la liste.";return }
putserv "PRIVMSG $chan :\02\[\002Systטme Protect\02]\002 \02$host \002 est supprimי de la liste."
effacer:donnee $::fichier(protect) $host
}

proc pub:protectlist {nick uhost hand chan args} {
global protect  
set fp [open $::fichier(protect) "r"]
set fc -1
  while {![eof $fp]} {
   set data [gets $fp]
   incr fc
   if {$data !=""} {
   putserv "PRIVMSG $nick :2Liste des Protיgיs"
   putserv "PRIVMSG $nick :1#$fc - 4$data" 
   }
   unset data
   }
   close $fp
   putserv "PRIVMSG $nick :2Fin de liste"
}



#######################
# TRAITEMENT FICHIERs #
#######################

proc verify:a {fichierss arg} {
set liste [open $fichierss r]
while {![eof $liste]} {
gets $liste a
regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
if {$a ne ""} {if {[string match -nocase *$a* $arg]} {close $liste;return 1}}
}
close $liste
return 0
}

proc verify:b {fichierss arg} {
set liste [open $fichierss r]
while {![eof $liste]} {
gets $liste a
regsub -all -- {\{|\}|\\{|[}{|]}} $a "" a
if {$a ne ""} {if {[string equal -nocase $a $arg]} {close $liste;return 1}}
}
close $liste
return 0
}

proc ajouter:donnee {fichierss arg} {
set liste [open $fichierss a]
puts $liste "$arg"		
close $liste
}

proc effacer:donnee {fichierss arg} {
set fichier(back) "$fichierss.back"
set load [open $fichier(back) w+]
close $load
set liste [open $fichierss r]
set bcloseback [open $fichier(back) a]
while {![eof $liste]} {
gets $liste a
if {$a ne ""} {if {[string equal -nocase [lindex $a 0] $arg]} {} else {puts $bcloseback "[lindex $a]"}}
}
close $liste
close $bcloseback
file delete $fichierss
file rename $fichier(back) $fichierss
}

proc liste:donnee {idx fichierss} {
set liste [open $fichierss r]
set num 0
while {![eof $liste]} {
gets $liste a
if {$a ne ""} {incr num 1;putdcc $idx "(\002$num\002) [lindex $a 0]"}
}
if {$num eq "0"} { putdcc $idx "Aucun enregistrement." }
putdcc $idx "---\002 FIN DE LA LISTE \002--- Total (\002$num\002)";
close $liste
unset num

}
Post Reply