Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias deltime {
- ;;;;;YOU ONLY NEED TO INPUT A VALUE HERE IF YOU WANT TO DELETE HOSTS THAT
- ;;;;;HAVEN'T BEEN SEEN FOR A CERTAIN AMOUNT OF TIME.
- ;;;;;IF YOU DON'T WANT TO DELETE HOSTS LEAVE IT AS IT IS
- ;;;;;OTHERWISE INPUT BELOW A TIME VALUE IN THIS FORMAT: 1d (1 day) 1d12h (1 day and 12 hours and so on)
- ;;;;;SO IF YOU WANT 10 DAYS IT SHOULD LOOK LIKE THIS: var %time = 10d
- var %time = 10d
- ;;;;;DON'T EDIT AFTER THIS LINE
- return %time
- }
- ON *:START: {
- if (!$isdir($mircdirseen)) {
- mkdir seen
- }
- .timerseenscanold 0 86400 seenscanold $deltime
- hmake hostlist 10000
- if ($isfile($seendir(hostlist.hsh))) {
- hload hostlist $+($seendir(hostlist),.hsh)
- }
- var %x = $hget(hostlist,0).item
- while (%x) {
- var %y = $hget(hostlist,%x).item
- hmake $seenh(%y) 100
- if ($isfile($+($seendir($seenh(%y)),.hsh))) {
- hload $seenh(%y) $+($seendir($seenh(%y)),.hsh)
- }
- dec %x
- }
- }
- alias valtotim {
- var %s
- var %x = $1
- var %y = $left($replace(%x,s,~s-,m,~m-,h,~h-,d,~d-,w,~w-,y,~y-),-1)
- var %z = $numtok(%y,45)
- while (%z) {
- var %a = $gettok(%y,%z,45)
- var %b = $gettok(%a,1,126)
- var %c = $gettok(%a,2,126)
- if (%c == y) { var %t = 31536000 }
- if (%c == w) { var %t = 604800 }
- if (%c == w) { var %t = 604800 }
- if (%c == d) { var %t = 86400 }
- if (%c == h) { var %t = 3600 }
- if (%c == m) { var %t = 60 }
- if (%c == s) { var %t = %b }
- var %v = $calc(%t * %b)
- var %s = $calc(%s + %v)
- dec %z
- }
- return %s
- }
- alias seenscanold {
- var %e
- var %d = $1
- if (%d != nodel) {
- var %x = $hget(hostlist,0).item
- while (%x) {
- var %y = $hget(hostlist,%x).item
- var %z = $hget(hostlist,%x).data
- var %p = $calc($ctime - %z)
- var %s = $seenh(%y)
- var %q = $valtotim(%d)
- if (%p >= %q) {
- var %e = $calc(%e + 1)
- hdel hostlist %y
- hsave hostlist $seendir(hostlist.hsh)
- hfree %s
- .remove $seendir($+(%s,.hsh))
- }
- dec %x
- }
- echo -at (Auto Seen Scan) Found and deleted %e Hosts that haven't been seen for/for more than $1 (as set by user)
- }
- }
- alias par {
- if ($1) {
- return $+($chr(40),$1,$chr(41))
- }
- else {
- return $null
- }
- }
- alias evtowo {
- var %e = $1
- if ($istok(join part quit,%e,32)) {
- return $+(%e,ing)
- }
- else {
- if (%e == nick) {
- return changing nick
- }
- if (%e == text) {
- return msging
- }
- }
- }
- alias seendir {
- return $+($mircdirseen\,$1)
- }
- alias seenh {
- return $+(seen,$1)
- }
- alias seenicks {
- return $hget($1,nicks)
- }
- alias addhost {
- if (!$hget(hostlist,$1)) {
- hadd hostlist $1 $ctime
- hsave hostlist $+($seendir(hostlist),.hsh)
- }
- }
- alias fss {
- var %x = 1
- var %y = $hget(0)
- while (%x <= %y) {
- var %z = $hget(%x)
- if (seen* iswm %z) {
- var %a = %x
- }
- $iif(%a, break)
- inc %x
- }
- return %a
- }
- alias searchnick {
- var %n = $1
- var %d = $hget(0)
- var %f = $fss
- hmake tempsrch
- while (%d >= %f) {
- var %h = $hget(%d)
- var %nicks = $hget(%h,nicks)
- var %i = $istok(%nicks,%n,32)
- var %w = $wildtok(%nicks,%n,1,32)
- if (%i) || (%w) {
- var %time = $hget(%h,time)
- hadd tempsrch %h %time
- }
- dec %d
- }
- var %all = $hget(tempsrch,0).item
- var %res = $ducktop(tempsrch)
- hfree tempsrch
- if (!%res) { return NoRes }
- var %t = $gettok(%res,1,32)
- var %nicks = $gettok($hget(%t,nicks),1-5,32)
- var %event = $hget(%t,event)
- if (*kicke* iswm %event) {
- var %k2 = $hget(%t,k2)
- }
- var %time = $hget(%t,time)
- var %chan = $hget(%t,chan)
- var %net = $hget(%t,net)
- var %extra = $hget(%t,extra)
- var %nt = $numtok(%nicks,32)
- if (%event == nick) {
- var %tonick = $hget(%t,tonick)
- }
- var %t = $replace(%t,humslashhost,/)
- var %seenresult = %time %all °Seen° $replace($mid(%t,5,$len(%t)),humtwodots,:) $par($iif(%nt > 1, Last %nt nicks:) %nicks) $par(Last seen $iif(%event == kicker, kicking %k2 out of %chan, $iif(%event == kicked, being kicked out of %chan by %k2, $evtowo(%event) $iif(%event == nick, to %tonick) %chan)) on %net) $par($iif(%extra, $iif(%event == text, Msg:, Reason:) $iif($istok(quit part,%event,32) && $len(%extra) >= 100, $+($left(%extra,100),[...]), %extra))) $duration($calc($ctime - %time)) ago $+($chr(40),$asctime($ctime,dd/mm/yy HH:nn zz),$chr(41))
- return %seenresult
- }
- alias searchhost {
- var %h = $1
- var %r = $hget(hostlist,%h)
- if (!%r) {
- var %hf = $hfind(hostlist, %h, 0, w)
- if (!%hf) {
- return NoRes
- }
- hmake tempsrch 100
- while (%hf) {
- var %x = $hfind(hostlist, %h, %hf, w)
- var %y = $hget(hostlist,%x)
- hadd tempsrch %x %y
- dec %hf
- }
- var %all = $hget(tempsrch,0).item
- var %res = $ducktop(tempsrch)
- ;msg #test %res
- hfree tempsrch
- var %h = $gettok(%res,1,32)
- }
- var %t = $seenh(%h)
- var %nicks = $gettok($hget(%t,nicks),1-5,32)
- var %event = $hget(%t,event)
- if (*kicke* iswm %event) {
- var %k2 = $hget(%t,k2)
- }
- var %time = $hget(%t,time)
- var %chan = $hget(%t,chan)
- var %net = $hget(%t,net)
- var %extra = $hget(%t,extra)
- if (%event == nick) {
- var %tonick = $hget(%t,tonick)
- }
- var %nt = $numtok(%nicks,32)
- var %t = $replace(%t,humslashhost,/)
- var %seenresult = %time %all °Seen° $replace($mid(%t,5,$len(%t)),humtwodots,:) $par($iif(%nt > 1, Last %nt nicks:) %nicks) $par(Last seen $iif(%event == kicker, kicking %k2 out of %chan, $iif(%event == kicked, being kicked out of %chan by %k2, $evtowo(%event) $iif(%event == nick, to %tonick) %chan)) on %net) $par($iif(%extra, $iif(%event == text, Msg:, Reason:) $iif($istok(quit part,%event,32) && $len(%extra) >= 100, $+($left(%extra,100),[...])),%extra)) $duration($calc($ctime - %time)) ago $+($chr(40),$asctime($ctime,dd/mm/yy HH:nn zz),$chr(41))
- return %seenresult
- }
- alias findper {
- var %numbertotal = $1
- var %numberwant = $2
- var %perwant = $calc((%numberwant * 100) / %numbertotal)
- return $+(%perwant,%)
- }
- ON *:TEXT:*:#: {
- if ($1 == $+($chr(37),seens)) {
- msg $chan I have $hget(hostlist,0).item hosts in my mind!
- }
- if ($1 == $+($chr(37),aka)) {
- if (. isin $2) {
- var %h = $searchhost($replace($2,/,humslashhost),aka)
- msg $chan %h
- }
- else {
- var %n = $searchnick($replace($2,/,humslashhost),aka)
- msg $chan %n
- }
- }
- if ($1 == $+($chr(37),seen)) {
- var %aster = $iif($chr(42) iswm $2, 1, 0)
- var %ticks = $ticks
- var %orig = $2
- var %h = $searchhost($replace($2,/,humslashhost,:,humtwodots))
- var %n = $searchnick($replace($2,/,humslashhost,:,humtwodots))
- if (%h != NoRes) && (%n != NoRes) {
- var %ht = $gettok(%h,1,32)
- var %nt = $gettok(%n,1,32)
- var %bg = $iif(%ht > %nt, %h, %n)
- tokenize 32 %bg
- var %totalres = $2
- var %res = $3-
- msg $chan $iif(%aster && %totalres > 1, Most recent result) %res $calc(($ticks - %ticks) / 1000)
- if (%aster) && (%totalres > 1) { .timer 1 1 .notice $nick For %totalres more results !aka %orig }
- return
- }
- if (%h != NoRes) && (%n == NoRes) {
- tokenize 32 %h
- msg $chan $3-
- return
- }
- if (%h == NoRes) && (%n != NoRes) {
- tokenize 32 %n
- msg $chan $3-
- return
- }
- if (%h %n == NoRes NoRes) {
- msg $chan No results found, sorry!
- return
- }
- }
- var %site = $replace($site,/,humslashhost,:,humtwodots)
- addhost %site
- var %n = $nick
- var %s = $seenh(%site)
- if (!$hget(%s)) {
- hmake %s 100
- }
- if ($hget(%s,tonick)) {
- hdel %s tonick
- }
- hadd %s event $event
- hadd %s time $ctime
- hadd %s extra $+($left($1-,80),[...])
- hadd %s chan $chan
- hadd %s net $network
- var %x = $seenicks(%s)
- var %i = $istok(%x,%n,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- var %k = $hget(%s,knick)
- if (%k) { hdel %s knick }
- hsave %s $+($seendir(%s),.hsh)
- }
- ON *:JOIN:#: {
- var %site = $replace($site,/,humslashhost,:,humtwodots)
- addhost %site
- var %n = $nick
- var %s = $seenh(%site)
- if (!$hget(%s)) {
- hmake %s 100
- }
- if ($hget(%s,tonick)) {
- hdel %s tonick
- }
- hadd %s event $event
- hadd %s time $ctime
- hdel %s extra
- hadd %s chan $chan
- hadd %s net $network
- var %x = $seenicks(%s)
- var %i = $istok(%x,%n,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- var %k = $hget(%s,knick)
- if (%k) { hdel %s knick }
- hsave %s $+($seendir(%s),.hsh)
- }
- ON *:PART:#: {
- var %site = $replace($site,/,humslashhost,:,humtwodots)
- addhost %site
- var %n = $nick
- var %s = $seenh(%site)
- if (!$hget(%s)) {
- hmake %s 100
- }
- hadd %s event $event
- hadd %s time $ctime
- hadd %s extra $+($left($1-,80),[...])
- hadd %s chan $chan
- hadd %s net $network
- if ($hget(%s,tonick)) {
- hdel %s tonick
- }
- var %x = $seenicks(%s)
- var %i = $istok(%x,%n,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- var %k = $hget(%s,knick)
- if (%k) { hdel %s knick }
- hsave %s $+($seendir(%s),.hsh)
- }
- ON *:QUIT: {
- var %site = $replace($site,/,humslashhost,:,humtwodots)
- addhost %site
- var %n = $nick
- var %s = $seenh(%site)
- if (!$hget(%s)) {
- hmake %s 100
- }
- hadd %s event $event
- hadd %s time $ctime
- hadd %s extra $+($left($1-,80),[...])
- hdel %s chan $chan
- hadd %s net $network
- if ($hget(%s,tonick)) {
- hdel %s tonick
- }
- var %x = $seenicks(%s)
- var %i = $istok(%x,%n,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- var %k = $hget(%s,knick)
- if (%k) { hdel %s knick }
- hsave %s $+($seendir(%s),.hsh)
- }
- ON *:KICK:#: {
- var %a = $remove($replace($address($nick,2),/,humslashhost,:,humtwodots),*!*@)
- var %a2 = $remove($replace($address($knick,2),/,humslashhost,:,humtwodots),*!*@)
- addhost %a
- addhost %a2
- var %n = $nick
- var %n2 = $knick
- var %s = $seenh(%a)
- var %s2 = $seenh(%a2)
- if (!$hget(%s)) {
- hmake %s 100
- }
- if (!$hget(%s2)) {
- hmake %s2 100
- }
- if ($hget(%s,tonick)) {
- hdel %s tonick
- }
- if ($hget(%s2,tonick)) {
- hdel %s2 tonick
- }
- hadd %s event kicker
- hadd %s k2 $knick
- hadd %s2 event kicked
- hadd %s2 k2 $nick
- hadd %s time $ctime
- hadd %s2 time $ctime
- hadd %s extra $+($left($1-,80),[...])
- hadd %s2 extra $+($left($1-,80),[...])
- hadd %s chan $chan
- hadd %s2 chan $chan
- hadd %s net $network
- hadd %s2 net $network
- var %x = $seenicks(%s)
- var %x2 = $seenicks(%s2)
- var %i = $istok(%x,%n,32)
- var %i2 = $istok(%x2,%n2,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- hadd %s2 nicks $iif(%i2, $+(%n2,$chr(32),$remtok(%x2,%n2,1,32)), $+(%n2,$chr(32),%x2))
- hsave %s $+($seendir(%s),.hsh)
- hsave %s2 $+($seendir(%s2),.hsh)
- }
- ON *:NICK: {
- var %site = $replace($site,/,humslashhost,:,humtwodots)
- addhost %site
- var %n = $newnick
- var %s = $seenh(%site)
- if (!$hget(%s)) {
- hmake %s 100
- }
- hadd %s event $event
- hadd %s time $ctime
- hdel %s extra
- hdel %s chan
- hadd %s net $network
- hadd %s tonick %n
- var %x = $seenicks(%s)
- var %i = $istok(%x,%n,32)
- hadd %s nicks $iif(%i, $+(%n,$chr(32),$remtok(%x,%n,1,32)), $+(%n,$chr(32),%x))
- var %k = $hget(%s,knick)
- if (%k) { hdel %s knick }
- hsave %s $+($seendir(%s),.hsh)
- }
- alias ducktop {
- var %p = $1
- var %max = 0
- var %x = 1
- var %y = $hget(%p,0).item
- while (%x <= %y) {
- var %z = $gettok($hget(%p,%x).data,1,32)
- var %a = $hget(%p,%x).item
- if (%z > %max) {
- var %max = %z
- var %maxi = %a
- }
- inc %x
- }
- return %maxi %max
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement