Log connexions
#11
Avec un code bien indenté et proprement structuré, ça donnerait plutôt:
tcl
#################
##  PUTQUICK  ##
###############
proc putquick {arg} {
   append arg "\n"
   putdccraw 0 [string length $arg] $arg
}
 
bind raw - NOTICE connexion
proc connexion {from key arg} {
   global botnick notc mod
   set text [split $arg]
   if {[string match -nocase "*notice*client*connecting*" $text]} {
      set g_nick [lindex $text 9]
      set g_user [string range [lindex [split [lindex $text 10] "@"] 0] 1 end]
      set g_host [string range [lindex [split [lindex $text 10] "@"] 1] 0 end-1]
      set g_userhost "$g_nick!$g_user@$g_host"
      set ts [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S"]
      set connexion "$g_nick $g_host $ts"
      putquick "PRIVMSG #test :\00301Connexion de:\00303 $g_nick \00301sous le host \00301$g_user\00304@\00301$g_host"
      set logfichier [open "connect.txt" "a+"]
      puts $logfichier $connexion
      close $logfichier
   }
   return 0
}
 
bind pub - !connect connects
proc connects { nick uhost handle channel arg } {  
   putquick "NOTICE $nick :\0033..:Liste des connexions:.."
   catch {open "connect.txt" "r"} connexion
   set num 0
   while {![eof $connexion]} {
      gets $connexion verif
      if {$verif ne "" && [string match -nocase *$arg* $verif]} {
         incr num 1;
         putquick "NOTICE $nick :\0034 $num -->\0033 [lrange $verif 0 end] \r"
      }
   }
   catch {close $connexion}
   if {$num eq "0"} {putquick "NOTICE $nick :\0034Aucune connexion dans la base de donnée ! \r; return 0"}
   putquick "NOTICE $nick :\0033Fin de la Liste (\0034 $num \0033connexion(s) enregistré(s))";
   return 0
}


Répondre


Messages dans ce sujet
Log connexions - par Aristide - 06/09/2011, 00:27
RE: Log connexions - par CrazyCat - 07/09/2011, 09:54
RE: Log connexions - par Aristide - 09/09/2011, 00:06
RE: Log connexions - par djkenny - 09/09/2011, 07:39
RE: Log connexions - par djkenny - 09/09/2011, 08:01
RE: Log connexions - par Aristide - 09/09/2011, 16:20
RE: Log connexions - par djkenny - 09/09/2011, 18:30
RE: Log connexions - par CrazyCat - 09/09/2011, 21:48
RE: Log connexions - par djkenny - 09/09/2011, 22:31
RE: Log connexions - par Aristide - 09/09/2011, 22:43
RE: Log connexions - par CrazyCat - 09/09/2011, 22:55
RE: Log connexions - par Aristide - 09/09/2011, 23:06

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté