Advertisement
westor

Seen for TRK v1.1

Nov 19th, 2020 (edited)
2,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.60 KB | None | 0 0
  1. ; ------- Settings --------
  2.  
  3. alias seen_dir { return $mircdir $+ seen } ; = 'seen' is the folder database under '$mircdir' path e.g: //run $mircdir
  4. alias seen_excepts { return network1~nickname1~#channel1 network2~nickname2~#channel2 } ; = format is NETWORK~NICKAME~#CHANNEL so e.g ChatHUB~westor~#mSL
  5.  
  6. ; ------- Settings --------
  7.  
  8. ON *:START: {
  9.   if (!$isdir($seen_dir)) { mkdir $qt($seen_dir) }
  10. }
  11.  
  12. ON *:TEXT:*:#: {
  13.   tokenize 32 $strip($1-)
  14.  
  15.   var %nc = $+($network,~,$nick,~,$chan)
  16.  
  17.   if (!$istok($seen_excepts,%nc,32)) {
  18.     seen_clear $network $nick $chan
  19.  
  20.     seen_write $network $nick $chan event $event
  21.     seen_write $network $nick $chan time $ctime
  22.     seen_write $network $nick $chan host $site
  23.     seen_write $network $nick $chan message $iif($1-,$v1,0)
  24.   }
  25.  
  26.   if ($1 == !seen) {
  27.     if (!$2) {
  28.       var %t = $findfile($seen_dir,*,0)
  29.  
  30.       msg $chan ( $+ $nick $+ ): There $iif(%t == 1,is $bold(%t) total seen record,are $bold(%t) total seen records) in my database. Please define your search!
  31.  
  32.       return
  33.     }
  34.  
  35.     if ($2 == $me) || ($2 == $nick) { msg $chan ( $+ $nick $+ ): Incorrect target! | return }
  36.     if ($chr(42) isin $2) {    
  37.       var %t = $findfile($seen_dir,$2-,0)
  38.  
  39.       msg $chan ( $+ $nick $+ ): There $iif(%t == 1,is $bold(%t) matching record,are $bold(%t) matching records) in my database.
  40.  
  41.       if (%t < 20) {
  42.         var %i = 1
  43.         while (%i <= %t) { var %m = $mid($nopath($findfile($seen_dir,$2-,%i)),0,-4) | var %tot = $addtok(%tot,%m,32) | inc %i }
  44.  
  45.         if (%tot) { msg $chan ( $+ $nick $+ ): %tot }
  46.       }
  47.  
  48.       return
  49.     }
  50.  
  51.     var %a = $seen_read($network,$2,$chan,event)
  52.  
  53.     if (!%a) { msg $chan ( $+ $nick $+ ): Sorry! I haven't seen $bold($2) on $bold($chan) yet! | return }
  54.  
  55.     if (%a == join) {
  56.       var %o = $seen_read($network,$2,$chan,time)
  57.       var %h = $seen_read($network,$2,$chan,host)
  58.  
  59.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) joined on $bold($chan) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ )
  60.     }
  61.  
  62.     if (%a == part) {
  63.       var %o = $seen_read($network,$2,$chan,time)
  64.       var %h = $seen_read($network,$2,$chan,host)
  65.       var %m = $seen_read($network,$2,$chan,message)
  66.  
  67.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) parted from $bold($chan) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ ) $iif(%m,with message $bold(%m))
  68.     }
  69.  
  70.     if (%a == text) || (%a == action) || (%a == notice) {
  71.       var %h = $seen_read($network,$2,$chan,host)
  72.       var %o = $seen_read($network,$2,$chan,time)
  73.       var %m = $seen_read($network,$2,$chan,message)
  74.  
  75.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) said something on $bold($chan) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ ) $iif(%m,with message $bold(%m))
  76.     }
  77.  
  78.     if (%a == kick) {
  79.       var %o = $seen_read($network,$2,$chan,time)
  80.       var %h = $seen_read($network,$2,$chan,host)
  81.       var %b = $seen_read($network,$2,$chan,by)
  82.       var %m = $seen_read($network,$2,$chan,message)
  83.  
  84.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) kicked from $bold($chan) by $bold(%b) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ ) $iif(%m,with message $bold(%m))
  85.     }
  86.  
  87.     if (%a == quit) {
  88.       var %h = $seen_read($network,$2,$chan,host)
  89.       var %o = $seen_read($network,$2,$chan,time)
  90.       var %m = $seen_read($network,$2,$chan,message)
  91.  
  92.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) quits from $bold($chan) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ ) $iif(%m,with message $bold(%m))
  93.     }
  94.  
  95.     if (%a == nick) {
  96.       var %h = $seen_read($network,$2,$chan,host)
  97.       var %o = $seen_read($network,$2,$chan,time)
  98.       var %n = $seen_read($network,$2,$chan,newnick)
  99.  
  100.       msg $chan ( $+ $nick $+ ): $underline($2) $+([,$bold(%h),]) changed nick on $bold($chan) to $bold(%n) at $bold($asctime(%o)) ( $+ $italic($duration($calc($ctime - %o))) ago $+ )
  101.     }
  102.  
  103.   }
  104. }
  105.  
  106. ON !*:JOIN:#: {
  107.   var %nc = $+($network,~,$nick,~,$chan)
  108.  
  109.   if ($istok($seen_excepts,%nc,32)) { return }
  110.  
  111.   seen_clear $network $nick $chan
  112.  
  113.   seen_write $network $nick $chan event $event
  114.   seen_write $network $nick $chan time $ctime
  115.   seen_write $network $nick $chan host $site
  116. }
  117.  
  118. ON !*:PART:#: {
  119.   var %nc = $+($network,~,$nick,~,$chan)
  120.  
  121.   if ($istok($seen_excepts,%nc,32)) { return }
  122.  
  123.   tokenize 32 $strip($1-)
  124.  
  125.   seen_clear $network $nick $chan
  126.  
  127.   seen_write $network $nick $chan event $event
  128.   seen_write $network $nick $chan time $ctime
  129.   seen_write $network $nick $chan host $site
  130.   seen_write $network $nick $chan message $iif($1-,$v1,0)
  131. }
  132.  
  133. ON !*:KICK:#: {
  134.   var %nc = $+($network,~,$nick,~,$chan)
  135.  
  136.   if ($istok($seen_excepts,%nc,32)) { return }
  137.  
  138.   tokenize 32 $strip($1-)
  139.  
  140.   seen_clear $network $knick $chan
  141.  
  142.   seen_write $network $knick $chan event $event
  143.   seen_write $network $knick $chan time $ctime
  144.   seen_write $network $knick $chan host $site
  145.   seen_write $network $knick $chan by $nick
  146.   seen_write $network $knick $chan message $iif($1-,$v1,0)
  147. }
  148.  
  149. ON !*:ACTION:*:#: {
  150.   var %nc = $+($network,~,$nick,~,$chan)
  151.  
  152.   if ($istok($seen_excepts,%nc,32)) { return }
  153.  
  154.   tokenize 32 $strip($1-)
  155.  
  156.   seen_clear $network $nick $chan
  157.  
  158.   seen_write $network $nick $chan event $event
  159.   seen_write $network $nick $chan time $ctime
  160.   seen_write $network $nick $chan host $site
  161.   seen_write $network $nick $chan message $iif($1-,$v1,0)
  162. }
  163.  
  164. ON !*:NOTICE:*:#: {
  165.   var %nc = $+($network,~,$nick,~,$chan)
  166.  
  167.   if ($istok($seen_excepts,%nc,32)) { return }
  168.  
  169.   tokenize 32 $strip($1-)
  170.  
  171.   seen_clear $network $nick $chan
  172.  
  173.   seen_write $network $nick $chan event $event
  174.   seen_write $network $nick $chan time $ctime
  175.   seen_write $network $nick $chan host $site
  176.   seen_write $network $nick $chan message $iif($1-,$v1,0)
  177. }
  178.  
  179. ON !*:QUIT: {
  180.   tokenize 32 $strip($1-)
  181.  
  182.   var %t = $comchan($nick,0)
  183.   var %i = 1
  184.  
  185.   while (%i <= %t) {
  186.     var %c = $comchan($nick,%i)
  187.     var %nc = $+($network,~,$nick,~,%c)
  188.  
  189.     if (%c) && (!$istok($seen_excepts,%nc,32)) {
  190.       seen_clear $network $nick %c
  191.  
  192.       seen_write $network $nick %c event $event
  193.       seen_write $network $nick %c time $ctime
  194.       seen_write $network $nick %c host $site
  195.       seen_write $network $nick %c message $iif($1-,$v1,0)
  196.     }
  197.  
  198.     inc %i
  199.   }
  200. }
  201.  
  202. ON !*:NICK: {
  203.   var %t = $comchan($newnick,0)
  204.   var %i = 1
  205.  
  206.   while (%i <= %t) {
  207.     var %c = $comchan($newnick,%i)
  208.     var %nc1 = $+($network,~,$newnick,~,%c)
  209.     var %nc2 = $+($network,~,$nick,~,%c)
  210.  
  211.     if (%c) && (!$istok($seen_excepts,%nc1,32)) && (!$istok($seen_excepts,%nc2,32)) {
  212.       seen_clear $network $nick %c
  213.  
  214.       seen_write $network $nick %c event $event
  215.       seen_write $network $nick %c time $ctime
  216.       seen_write $network $nick %c host $site
  217.       seen_write $network $nick %c newnick $newnick
  218.     }
  219.  
  220.     inc %i
  221.   }
  222.  
  223. }
  224.  
  225. alias -l seen_clear {
  226.   ; /seen_clear <network> <nickname> <#channel>
  227.  
  228.   if (!$1) && (!$2) && (!$3) { return }
  229.  
  230.   var %f = $seen_dir $+ \ $+ $mkfn($2) $+ .ini
  231.   var %nc = $+($1,~,$3)
  232.   var %r = $ini(%f,%nc)
  233.  
  234.   if (%r) { remini $qt(%f) %nc }
  235.  
  236.   var %l = $lines(%f)
  237.  
  238.   if (!%l) { .remove $qt(%f) }
  239. }
  240.  
  241. alias -l seen_write {
  242.   ; /seen_write <network> <nickname> <#channel> <item> <value>
  243.  
  244.   if (!$1) && (!$2) && (!$3) && (!$4) && (!$5) { return }
  245.  
  246.   if (!$isdir($seen_dir)) { mkdir $qt($seen_dir) }
  247.  
  248.   var %f = $seen_dir $+ \ $+ $mkfn($2) $+ .ini
  249.   var %nc = $+($1,~,$3)
  250.  
  251.   writeini -n $qt(%f) %nc $4 $5-
  252. }
  253.  
  254. alias -l seen_read {
  255.   ; $seen_read(<network>,<nickname>,<#channel>,<item>)
  256.  
  257.   if (!$1) && (!$2) && (!$3) && (!$4) { return }
  258.  
  259.   var %f = $seen_dir $+ \ $+ $mkfn($2) $+ .ini
  260.   var %nc = $+($1,~,$3)
  261.   var %r = $readini(%f,n,%nc,$4)
  262.  
  263.   return $iif(%r,$v1,0)
  264. }
  265.  
  266. alias -l bold { return $+($chr(2),$1-,$chr(2)) }
  267. alias -l underline { return $+($chr(31),$1-,$chr(31)) }
  268. alias -l italic { return $+($chr(29),$1-,$chr(29)) }
  269. alias -l reverse { return $+($chr(22),$1-,$chr(22)) }
  270.  
  271. alias -l col {
  272.   ; $col(N1-N2,TEXT)
  273.  
  274.   if ($1 == $null) { return }
  275.  
  276.   var %n0 = $gettok($1,1-2,45)
  277.   var %n1 = $gettok(%n0,1,45)
  278.   var %n2 = $gettok(%n0,2,45)
  279.  
  280.   if (%n1 !== $null) && (%n1 isnum 0-9) { var %n1 = 0 $+ %n1 }
  281.   if (%n2 !== $null) && (%n2 isnum 0-9) { var %n2 = 0 $+ %n2 }
  282.  
  283.   if (%n1 !== $null) && (%n1 !isnum 0-98) { return }
  284.   if (%n2 !== $null) && (%n2 !isnum 0-98) { return }
  285.  
  286.   if (%n1 !== $null) && (%n2 == $null) { var %t = %n1 }
  287.   if (%n1 !== $null) && (%n2 !== $null) { var %t = $+(%n1,$chr(44),%n2)) }
  288.  
  289.   return $+($chr(3),%t,$2-,$chr(3))
  290. }
  291.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement