Communauté sur les Eggdrops - Community about Eggdrops
TCL Service - Printable Version

+- Communauté sur les Eggdrops - Community about Eggdrops (https://forum.eggdrop.fr)
+-- Forum: Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum: Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Thread: TCL Service (/showthread.php?tid=1474)



TCL Service - fedora - 11/12/2013

Bonsoir,

depuis peut je me remet au TCL est je me lance dans un petit projet.
je souhaiterais savoir en utilisant le namespace comment dois je faire pour crée mon link.
dois je mettre tout en variable ?
c'est a dire comme cela ?

tcl
namespace eval ::eva_tcl {
   variable eva
 
variable evaServ "service***.fr"
variable evaIp "myip"
variable evaPort "4400"
variable evaLink "motdepassquitue"
variable evaInfo "TCL Services"
variable evalog "1"
}

ou utilisé dans le namespace set eva(serv) ect ...
car en regardant dans le forum j'ai vue le NS de Alias mais qd j'ajoute genre les commandes op voice ect .. j'ai des erreurs de idx ...

Cordialement


RE: TCL Service - fedora - 13/12/2013

Bonjour,

je rencontre un souci concernant une erreur assez génante car je trouve pas d'ou vient le souci.le Service est bien link au serveur,aucun souci dessus.

erreurs PL
Quote:Tcl error [::eva_tcl::xop]: can't read "eva(idx)": no such variable

code


tcl
bind dcc n xop [namespace current]::xop
proc xop {nick idx args} {
variable eva
if [valididx [set [namespace current]::eva(idx)]] {
set chan [lindex $args 0]
set opnick [lindex $args 1]
if {$chan==""} {
putdcc $idx "\2Syntax:\2 .xop <Salon> <pseudo>."
return 0
}
if {$opnick==""} {
putdcc $idx "\2Syntax:\2 .xop <Salon> <pseudo>." 
return 0
}
putdcc $eva(idx) ":$eva(serv) MODE $chan +o $opnick"
putdcc $eva(idx) ":$eva(serv) $eva(log) :\2\[Commande\]\21 $nick \2->\2 xop"
catch {close $eva(idx)}
}
}




RE: TCL Service - CrazyCat - 13/12/2013


tcl
variable eva
...
putdcc $eva(idx)

Je ne suis pas certain que variable crée $eva au niveau local


RE: TCL Service - fedora - 13/12/2013

j'ai essayé en global eva mais pareille je rencontre toujours la même erreur


tcl
Tcl error [::eva_tcl::xop]: can't read "eva(idx)": no such variable




RE: TCL Service - aliasangelius - 14/12/2013

Salut,
Donc à savoir pour ce système la c'est des "set" et non des "variable" lors des appels de serveur etc..

Je te fait voir un exemple :


tcl
namespace eval ::eva {
   variable eva
 
set evaServ "service***.fr"
set evaIp "myip"
set evaPort "4400"
set evaLink "motdepassquitue"
set evaInfo "TCL Services"


Pour ce qui et de ta procédure de xop, Elle et bonne c'est juste t'es variables qui faisait merder.
Du moins essaye ainsi et dit le si celà merde encore ou pas !


RE: TCL Service - CrazyCat - 14/12/2013

Sais tu quel appel de eva(idx) te retourne ça ?


RE: TCL Service - aliasangelius - 14/12/2013

A savoir, variable sa créer absolument pas la var !
Il fait comme un bloque de mémoire en gros, et pour que il sache ce tiens tel que $evaIP il faut le set pour permettre que info exists retourne le 0

Sinon, Tiens prend exemple sur celui que j'avais que djkenny m'avais refait :


tcl
namespace eval ::socks {
   variable aurore
 
#********************#
# Service.Socket 1.0 #
#********************#
 
#**************************#
# Information link reseau. #
#**************************#
 
set aurore(serv) "Aurore.****.fr"
set aurore(ip) "ip"
set aurore(port) "port"
set aurore(pwdlink) "pass"
set aurore(info) "Aurore Services"
 
#****************************#
# Configuration des sockets. #
#****************************#
 
set aurore(nick) "Hera"
set aurore(identd) "Hera"
set aurore(host) "Services.****.fr"
set aurore(nom) "Services-Log"
 
#***************************#
# Salon de log des sockets. #
#***************************#
 
set aurore(log) "#Services"
set aurore(quit01) "Redemarage Aurore-Service."
set aurore(quit02) "Fermeture Aurore-Service."
 
#****************************************#
# Lancement de la procédure des sockets. #
#****************************************#
 
proc checkconnect {} {
   if {![info exists aurore(idx)]} { utimer 30 [namespace current]::checkconnect } else { xconnect:serv }
}
 
proc xconnect:serv {} {
   variable aurore
   if [catch {set aurore(idx) [connect $aurore(ip) $aurore(port)]} err] {
      putlog "Connection error :$err"
      return
   }
   putdcc $aurore(idx) "PASS $aurore(pwdlink)"
   putdcc $aurore(idx) "SERVER $aurore(serv) 1 [unixtime] [unixtime] J09 ACAA\] +s :$aurore(info)"
   putdcc $aurore(idx) ":$aurore(serv) NICK $aurore(nick) '' '' $aurore(identd) $aurore(host) $aurore(serv) '' :$aurore(nom)"
   putdcc $aurore(idx) ":$aurore(nick) MODE $aurore(nick) +owsgkd"
   putdcc $aurore(idx) ":$aurore(nick) JOIN $aurore(log)"
   putdcc $aurore(idx) ":$aurore(nick) MODE $aurore(log) +ntsv $aurore(nick)"
   control $aurore(idx) [namespace current]::controling_server
   utimer 10 [namespace current]::verify
}
 
#***********************************#
# Verify si le serveur est Connecté #
#***********************************#
 
proc verify {} {
   variable aurore
   if [valididx [set [namespace current]::aurore(idx)]] {
      utimer 30 [namespace current]::verify
   } else {
      xconnect:serv
   }
}
 
proc controling_server {idx arg} {
   variable aurore
   set arg1 [lindex [split $arg " "] 0]
   set arg2 [lindex [split $arg " "] 1]
   set arg3 [lindex [split $arg " "] 2]
   set arg4 [lindex [split $arg " "] 3]
   set arg5 [lindex [split $arg " "] 4]
   set arg6 [lindex [split $arg " "] 5]
   set arg7 [lindex [split $arg " "] 6]
   set arg8 [lindex [split $arg " "] 7]
   set arg10 [string trim [lrange [split $arg " "] 3 end] :]
   if {$arg2=="PING"} {
      putdcc $aurore(idx) ":$aurore(serv) PONG $aurore(ip) :$aurore(serv)"
    }   
}
 
#**********************#
# Restart des sockets. #
#**********************#
 
bind evnt - prerestart [namespace current]::eva:restart
proc eva:restart {args} {
   variable aurore
   putdcc $aurore(idx) ":$aurore(serv) SQUIT $aurore(serv) :Restart Sockets."
   catch {close $aurore(idx)}
}
 
#********************#
# Rehash du Service. #
#********************#
 
bind dcc n xrehash [namespace current]::eggy:xrehash
proc eggy:xrehash {nick idx arg} {
   variable aurore
   putdcc $idx "\002Rehash de Aurore-Service et des fichiers\002"
   utimer 4 rehash
}
 
#*********************#
# Restart du Service. #
#*********************#
 
bind dcc n xrestart [namespace current]::eggy:xrestart
proc eggy:xrestart {nick idx arg} {
   variable aurore
   putdcc $idx "\002Redémarrage de Aurore-service\002"
   if [valididx [set [namespace current]::aurore(idx)]] {
      putdcc $aurore(idx) ":$aurore(nick) QUIT :$aurore(quit01)"
      putdcc $aurore(idx) ":$aurore(serv) SQUIT :$aurore(serv)"
      catch {close $aurore(idx)}
      foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
      }
    }
    xconnect:serv
}
 
#*****************#
# Die du Service. #
#*****************#
 
bind dcc n xdie [namespace current]::eggy:xdie
proc eggy:xdie {nick idx arg} {
    putdcc $idx "\002Arrêt de Aurore-Service\002"
    if [valididx [set [namespace current]::aurore(idx)]] {
       putdcc $aurore(idx) ":$aurore(nick) QUIT : $aurore(quit02)"
       putdcc $aurore(idx) ":$aurore(serv) SQUIT :$aurore(quit02)"
       catch {close $aurore(idx)}
       foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
       }
   }
}
 
#****************************#
# Fin du Service Sockets 1.0 #
#****************************#
# connection 
[namespace current]::xconnect:serv
}
 
putlog "\0031Service Sockets 1.0 \0034Chargé."




RE: TCL Service - fedora - 14/12/2013

(14/12/2013, 12:34)aliasangelius Wrote: A savoir, variable sa créer absolument pas la var !
Il fait comme un bloque de mémoire en gros, et pour que il sache ce tiens tel que $evaIP il faut le set pour permettre que info exists retourne le 0

Sinon, Tiens prend exemple sur celui que j'avais que djkenny m'avais refait :


tcl
namespace eval ::socks {
   variable aurore
 
#********************#
# Service.Socket 1.0 #
#********************#
 
#**************************#
# Information link reseau. #
#**************************#
 
set aurore(serv) "Aurore.****.fr"
set aurore(ip) "ip"
set aurore(port) "port"
set aurore(pwdlink) "pass"
set aurore(info) "Aurore Services"
 
#****************************#
# Configuration des sockets. #
#****************************#
 
set aurore(nick) "Hera"
set aurore(identd) "Hera"
set aurore(host) "Services.****.fr"
set aurore(nom) "Services-Log"
 
#***************************#
# Salon de log des sockets. #
#***************************#
 
set aurore(log) "#Services"
set aurore(quit01) "Redemarage Aurore-Service."
set aurore(quit02) "Fermeture Aurore-Service."
 
#****************************************#
# Lancement de la procédure des sockets. #
#****************************************#
 
proc checkconnect {} {
   if {![info exists aurore(idx)]} { utimer 30 [namespace current]::checkconnect } else { xconnect:serv }
}
 
proc xconnect:serv {} {
   variable aurore
   if [catch {set aurore(idx) [connect $aurore(ip) $aurore(port)]} err] {
      putlog "Connection error :$err"
      return
   }
   putdcc $aurore(idx) "PASS $aurore(pwdlink)"
   putdcc $aurore(idx) "SERVER $aurore(serv) 1 [unixtime] [unixtime] J09 ACAA\] +s :$aurore(info)"
   putdcc $aurore(idx) ":$aurore(serv) NICK $aurore(nick) '' '' $aurore(identd) $aurore(host) $aurore(serv) '' :$aurore(nom)"
   putdcc $aurore(idx) ":$aurore(nick) MODE $aurore(nick) +owsgkd"
   putdcc $aurore(idx) ":$aurore(nick) JOIN $aurore(log)"
   putdcc $aurore(idx) ":$aurore(nick) MODE $aurore(log) +ntsv $aurore(nick)"
   control $aurore(idx) [namespace current]::controling_server
   utimer 10 [namespace current]::verify
}
 
#***********************************#
# Verify si le serveur est Connecté #
#***********************************#
 
proc verify {} {
   variable aurore
   if [valididx [set [namespace current]::aurore(idx)]] {
      utimer 30 [namespace current]::verify
   } else {
      xconnect:serv
   }
}
 
proc controling_server {idx arg} {
   variable aurore
   set arg1 [lindex [split $arg " "] 0]
   set arg2 [lindex [split $arg " "] 1]
   set arg3 [lindex [split $arg " "] 2]
   set arg4 [lindex [split $arg " "] 3]
   set arg5 [lindex [split $arg " "] 4]
   set arg6 [lindex [split $arg " "] 5]
   set arg7 [lindex [split $arg " "] 6]
   set arg8 [lindex [split $arg " "] 7]
   set arg10 [string trim [lrange [split $arg " "] 3 end] :]
   if {$arg2=="PING"} {
      putdcc $aurore(idx) ":$aurore(serv) PONG $aurore(ip) :$aurore(serv)"
    }   
}
 
#**********************#
# Restart des sockets. #
#**********************#
 
bind evnt - prerestart [namespace current]::eva:restart
proc eva:restart {args} {
   variable aurore
   putdcc $aurore(idx) ":$aurore(serv) SQUIT $aurore(serv) :Restart Sockets."
   catch {close $aurore(idx)}
}
 
#********************#
# Rehash du Service. #
#********************#
 
bind dcc n xrehash [namespace current]::eggy:xrehash
proc eggy:xrehash {nick idx arg} {
   variable aurore
   putdcc $idx "\002Rehash de Aurore-Service et des fichiers\002"
   utimer 4 rehash
}
 
#*********************#
# Restart du Service. #
#*********************#
 
bind dcc n xrestart [namespace current]::eggy:xrestart
proc eggy:xrestart {nick idx arg} {
   variable aurore
   putdcc $idx "\002Redémarrage de Aurore-service\002"
   if [valididx [set [namespace current]::aurore(idx)]] {
      putdcc $aurore(idx) ":$aurore(nick) QUIT :$aurore(quit01)"
      putdcc $aurore(idx) ":$aurore(serv) SQUIT :$aurore(serv)"
      catch {close $aurore(idx)}
      foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
      }
    }
    xconnect:serv
}
 
#*****************#
# Die du Service. #
#*****************#
 
bind dcc n xdie [namespace current]::eggy:xdie
proc eggy:xdie {nick idx arg} {
    putdcc $idx "\002Arrêt de Aurore-Service\002"
    if [valididx [set [namespace current]::aurore(idx)]] {
       putdcc $aurore(idx) ":$aurore(nick) QUIT : $aurore(quit02)"
       putdcc $aurore(idx) ":$aurore(serv) SQUIT :$aurore(quit02)"
       catch {close $aurore(idx)}
       foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
       }
   }
}
 
#****************************#
# Fin du Service Sockets 1.0 #
#****************************#
# connection 
[namespace current]::xconnect:serv
}
 
putlog "\0031Service Sockets 1.0 \0034Chargé."

Bonjour,

merci pour vos réponse rapide,et alias justement je me suis basé dessus voir même laissé comme ça le tcl en y rajoutant juste la proc xop mais toujours le même problème survient ...

CrazyCat je vais voir tout a heure ce que me retourne eva(idx)


RE: TCL Service - aliasangelius - 14/12/2013

Ok, Essaye.
Sinon si le problème persiste pourrais tu joindre le TCL au complet ?

J'aimerais voir une chose si cela et possible ! Merci d'avance "Bien sur si sa ne te dérange pas".


RE: TCL Service - fedora - 14/12/2013

oui pas de souci


tcl
namespace eval ::eva_tcl {
variable version "0.2 RC1"
variable eva
 
#********************#
# Service.Socket 1.0 by Alias#
#********************#
 
#**************************#
# Information link reseau. #
#**************************#
 
set eva(serv) "link.***.fr"
set eva(ip) "myip"
set eva(port) "4400"
set eva(pwdlink) "mot de passe"
set eva(info) "TCL Services"
#****************************#
# Configuration des sockets. #
#****************************#
 
set eva(nick) "Eva_TCL"
set eva(identd) "Data"
set eva(host) "localhost.com"
set eva(nom) "Services TCL"
 
#***************************#
# Salon de log des sockets. #
#***************************#
 
set eva(log) "#Services"
set eva(quit01) "Redemarage Service."
set eva(quit02) "Fermeture Service."
 
#****************************************#
# Lancement de la procédure des sockets. #
#****************************************#
proc checkconnect {} {
   if {![info exists eva(idx)]} { utimer 30 [namespace current]::checkconnect } else { xconnect:serv }
}
 
proc xconnect:serv {} {
   variable eva
   if [catch {set eva(idx) [connect $eva(ip) $eva(port)]} err] {
      putlog "Connection error :$err"
      return
   }
   putdcc $eva(idx) "PASS $eva(pwdlink)"
   putdcc $eva(idx) "SERVER $eva(serv) 1 [unixtime] [unixtime] J09 :TCL Services"
   putdcc $eva(idx) ":$eva(serv) NICK $eva(nick) 1 1 $eva(identd) $eva(ip) $eva(serv) :$eva(info)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(nick) +ikdowgs 16384"
   putdcc $eva(idx) ":$eva(nick) JOIN $eva(log)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(log) +nOtsv $eva(nick)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(log) +o $eva(nick)"
   putdcc $eva(idx) ":$eva(nick) TOPIC $eva(log) :1\[Eva Service\] Bienvenue sur le Channel des Logs de \2$eva(nick)\2 !"
   control $eva(idx) [namespace current]::controling_server
   utimer 10 [namespace current]::verify
}
 
#***********************************#
# Verify si le serveur est Connecté #
#***********************************#
 
proc verify {} {
   variable eva
   if [valididx [set [namespace current]::eva(idx)]] {
      utimer 30 [namespace current]::verify
   } else {
      xconnect:serv
   }
}
 
proc controling_server {idx arg} {
   variable eva
   set arg1 [lindex [split $arg " "] 0]
   set arg2 [lindex [split $arg " "] 1]
   set arg3 [lindex [split $arg " "] 2]
   set arg4 [lindex [split $arg " "] 3]
   set arg5 [lindex [split $arg " "] 4]
   set arg6 [lindex [split $arg " "] 5]
   set arg7 [lindex [split $arg " "] 6]
   set arg8 [lindex [split $arg " "] 7]
   set arg10 [string trim [lrange [split $arg " "] 3 end] :]
   if [valididx [set [namespace current]::eva(idx)]] {
   if {$arg2=="PING"} {
      putdcc $eva(idx) ":$eva(serv) PONG $eva(ip) :$eva(serv)"
    }	
    }
 }
#**********************#
# Restart des sockets. #
#**********************#
 
proc eva:restart {args} {
   variable eva
   putdcc $eva(idx) ":$eva(serv) SQUIT $eva(serv) :Restart Sockets."
   catch {close $eva(idx)}
}
 
#********************#
# Rehash du Service. #
#********************#
 
proc eggy:xrehash {nick idx arg} {
   variable eva
   putdcc $idx "\002Rehash de TCL Service et des fichiers\002"
   utimer 4 rehash
}
 
#*********************#
# Restart du Service. #
#*********************#
 
proc eggy:xrestart {nick idx arg} {
   variable eva
   putdcc $idx "\002Redémarrage de TCL Service\002"
   if [valididx [set [namespace current]::eva(idx)]] {
      putdcc $eva(idx) ":$eva(nick) QUIT :$eva(quit01)"
      putdcc $eva(idx) ":$eva(serv) SQUIT :$eva(serv)"
      catch {close $eva(idx)}
      foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
      }
    }
    xconnect:serv
}
 
#*****************#
# Die du Service. #
#*****************#
 
proc eggy:xdie {nick idx arg} {
variable eva
    putdcc $idx "\002Arrêt de TCL Service\002"
    if [valididx [set [namespace current]::eva(idx)]] {
       putdcc $eva(idx) ":$eva(nick) QUIT : $eva(quit02)"
       putdcc $eva(idx) ":$eva(serv) SQUIT :$eva(quit02)"
       catch {close $eva(idx)}
       foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
       }
   }
}
 
proc xop {nick idx arg} {
variable eva
  set salon [lindex $arg 0]
  set pseudo [lindex $arg 1]
  if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
	putdcc $idx "\2Utilisation:\2 xop <salon> <pseudo>"
	return 0
  }
if [valididx [set [namespace current]::eva(idx)]] {
putdcc $eva(idx) ":$eva(nick) MODE $salon +o $pseudo"
putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\2\[Commande\]\21 $nick \2->\2 xop"
catch {close $eva(idx)}
	}
}
 
proc xdeop {nick idx arg} {
  variable eva
  set salon [lindex $arg 0]
  set pseudo [lindex $arg 1]
  if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
	putdcc $idx "\2Utilisation:\2 xdeop <salon> <pseudo>"
	return 0
  }
  if [valididx [set [namespace current]::eva(idx)]] {
  putdcc $eva(idx) ":$eva(nick) MODE $salon -o $pseudo"
  putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xdéOp\] *** $pseudo sur $salon par: $nick" 
  catch {close $eva(idx)}
	}
  putlog "*** Xdéop par $nick - $pseudo sur $salon"
}
 
 
proc xvoice {nick idx arg} {
  variable eva 
  set salon [lindex $arg 0]
  set pseudo [lindex $arg 1]
  if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
	putdcc $idx "\2Utilisation:\2 xvoice <salon> <pseudo>"
	return 0
  }
  if [valididx [set [namespace current]::eva(idx)]] {
  putdcc $eva(idx) ":$eva(nick) MODE $salon +v $pseudo"
  putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xVoice\] *** $pseudo sur $salon par: $nick" 
  catch {close $eva(idx)}
	}
  putlog "*** Xvoice par $nick - $pseudo sur $salon"
}
 
 
proc xdevoice {nick idx arg} {
variable eva 
  set salon [lindex $arg 0]
  set pseudo [lindex $arg 1]
  if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
	putdcc $idx "\2Utilisation:\2 xdevoice <salon> <pseudo>"
	return 0
  }
  if [valididx [set [namespace current]::eva(idx)]] {
  putdcc $eva(idx) ":$eva(nick) MODE $salon -v $pseudo"
  putlog "$eva(idx) :$eva(nick) MODE $salon -v $pseudo"
 putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xdeVoice\] *** $pseudo sur $salon par: $nick" 
 catch {close $eva(idx)}
	}
  putlog "*** Xdévoice par $nick - $pseudo sur $salon"
}
 
proc Pljoin {hand idx args} {
variable eva
	putdcc $idx "\0034\002\[\002\0031Authentification \0033\037OK\037\0034\002\]"
    if [valididx [set [namespace current]::eva(idx)]] {
	putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\0034|Join.Partyline\|\0032 - $hand vient de joindre la party-line."
	catch {close $eva(idx)}
		}
	}
 
proc Plpart {hand idx args} {
	variable eva 
	 if [valididx [set [namespace current]::eva(idx)]] {
	putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\0034|Part.Partyline\|\0032 - $hand vient de se déconnecter de la party line."
	catch {close $eva(idx)}   
		}
	}
#****************************#
# Fin du Service Sockets 1.0 #
#****************************#
bind evnt - prerehash [namespace current]::uninstall
bind evnt - prerestart [namespace current]::eva:restart
bind dcc n xrehash [namespace current]::eggy:xrehash
bind dcc n xrestart [namespace current]::eggy:xrestart
bind dcc n xdie [namespace current]::eggy:xdie
bind dcc n xop [namespace current]::xop
bind dcc - xdeop [namespace current]::xdeop
bind dcc - xvoice [namespace current]::xvoice
bind dcc - xdevoice [namespace current]::xdevoice
bind chon - * [namespace current]::Pljoin	
bind chof - * [namespace current]::Plpart
# connection
[namespace current]::xconnect:serv
}
putlog "[file tail [info script]] V[set eva_tcl::version] loaded success"


le souci n'y ai plus a partir du moment ou je kill le pid et relance le service.


RE: TCL Service - aliasangelius - 15/12/2013

Essaye comme ça voir :


tcl
namespace eval ::eva_tcl {
    variable eva
    variable version "0.2 RC1"
 
#************#
# Les Binds. #
#************#
 
bind evnt - "prerehash" [namespace current]::uninstall
bind evnt - "prerestart" [namespace current]::eva:restart
bind dcc n "xrehash" [namespace current]::eggy:xrehash
bind dcc n "xrestart" [namespace current]::eggy:xrestart
bind dcc n "xdie" [namespace current]::eggy:xdie
bind dcc n "xop" [namespace current]::xop
bind dcc - "xdeop" [namespace current]::xdeop
bind dcc - "xvoice" [namespace current]::xvoice
bind dcc - "xdevoice" [namespace current]::xdevoice
bind chon - "*" [namespace current]::Pljoin   
bind chof - "*" [namespace current]::Plpart
 
#********************#
# Service.Socket 1.0 by Alias#
#********************#
 
#**************************#
# Information link reseau. #
#**************************#
 
set eva(serv) "link.***.fr"
set eva(ip) "myip"
set eva(port) "4400"
set eva(pwdlink) "mot de passe"
set eva(info) "TCL Services"
#****************************#
# Configuration des sockets. #
#****************************#
 
set eva(nick) "Eva_TCL"
set eva(identd) "Data"
set eva(host) "localhost.com"
set eva(nom) "Services TCL"
 
#***************************#
# Salon de log des sockets. #
#***************************#
 
set eva(log) "#Services"
set eva(quit01) "Redemarage Service."
set eva(quit02) "Fermeture Service."
 
#****************************************#
# Lancement de la procédure des sockets. #
#****************************************#
proc checkconnect {} {
   if {![info exists eva(idx)]} { utimer 30 [namespace current]::checkconnect } else { xconnect:serv }
}
 
proc xconnect:serv {} {
   variable eva
   if [catch {set eva(idx) [connect $eva(ip) $eva(port)]} err] {
      putlog "Connection error :$err"
      return
   }
   putdcc $eva(idx) "PASS $eva(pwdlink)"
   putdcc $eva(idx) "SERVER $eva(serv) 1 [unixtime] [unixtime] J09 :TCL Services"
   putdcc $eva(idx) ":$eva(serv) NICK $eva(nick) 1 1 $eva(identd) $eva(ip) $eva(serv) :$eva(info)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(nick) +ikdowgs 16384"
   putdcc $eva(idx) ":$eva(nick) JOIN $eva(log)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(log) +nOtsv $eva(nick)"
   putdcc $eva(idx) ":$eva(nick) MODE $eva(log) +o $eva(nick)"
   putdcc $eva(idx) ":$eva(nick) TOPIC $eva(log) :\0031\[Eva Service\] Bienvenue sur le Channel des Logs de \2$eva(nick)\2 !"
   control $eva(idx) [namespace current]::controling_server
   utimer 10 [namespace current]::verify
}
 
#***********************************#
# Verify si le serveur est Connecté #
#***********************************#
 
proc verify {} {
   variable eva
   if [valididx [set [namespace current]::eva(idx)]] {
      utimer 30 [namespace current]::verify
   } else {
      xconnect:serv
   }
}
 
proc controling_server {idx arg} {
   variable eva
   set arg1 [lindex [split $arg " "] 0]
   set arg2 [lindex [split $arg " "] 1]
   set arg3 [lindex [split $arg " "] 2]
   set arg4 [lindex [split $arg " "] 3]
   set arg5 [lindex [split $arg " "] 4]
   set arg6 [lindex [split $arg " "] 5]
   set arg7 [lindex [split $arg " "] 6]
   set arg8 [lindex [split $arg " "] 7]
   set arg10 [string trim [lrange [split $arg " "] 3 end] :]
   if [valididx [set [namespace current]::eva(idx)]] {
   if {$arg2=="PING"} {
      putdcc $eva(idx) ":$eva(serv) PONG $eva(ip) :$eva(serv)"
    }   
    }
}
#**********************#
# Restart des sockets. #
#**********************#
 
proc eva:restart {args} {
   variable eva
   putdcc $eva(idx) ":$eva(serv) SQUIT $eva(serv) :Restart Sockets."
   catch {close $eva(idx)}
}
 
#********************#
# Rehash du Service. #
#********************#
 
proc eggy:xrehash {nick idx arg} {
   variable eva
   putdcc $idx "\002Rehash de TCL Service et des fichiers\002"
   utimer 4 rehash
}
 
#*********************#
# Restart du Service. #
#*********************#
 
proc eggy:xrestart {nick idx arg} {
   variable eva
   putdcc $idx "\002Redémarrage de TCL Service\002"
   if [valididx [set [namespace current]::eva(idx)]] {
      putdcc $eva(idx) ":$eva(nick) QUIT :$eva(quit01)"
      putdcc $eva(idx) ":$eva(serv) SQUIT :$eva(serv)"
      catch {close $eva(idx)}
      foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
      }
    }
    xconnect:serv
}
 
#*****************#
# Die du Service. #
#*****************#
 
proc eggy:xdie {nick idx arg} {
variable eva
    putdcc $idx "\002Arrêt de TCL Service\002"
    if [valididx [set [namespace current]::eva(idx)]] {
       putdcc $eva(idx) ":$eva(nick) QUIT : $eva(quit02)"
       putdcc $eva(idx) ":$eva(serv) SQUIT :$eva(quit02)"
       catch {close $eva(idx)}
       foreach kill [utimers] {
          if {[lindex $kill 1]=="[namespace current]::verify"} { killutimer [lindex $kill 2] }
       }
   }
}
 
proc xop {nick idx arg} {
    variable eva
    set salon [lindex $arg 0]
    set pseudo [lindex $arg 1]
    if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
        putdcc $idx "\2Utilisation:\2 xop <salon> <pseudo>"
        return 0
    }
    if [valididx [set [namespace current]::eva(idx)]] {
        putdcc $eva(idx) ":$eva(nick) MODE $salon +o $pseudo"
        putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\2\[Commande\]\2 \00311 $nick \2->\2 xop"
        catch {close $eva(idx)}
    }
}
 
proc xdeop {nick idx arg} {
    variable eva
    set salon [lindex $arg 0]
    set pseudo [lindex $arg 1]
    if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
        putdcc $idx "\2Utilisation:\2 xdeop <salon> <pseudo>"
        return 0
    }
    if [valididx [set [namespace current]::eva(idx)]] {
        putdcc $eva(idx) ":$eva(nick) MODE $salon -o $pseudo"
        putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xdéOp\] *** $pseudo sur $salon par: $nick"
        catch {close $eva(idx)}
    }
    putlog "*** Xdéop par $nick - $pseudo sur $salon"
}
 
 
proc xvoice {nick idx arg} {
    variable eva
    set salon [lindex $arg 0]
    set pseudo [lindex $arg 1]
    if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
        putdcc $idx "\2Utilisation:\2 xvoice <salon> <pseudo>"
        return 0
    }
    if [valididx [set [namespace current]::eva(idx)]] {
        putdcc $eva(idx) ":$eva(nick) MODE $salon +v $pseudo"
        putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xVoice\] *** $pseudo sur $salon par: $nick"
        catch {close $eva(idx)}
    }
    putlog "*** Xvoice par $nick - $pseudo sur $salon"
}
 
 
proc xdevoice {nick idx arg} {
    variable eva
    set salon [lindex $arg 0]
    set pseudo [lindex $arg 1]
    if {$salon=="" || $pseudo=="" || ![string match *#* $salon]} {
        putdcc $idx "\2Utilisation:\2 xdevoice <salon> <pseudo>"
        return 0
    }
    if [valididx [set [namespace current]::eva(idx)]] {
        putdcc $eva(idx) ":$eva(nick) MODE $salon -v $pseudo"
        putlog "$eva(idx) :$eva(nick) MODE $salon -v $pseudo"
        putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\[xdeVoice\] *** $pseudo sur $salon par: $nick"
        catch {close $eva(idx)}
    }
    putlog "*** Xdévoice par $nick - $pseudo sur $salon"
}
 
proc Pljoin {hand idx args} {
variable eva
   putdcc $idx "\0034\002\[\002\0031Authentification \0033\037OK\037\0034\002\]"
    if [valididx [set [namespace current]::eva(idx)]] {
   putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\0034|Join.Partyline\|\0032 - $hand vient de joindre la party-line."
   catch {close $eva(idx)}
      }
   }
 
proc Plpart {hand idx args} {
   variable eva 
    if [valididx [set [namespace current]::eva(idx)]] {
   putdcc $eva(idx) ":$eva(nick) PRIVMSG $eva(log) :\0034|Part.Partyline\|\0032 - $hand vient de se déconnecter de la party line."
   catch {close $eva(idx)}   
      }
   }
#****************************#
# Fin du Service Sockets 1.0 #
#****************************#
 
# connection
[namespace current]::xconnect:serv
}
putlog "[file tail [info script]] V[set eva_tcl::version] loaded success"