;======================================================================
;Alias usada para abrir a socket
;Sintaxe: /record
;======================================================================
alias record {
sockclose record
sockopen record www.record.pt 80
}
;======================================================================
;Eventos relacionados com a socket usada (Abertura e Leitura)
;======================================================================
on *:sockopen:record:{
if ($sockerr > 0) { return }
sockwrite -n $sockname GET /ultimas.asp?current=40 HTTP/1.1
sockwrite -n $sockname Host: www.record.pt
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on *:sockread:record:{
if ($sockerr > 0) { return }
var %html
sockread %html
if (*<a class="v9b_red">* iswm %html) && (*href="noticia.asp?id* iswm %html) && (*class="v9_black">* iswm %html) {
var %title = $remove($gettok(%html,2,32),-,</a,class="v9b_red">)
var %new = $remove($gettok(%html,4-,62),</a>,</td)
var %link = www.record.pt/ $+ $remove($gettok(%html,3,62),<a href=,;idCanal=19",class="v9_black",")
if (%link != %record.last1) {
set %record.last1 %link
set %record.last2 ( $+ %title $+ ) %new ( $+ %link $+ )
msg %record.chan %record.last2
sockclose record
}
else { sockclose record }
}
}
;======================================================================
;Evento que mostra no canal a última noticia do site
;Sintaxe: .record
;======================================================================
on *:text:.record:%record.chan:{
if (%record.last2) {
msg $chan %record.last2
}
else {
msg $chan info: Não há noticia para ser mostrada.
}
}
;======================================================================
;Popups que definem o Canal e Tempo de Repetição
;======================================================================
menu channel {
Noticias Record
.Canal ( $+ %record.chan $+ ):{
var %canal = $?="Introduza o Canal:"
if (%canal) {
set %record.chan %canal
}
}
.-
.Temporizador
..Tempo ( $+ %record.timer $+ ):{
var %tempo = $?="Introduza o tempo (minutos):"
if (%tempo) {
set %record.timer %tempo
}
}
..-
..$iif($timer(RECORD),$style(2)) Ligar:{
.timerRECORD 0 $calc(%record.timer * 60) record
echo -a Timer Activado.
}
..$iif(!$timer(RECORD),$style(2)) Parar:{
.timerRECORD off
echo -a Timers Parados.
}
.-
.Limpar:/unset %record.last*
}