;Simulation de canal :o
;The channel simulation
;by G-FACTION
alias simulate {
if ($2) {
set %simulation $true
set %simulation.chan $1
;Recherche des informations avant la connexion en local
set %names_lists 0
set %who 0
set %simulation.port $2
mode $1
who $1
names $1
topic $1
}
}
alias simulation {
if ($1 == close) {
set %simulation $false
sockclose chan_simulation
sockclose %tsn
unset %who*
unset %names*
unset %simulation*
}
}
raw 324:*: {
set %simulation.modes $3-
}
raw 329:*: {
set %simulation.time $3-
}
raw 352:*: {
inc %who
set %who $+ %who $2-
}
raw 353:*: {
inc %names_lists
set %names $+ %names_lists $4-
}
raw 332:*: {
set %simulation.topic $3-
halt
}
raw 333:*: {
set %simulation.user $3
set %simulation.time $gettok($1-,4-,32)
if (%simulation) {
set %simulation $false
socklisten chan_simulation %simulation.port
server -m 127.0.0.1 %simulation.port
}
halt
}
raw 403:*: {
if (%simulation) {
set %simulation $false
echo -a 2The channel12 %simulation.chan 2cannot be simulated, it doesn't exists
halt
}
}
on *:socklisten:chan_simulation: {
set %tsn $sockname $+ $ctime
sockaccept %tsn
set %s %simulation.chan $+ .channel_simulation
set %c %simulation.chan
set %zz channel_simulation!user@channel_simulation
}
on 1:sockread:chan_simulation*: {
sockread %sr
tokenize 32 %sr
if ($1 == NICK) {
set %n $2
set %f %n $+ !user@channel_simulation
}
elseif ($1 == USER) {
sockwrite -tn $sockname : $+ %s NOTICE AUTH :*** You are connecting to Channel Simulation 1.0
sockwrite -tn $sockname : $+ %s NOTICE AUTH :*** This program was made by G-FACTION
sockwrite -tn $sockname : $+ %s NOTICE AUTH :*** Let's simulate %simulation.chan !
sockwrite -tn $sockname : $+ %s 001 %n :Welcome to the chan_simulation IRC Network %f
sockwrite -tn $sockname : $+ %f JOIN : $+ %c
giveinfos $sockname
}
}
alias giveinfos {
if ($1) {
sockwrite -tn $1 : $+ %s 332 %n %c : $+ %simulation.topic
sockwrite -tn $1 : $+ %s 333 %n %c %simulation.user %simulation.time
var %i 1
while (%i <= %names_lists) {
sockwrite -tn $1 : $+ %s 353 %n = %c : $+ %names [ $+ [ %names_lists ] ]
inc %i
}
sockwrite -tn $1 : $+ %s 366 %n %c :End of /NAMES list.
var %o 1
while (%i <= %who) {
sockwrite -tn $1 : $+ %s 352 %n %who [ $+ [ %i ] ]
inc %i
}
sockwrite -tn $1 : $+ %s 315 %n %c :End of /WHO list.
sockwrite -tn $1 : $+ %s 324 %n %c %simulation.modes
sockwrite -tn $1 : $+ %s 329 %n %c %simulation.time
sockwrite -tn $1 : $+ %zz PRIVMSG %c :Channel simulation finished
sockwrite -tn $1 : $+ %zz PRIVMSG %c :This was made by G-FACTION (2qdeme@yahoo.fr)
sockwrite -tn $1 : $+ %zz PRIVMSG %c :To close the channel simulation, type /simulation close
sockwrite -tn $1 : $+ %zz PRIVMSG %c :Hope you enjoyed ;)
}
}