alias quote {
if (!$isid) {
writeini quotes.ini quotes $1-
if ($dialog(qlist)) {
if ($didwm(qlist,1,* $+ $1 $+ *)) { did -d qlist 1 $ifmatch }
did -a qlist 1 $1 $chr(9) $2-
}
}
elseif ($isid) { return $readini(quotes.ini,quotes,$1-) }
}
alias qlist {
if (!$dialog(qlist)) { dialog -m qlist qlist }
var %i 1
did -r qlist 1
while ($ini(quotes.ini,quotes,%i)) {
did -a qlist 1 $ifmatch $chr(9) $readini(quotes.ini,quotes,$ifmatch)
inc %i
}
}
alias qbot {
if (!$1) {
sockopen qbot $server 6667
if ($sock(qbot)) { return }
}
elseif ($1 == join) { sockwrite -n qbot join $chan }
}
dialog qlist {
title "quote list[/qlist]"
size -1 -1 160 99
option dbu
list 1, 0 1 160 99, size
}
on *:dialog:qlist:*:*:{
if ($devent == init) {
mdx SetMircVersion $version
mdx MarkDialog $dname
mdx SetControlMDX $dname 1 ListView report rowselect single infotip > $views
did -i $dname 1 1 headerdims 100 216
did -i $dname 1 1 headertext nick $chr(9) quote
qlist
}
}
on *:sockopen:qbot:{
if ($sockerr) { return }
sockwrite -n $sockname nick quotebot
sockwrite -n $sockname user quotebot . . quotebot
}
on *:sockread:qbot:{
if ($sockerr) { return }
var %quote
sockread %quote
tokenize 32 %quote
if ($1 == ping) { sockwrite -n $sockname pong $right($2,-1) }
elseif ($2 == privmsg) {
if ($right($4,-1) == !quote) {
if ($5-6 == add $right($gettok($1,1,33),-1)) { quote $right($gettok($1,1,33),-1) $7- }
elseif ($5-6 == del $right($gettok($1,1,33),-1)) {
if ($quote($right($gettok($1,1,33),-1))) {
if ($dialog(qlist)) && ($didwm(qlist,1,* $+ $right($gettok($1,1,33),-1) $+ *)) { did -d qlist 1 $didwm(qlist,1,* $+ $right($gettok($1,1,33),-1) $+ *) }
remini " $+ $scriptdirquotes.ini $+ " quotes $right($gettok($1,1,33),-1)
}
}
elseif ($5 != add) && ($5 != del) {
if ($quote($5)) { sockwrite -n $sockname privmsg $3 : $5 $+ 's quote: $ifmatch }
}
}
elseif ($right($4,-1) == !commands) {
sockwrite -n $sockname privmsg $3 : !quote add <yournick> <quote> - to add a quote.
sockwrite -n $sockname privmsg $3 : !quote del <yournick> - to delete your quote.
sockwrite -n $sockname privmsg $3 : !quote <nick> - to view a quote.
}
}
elseif ($2 == join) {
if ($quote($right($gettok($1,1,33),-1))) { sockwrite -n $sockname privmsg $right($3,-1) : $right($gettok($1,1,33),-1) $+ 's quote: $ifmatch }
}
}