Skip to content

Instantly share code, notes, and snippets.

@lrstanley
Last active February 28, 2021 00:27
Show Gist options
  • Save lrstanley/5264567 to your computer and use it in GitHub Desktop.
Save lrstanley/5264567 to your computer and use it in GitHub Desktop.
mIRC URL collector/GUI viewer
on 1:TEXT:*http*//*:#:{
var %url = $wildtok($1-, http://*, 1, 32)
if (%url == $NULL) { return }
if ($read(banurls.txt,wn,* $+ %url $+ *) != $NULL) { return }
if ($read(urls.txt,wn,* $+ %url $+ *) == $NULL) {
write urls.txt - $fulldate - $chan ( $+ $nick $+ ): $1-
}
}
alias urlrec {
if ($dialog(UR.Main)) dialog -v UR.Main
else dialog -md UR.Main UR.Main
}
menu channel {
-
.UrlRec:/urlrec
-
}
dialog -l UR.Main {
; General
title UrlRec
size -1 -1 345 235
option dbu
list 1,2 3 340 210
radio "View Recent", 2,2 215 37 8, group
radio "View All", 3, 2 225 37 8
button "Clear Logs", 4, 100 215 40 10
button "Copy Url", 5, 142 215 40 10
button "Refresh Now", 6, 184 215 40 10
check "Auto Refresh", 7, 184 225 40 10, push
edit "", 8, 226 215 110 10
text "0 urls",9,320 225 50 8
radio "View http only",11, 50 215 45 8, group
radio "View whole line",10, 50 225 45 8
button "Open Url", 12, 142 225 40 10
}
on 1:dialog:UR.Main:init:*:{
if (%UR.View1 == 1) did -c $dname 3
else did -c $dname 2
if (%UR.View2 == 1) did -c $dname 10
else did -c $dname 11
if (%UR.AutoRefresh == 1) {
did -c $dname 7
.timerUR.Refresh 0 15 UR.RefreshListCheck
}
did -o $dname 8 1 %UR.Filter
$UR.RefreshList()
}
on 1:dialog:UR.Main:close:*:{ if ($timer(UR.Refresh)) .timerUR.Refresh off }
on 1:dialog:UR.Main:sclick:2:{ $UR.RefreshList() }
on 1:dialog:UR.Main:sclick:3:{ $UR.RefreshList() }
on 1:dialog:UR.Main:sclick:10:{ $UR.RefreshList() }
on 1:dialog:UR.Main:sclick:11:{ $UR.RefreshList() }
on 1:dialog:UR.Main:sclick:4:{ if ($true == $?!="Do you really want to $crlf $+ clear the logs?") { .remove urls.txt | $UR.RefreshList() } }
alias -l UR.RefreshListCheck {
if (%UR.LastMod != $file(urls.txt).mtime) {
$UR.RefreshList()
}
}
alias -l UR.RefreshList {
set %UR.LastMod $file(urls.txt).mtime
set %UR.Filter $did(UR.Main,8)
var %UR.ReadFile = urls.txt
if ($len(%UR.Filter) > 0) {
filter -ffc urls.txt filter.txt * $+ %UR.Filter $+ *
%UR.ReadFile = filter.txt
}
if ($did(UR.Main,3).state == 1) set %UR.View1 1
else set %UR.View1 0
if ($did(UR.Main,10).state == 1) set %UR.View2 1
else set %UR.View2 0
did -r UR.Main 1
var %lines = $lines(%UR.ReadFile)
var %line
while (%lines > 0) {
%line = $read(%UR.ReadFile,nt,%lines)
if (((chan.net isin %line) || (chan.org isin %line) || (.imageshack. isin %line)) && ($calc($ctime($fulldate) - $ctime($gettok(%line,2-6,32))) > 7200)) {
write -dl $+ %lines %UR.ReadFile
}
else {
if ($did(UR.Main,2).state == 1) {
if ($calc($ctime($fulldate) - $ctime($gettok(%line,2-6,32))) <= 3600) {
if ($did(UR.Main,10).state == 1) did -a UR.Main 1 %line
else did -a UR.Main 1 $wildtok($gettok(%line,9-,32), http://*, 1, 32)
}
else %lines = 1
}
else {
if ($did(UR.Main,10).state == 1) did -a UR.Main 1 %line
else did -a UR.Main 1 $wildtok($gettok(%line,9-,32), http://*, 1, 32)
}
}
dec %lines
}
did -o UR.Main 9 1 $did(UR.Main,1).lines urls
}
on 1:dialog:UR.Main:dclick:1:{
var %url = $wildtok($gettok($did(1).seltext,1-,32), http://*, 1, 32)
if (%url != $NULL) url %url
}
on 1:dialog:UR.Main:sclick:5:{
var %url = $wildtok($gettok($did(1).seltext,1-,32), http://*, 1, 32)
if (%url != $NULL) clipboard %url
}
on 1:dialog:UR.Main:sclick:6:{ $UR.RefreshList() }
on 1:dialog:UR.Main:sclick:7:{
if ($did(7).state == 1) .timerUR.Refresh 0 15 UR.RefreshListCheck
else .timerUR.Refresh off
set %UR.AutoRefresh $did(7).state
}
on 1:dialog:UR.Main:edit:8:{
if ($did(7).state == 1) {
$UR.RefreshList()
if ($did(1).lines > 0) did -c $dname 1 1
did -t $dname 12
}
else did -t $dname 6
}
on 1:dialog:UR.Main:sclick:12:{
var %url = $wildtok($gettok($did(1).seltext,1-,32), http://*, 1, 32)
if (%url != $NULL) url %url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment