Downloading File
Filename: Protozoa v1.0 - Barebone Connection
; Protozoa v1.0
; Barebone Connection
; Creator by Jaditz aka Racerx
; For Sparkpea Chat !!
; /connect, it will connect to spcn finds server
; /j test room, i.e without the %#
; /email, it will set your spcn e-mail & pw, so you can join a room
; /resock, it will refresh your connection while in a room
; be sure to give me credit while adding your coding to my connection
; making my connection into your own
alias j { join $iif($left($roomname($replace($replace($1-,$chr(44),$chr(92) $+ $chr(99)),$chr(32),$chr(92) $+ $chr(98))),2) != $chr(37) $+ $chr(35),$chr(37) $+ $chr(35)) $+ $replace($1-,$chr(44),$chr(92) $+ $chr(99),$chr(32),$chr(92) $+ $chr(98)) }
alias email {
while (!%1) var %1 = $?"E-mail and password?:"
$iif(%1,set %user %1,/email)
$iif(%user,echo -a * Email $+(",%user,") is now set.)
}
alias connect {
if (!%user) { /email }
socklisten start $port
server 127.0.0.1 $sock(start).port
}
alias resock {
echo -a * $+($stime,$chr(32),resocking #)
sockwrite -n # quit
sockopen $+(finds.,#) finds.sparkpea.net 7000
}
alias achr return $chr(37) $+ $chr(35) $+ $remove($replace($1-,$chr(32),\b,$chr(44),\c),$chr(37),$chr(35))
on *:socklisten:start:{
sockaccept local
echo -a * local socket is now open, you can join rooms..
sockclose start
}
on *:sockopen:finds.*:{
sockwrite -n $+($sockname nick $mnick,$crlf,user x x x $+(:,$mnick))
sockwrite -n $sockname FINDS $gettok($sockname,2-,46)
}
on *:sockread:finds.*:{
var %f = ""
sockread -f %f
tokenize 32 %f
if ($findtok(613 702,$2,32)) {
$+($iif($2 = 613,sockopen $gettok($sockname,2-,46) $mid($4,2) 6667),$iif($2 = 702,echo -a * That Channel Doesn't Exist))
}
}
on *:sockread:local:{
var %l = ""
sockread -f %l
tokenize 32 %l
if ($findtok(join,$1,32)) {
var %c = $achr($2)
$iif(!$sock(%c),sockopen $+(finds.,%c) finds.sparkpea.net 7000,sockwrite -n %c join %c)
echo -a * finding channel %c
}
elseif ($sock($2)) sockwrite -n $2 $1-
}
on *:sockopen:?#*:{
sockwrite -n $sockname nick $mnick $lf user x x x $+(:,$mnick) $lf nickserv identify %user $lf join $sockname
sockclose $+(finds.,$sockname)
}
on *:sockclose:?#*:{ sockopen $+(finds.,$sockname) finds.sparkpea.net 7000 }
on *:sockread:?#*:{
var %chan
sockread -f %chan
tokenize 32 %chan
if ($findtok(ping,$1,32)) {
sockwrite -n $sockname pong $2
}
if ($findtok(353 352,$2,32)) { sockwrite -n local $1- | return }
else {
sockwrite -n local $1-
}
return
}


