IrcWeb... rendre visible aussi ce que le bot dit sur le canal (ircweb.tcl
#1
S.v.p... comment faire en sorte que ce que le bot dit sur irc soit aussi visible sur le fichier.html... je ne comprend pas trop quand et où utiliser $botnick


tcl
##### DEBUT DU PROGRAMME #####
 
bind ctcp - ACTION action:i2w
bind join - * join:i2w
bind kick - * kick:i2w
bind mode - * mode:i2w
bind nick - * nick:i2w
bind part - * part:i2w
bind pubm - * pubm:i2w
bind sign - * sign:i2w
bind topc - * topc:i2w
 
proc i2w:generate:html {} {
	global irc2web server
 
	if {![info exists irc2web(memoire)]} { set irc2web(memoire) [list] }
	
	### si on a choisi l'option 3
	if {$irc2web(log) == 3} {
		if {[llength $irc2web(memoire)] > $irc2web(maxligne)} {
			set irc2web(memoire) [lrange $irc2web(memoire) 1 end]
		}
	}
	
	### on verifie que le channel donné existe :
	if {(![validchan $irc2web(channel)]) && (![isdynamic $irc2web(channel)])} {
		putlog "#IRC2WEB# ERREUR ! $irc2channel n'existe pas !"
		return 0
	}
	
	### on ouvre le fichier HTML et on met tout l'en-tete
	set openhtml [open $irc2web(htmlfile) w]
	puts $openhtml "<HTML>\n<HEAD>\n <TITLE>$irc2web(titre)</TITLE>\n <META HTTP-EQUIV=\"Refresh\" CONTENT=\"$irc2web(refresh)\">\n</HEAD>"
	puts $openhtml "<BODY width=\"80%\"TEXT=\"$irc2web(texte)\" BGCOLOR=\"$irc2web(bg)\" LINK=\"$irc2web(entete)\" VLINK=\"$irc2web(entete)\">"
	puts $openhtml "<center><img src=\"./modules/mirc/img/mirc.gif\" border=\"0\"><img src=\"./modules/mirc/img/tchat.gif\" border=\"0\"></center></br>"
	puts $openhtml "<center><FONT SIZE=\"+1\" COLOR=\"$irc2web(entete)\" FACE=\"Tahoma, Sans-serif\">Nom du canal sur UNDERNET: <FONT COLOR=\"#ff0000\"><B><Big>$irc2web(channel)</Big></B></FONT></Br></FONT></FONT></center></Br>"
	puts $openhtml "<center><FONT SIZE=\"-1\" FACE=\"$irc2web(police)\">Mode du canal: \[[lindex [getchanmode $irc2web(channel)] 0]\]:</FONT></center></Br>"
	puts $openhtml "<center><FONT SIZE=\"-1\" FACE=\"$irc2web(police)\"><B><Big>Topic: '[i2w:convert [topic $irc2web(channel)]]'</Big></B></FONT></center></Br>"
	puts $openhtml "<B>Serveur</B>: [string range $server 0 [expr [string last ":" $server] - 1]]<BR>"
	puts $openhtml "<B>Usagers pr&eacute;sents</B>: [lrange [chanlist $irc2web(channel)] 0 end] \[[llength [chanlist $irc2web(channel)]]\]<BR>\n  <HR SIZE=\"1\">"
	close $openhtml
 
	if {![info exists irc2web(memoire)]} {
		set irc2web(memoire) [list]
	}

	### on re-ouvre le fichier pour y mettre tout le texte loggué
	set openhtml [open $irc2web(htmlfile) a]
	for {set i 0} {$i < [llength $irc2web(memoire)]} { incr i } {
		puts $openhtml "[lindex $irc2web(memoire) $i]<BR>"
	}
 
	puts $openhtml "</FONT>\n <center><img src=\"./modules/mirc/img/femelle.gif\" border=\"0\"></center><HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"Sans-serif\"><img src=\"./modules/mirc/img/startchat.gif\" border=\"0\"></br><I>Site <A HREF=\"http://www.recordgame.serveftp.net/\">RecorGame</A> par <A HREF=\"mailto:xxx@hotmail.com\">xxx</A></I></FONT></CENTER>\n"
	puts $openhtml "<CENTER><FONT SIZE=\"-1\" FACE=\"Sans-serif\"><I>Page web simultan&eacute;e du Canal #Recordgame </I></FONT></CENTER>\n</BODY>\n</HTML>"
	close $openhtml
 
	return 1
}

 
### si option 1 ou 2 choisi :
bind time - "59 23 * * *" time:i2w
 
proc time:i2w {minute hour day month year} {
	global irc2web
	if {$irc2web(log) == 2} {
		set desthtmlfile [string range $irc2web(htmlfile) 0 [expr [string length $irc2web(htmlfile)] - 5]][clock format [unixtime] -format "%d-%m-%Y"].html
		file rename -force $irc2web(htmlfile) $desthtmlfile
		putlog "#IRC2WEB# $irc2web(htmlfile) devient $desthtmlfile"
		set irc2web(memoire) [list]
	} elseif {$irc2web(log) == 1} {
		file delete $irc2web(htmlfile)
		set irc2web(memoire) [list]
	}
}

 
### Fonction servant à convertir le texte au format HTML
proc i2w:convert {arg} {
	regsub -all $arg "" arg
	regsub -all  $arg "" arg
	regsub -all $arg "" arg
	regsub -all $arg "" arg
	regsub -all $arg "" arg
	regsub -all & $arg "\\&amp;" arg
	regsub -all \" $arg "\\&quot;" arg
	regsub -all < $arg "\\&lt;" arg
	regsub -all > $arg "\\&gt;" arg
	regsub -all "  " $arg " \\&nbsp;" arg
	return [encoding convertfrom identity $arg]
}
 
 
proc action:i2w {nick host handle chan keyword arg} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] * $nick [i2w:convert $arg]"
		utimer 1 i2w:generate:html
	}
}
 
 
proc join:i2w {nick host handle chan} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick ($host) a rejoint $chan"
		i2w:generate:html
	}
}
 
 
proc kick:i2w {nick host handle chan knick arg} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $knick a été kické par $nick ([i2w:convert $arg])"
		utimer 1 i2w:generate:html
	}
}
 
 
proc mode:i2w {nick host handle chan mode victim} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick règle le mode du canal à: $mode $victim"
		utimer 1 i2w:generate:html
	}
}
 
 
proc nick:i2w {nick host handle chan newnick} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick es maintenant connu comme $newnick"
		utimer 1 i2w:generate:html
	}
}
 
 
proc part:i2w {nick host handle chan msg} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick ($host) a quitté $chan ($msg)"
		utimer 1 i2w:generate:html
	}
}
 
 
proc timestamp:i2w {} {
	global irc2web
	return [clock format [unixtime] -format $irc2web(timestamp)]
}
 
proc pubm:i2w {nick host handle chan arg} {
	global irc2web
	if {([string tolower $chan] == [string tolower $irc2web(channel)]) && ([encoding convertfrom identity [string index $arg 0]] != [encoding convertfrom identity $irc2web(symbole)])} {
		lappend irc2web(memoire) "[timestamp:i2w] &lt;$nick&gt;&nbsp;[i2w:convert $arg]"
		utimer 1 i2w:generate:html
	}
}
 
 
proc sign:i2w {nick host handle chan arg} {
	global irc2web
	if {[string tolower $chan] == [string tolower $irc2web(channel)]} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick ($host) a quitté IRC ([i2w:convert $arg])"
		utimer 1 i2w:generate:html
	}
}
 
 
proc topc:i2w {nick host handle chan topic} {
	global irc2web
	if {([string tolower $chan] == [string tolower $irc2web(channel)]) && ($nick != "*")} {
		lappend irc2web(memoire) "[timestamp:i2w] *** $nick change le topic pour '[i2w:convert $topic]'"
		utimer 1 i2w:generate:html
	}
}



merci de bien vouloir m'aider à comprendre cela...
Répondre Avertir


Messages dans ce sujet
IrcWeb... rendre visible aussi ce que le bot dit sur le canal (ircweb.tcl - par Wallom - 26/03/2009, 21:02

Atteindre :


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