Here's an equivalent of the
Perl E2 chatterbox XML ticker parser, a
script utilized to spy the
E2 chatterbox for
mIRC 5.82. To install it, paste the following code in the remote section of the mIRC Editor (alt+r).
Command line usage: /e2chatbox [REFRESH_TIME]
REFRESH_TIME is a value in seconds, the default value is 15.
Version history:
1.1: fixed < and > in the copied source, it should work fine now :)
;-- start cutting here --
; global aliases
alias e2chatbox {
if ($window(@e2)) {
echo $colour(info) -tea * /e2chatbox: e2 chatbox window is already opened :)
return
}
window -k @e2 $calc(($window(-3).w -640)/2) $calc(($window(-3).h -480)/2) 640 480
e2tbar
%e2.time = 0
e2refresh
.timere2 0 $iif($1 isnum,$1,15) e2refresh
}
; local aliases
alias -l e2tbar titlebar @e2 chatbox $1-
alias -l e2refresh {
.remove e2chat.xml
.sockclose e2chat
sockopen e2chat everything2.com 80
e2tbar (connecting to everything2.com:80)
}
alias -l e2parse {
var %i = 0, %z = 0, %r, %n | while (%i < $lines(e2chat.xml)) {
inc %i
%r = $read -l $+ %i e2chat.xml
if ((*<message?author=* iswm %r) && ($gettok(%r,-2,34) > %e2.time)) {
%e2.time = $gettok(%r,-2,34)
%n = $gettok(%r,-4,34)
%z = 1
continue
}
if (%z == 1) {
if (/me* iswm $e2fixlnk($remove(%r,</message>))) {
echo $colour(action) @e2 * %n $e2fixlnk($deltok($remove(%r,</message>),1,32))
}
else {
echo $colour(normal text) @e2 < $+ %n $+ > $e2fixlnk($remove(%r,</message>))
}
%z = 0
}
}
}
alias -l e2fixlnk {
var %i = 0, %r, %l | while (%i < $gettok($1,0,32)) {
inc %i
if ($gettok($1,%i,32) == <a) {
continue
}
elseif (href="*">* iswm $gettok($1,%i,32)) {
if (*</a>* !iswm $gettok($1,%i,32)) {
%l = $gettok($1,%i,32)
while (1) {
inc %i
if (*</a>* iswm $gettok($1,%i,32)) {
%l = %l $gettok($gettok($1,%i,32),1,60)
break
}
%l = %l $gettok($1,%i,32)
}
}
else {
%l = $gettok($1,%i,32)
}
%r = %r 12 $+ $gettok($gettok(%l,2,62),1,60) $+
}
else {
%r = %r $gettok($1,%i,32)
}
}
return %r
}
; events
on *:close:@e2:{
.sockclose e2chat
.timere2 off
}
on *:sockopen:e2chat:{
sockwrite -tn e2chat GET /?node=chatterbox+XML+ticker HTTP/1.0
sockwrite -tn e2chat Connection: Keep-Alive
sockwrite -tn e2chat Host: everything2.com
sockwrite -tn e2chat Accept: */* $+ $crlf $+ $crlf
e2tbar (everything2.com:80 contacted, waiting for reply)
}
on *:sockread:e2chat:{
var %r
if ($sockerr > 0) return
:i
sockread %r
if ($sockbr == 0) return
.write e2chat.xml %r
e2tbar ( $+ $file(e2chat.xml).size bytes received)
goto i
}
on *:sockclose:e2chat:{
e2parse
e2tbar
}
;-- end cutting here --