rendered paste bodydialog sockchat {
title "Unborns Socket Chat"
size -1 -1 234 63
option dbu
list 1, 1 1 171 50, size
list 2, 173 1 60 50, size
edit "", 3, 1 52 207 10
button "Send", 4, 210 52 23 10, default
}
alias SockChat { dialog -m sockchat sockchat }
on *:DIALOG:sockchat:init:0:{
sockopen SockChat 203.59.87.88 45
did -a sockchat 1 Connecting to Unborns Socket Chat...
.timercon 1 5 did -a sockchat 1 Failed to Connect.
}
on *:SOCKREAD:sockchat:{
var %sockchatread
sockread %sockchatread
tokenize 32 %sockchatread
if ($1 == CONNECTED) {
did -ac sockchat 1 Connected.
did -a sockchat 2 $2
.timercon off
}
elseif ($1 == TEXT) {
did -ac sockchat 1 ( $+ $2 $+ ) $3-
}
elseif ($1 == CONNECT) {
did -ac sockchat 1 $2 has Connected to Unborns Socket Chat.
did -a sockchat 2 $2
}
elseif ($1 == QUIT) {
did -ac sockchat 1 $2 has Disconnected from Unborns Socket Chat.
did -r sockchat 2 $didwm(sockchat,2,$2)
}
elseif ($1 == USER) {
did -a sockchat 2 $2
}
}
on *:DIALOG:sockchat:sclick:4:{
sockwrite -n sockchat $did(3).text
did -r sockchat 3
}
on *:DIALOG:sockchat:close:0:{
sockclose SockChat
}