SHARE
TWEET

Query manager

Seb Dec 21st, 2011 (edited) 225 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Query manager found on http://www.hawkee.com/snippet/4228/ (instructions on the link)
  2. #I just modified the reply with colors for someone and posted it here.
  3.  
  4. dialog qmd {
  5.   title "Absent's Query Manager"
  6.   size -1 -1 324 144
  7.   option dbu
  8.   list 1, 8 25 82 109, size
  9.   check "Enable Query manager", 2, 9 8 72 10
  10.   box "Configuration panel", 3, 176 33 141 95
  11.   list 4, 91 25 82 109, size
  12.   edit "", 5, 184 53 125 12, read
  13.   edit "", 6, 185 81 125 12, read
  14.   edit "", 7, 185 110 125 12, read
  15.   combo 8, 180 8 60 50, sort drop
  16.   combo 9, 251 8 60 50, sort drop
  17.   box "Blocklist", 10, 247 0 70 31
  18.   box "Friendlist", 11, 176 0 70 31
  19.   text "First Nick/Hostmask:", 12, 185 43 51 8
  20.   text "Last Nick/Hostmask:", 13, 185 71 51 8
  21.   text "Date/Time of Query:", 14, 186 99 51 8
  22.   button "-", 16, 189 20 9 9
  23.   button "+", 17, 250 20 9 9
  24.   button "Accept", 18, 87 11 20 10
  25.   box "Navigation panel", 19, 84 0 90 24
  26.   button "Deny", 20, 108 11 20 10
  27.   button "Block", 21, 129 11 20 10
  28.   button "Friend", 22, 150 11 20 10
  29.   button "Clear", 23, 270 20 19 9
  30.   button "+", 24, 179 20 9 9
  31.   button "Clear", 25, 199 20 19 9
  32.   button "-", 26, 260 20 9 9
  33.   button "Close", 15, 273 130 37 12, ok cancel
  34.   button "Logs", 27, 228 130 37 12
  35.   button "Clearlog", 28, 183 130 37 12
  36. }
  37. alias qmd { dialog $iif($dialog(qmd),-v,-md) qmd qmd }
  38. menu * {
  39.   .Query Manager:qmd
  40. }
  41. on *:dialog:qmd:init:0:{
  42.   if (%qmd) { did -c qmd 2 }
  43.   else { did -u qmd 2 }
  44.   did -b qmd 18,20-22
  45.   if (!$read(qmd.friends.txt)) {
  46.     did -b qmd 16,25
  47.     did -ra qmd 8 No users found
  48.   }
  49.   elseif ($read(qmd.friends.txt)) {
  50.     var %f 1
  51.     while (%f <= $lines(qmd.friends.txt)) {
  52.       did -a qmd 8 $read(qmd.friends.txt,%f))
  53.       inc %f
  54.     }
  55.   }
  56.   if (!$read(qmd.blocked.txt)) {
  57.     did -b qmd 23,26
  58.     did -ra qmd 9 No users found
  59.   }
  60.   elseif ($read(qmd.blocked.txt)) {
  61.     var %b 1
  62.     while (%b <= $lines(qmd.blocked.txt)) {
  63.       did -a qmd 9 $read(qmd.blocked.txt,%b))
  64.       inc %b
  65.     }
  66.   }
  67. }
  68. on *:dialog:qmd:sclick:1:{
  69.   if ($did(qmd,18).sel) != 0) && ($did(qmd,18).seltext) != $null) {
  70.     did -e qmd 18,20-22
  71.   }
  72. }
  73. on *:dialog:qmd:sclick:*:{
  74.   if ($did == 2) {
  75.     if (%qmd) { unset %qmd | did -u qmd 2 }
  76.     else { set %qmd on | did -c qmd 2 }
  77.   }
  78.   if ($did == 16) {
  79.     if (!$did(8).seltext) {
  80.       noop $input(Please select a nick to unblock!,uwo,Absent's Query Manager)
  81.       dialog -v qmd qmd
  82.     }
  83.     elseif (!$did(8).seltext) { halt }
  84.     var %dfriends $read(qmd.friends.txt,w,$did(8).seltext)
  85.     if (%dfriends != $did(8).seltext) { halt }
  86.     write -dl [ $+ [ $readn ] ] qmd.friends.txt
  87.     did -d qmd 8 $did(8).seltext
  88.     noop $input($did(8).seltext has been removed from the friendlist,uwo,Absent's Query Manager)
  89.     did -r qmd 8
  90.     dialog -v qmd qmd
  91.     if (!$read(qmd.friends.txt)) {
  92.       did -ra qmd 8 No users found
  93.       did -b qmd 16,25
  94.     }
  95.     else {
  96.       var %x = 1
  97.       while ( %x <= $lines(qmd.friends.txt)) {
  98.         did -a qmd 8 $read(qmd.friends.txt,%x)
  99.         inc %x
  100.       }
  101.     }
  102.   }
  103.   if ($did == 17) {
  104.     var %blockadd = $?="Please fill in the nickname you are trying to add"
  105.     if (!%blockadd) { noop $input(Please fill in a valid nickname!,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
  106.     if ($read(qmd.blocked.txt,w,%blockadd)) { noop $input(%blockadd is already known on the blocklist,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
  107.     else {
  108.       write qmd.blocked.txt %blockadd
  109.       noop $input(%blockadd has been added to the blocklist!,uwo,Absent's Query Manager)
  110.       did -e qmd 23,26
  111.       did -r qmd 9
  112.       dialog -v qmd qmd
  113.       var %b 1
  114.       while (%b <= $lines(qmd.blocked.txt)) {
  115.         did -a qmd 9 $read(qmd.blocked.txt,%b)
  116.         inc %b
  117.       }
  118.     }
  119.   }
  120.   if ($did == 18) { did -b qmd 18,20-22 | var %acceptdel $did(qmd,1).sel | msg $did(qmd,1).seltext Your query has been accepted. | did -d qmd 1 %acceptdel | did -d qmd 4 %acceptdel }
  121.   if ($did == 20) { did -b qmd 18,20-22 | var %denydel $did(qmd,1).sel | msg $did(qmd,1).seltext Your query has been denied. | close -m $did(qmd,1).seltext | did -d qmd 1 %denydel | did -d qmd 4 %denydel }
  122.   if ($did == 21) { did -b qmd 18,20-22 | var %blockdel $did(qmd,1).sel | msg $did(qmd,1).seltext Your query has been denied. | msg $did(qmd,1).seltext You are blocked and not able to query me any longer. | .write qmd.blocked.txt $did(qmd,1).seltext | close -m $did(qmd,1).seltext | did -d qmd 1 %blockdel | did -d qmd 4 %blockdel }
  123.   if ($did == 22) { did -b qmd 18,20-22 | var %frienddel $did(qmd,1).sel | msg $did(qmd,1).seltext Your query has been accepted. | msg $did(qmd,1).seltext You are added to the friendlist and don't need approval to query me. | .write qmd.friends.txt $did(qmd,1).seltext | did -d qmd 1 %frienddel | did -d qmd 4 %frienddel }
  124.   if ($did == 23) { noop $input(All blocked users are removed!,iwo,Absent's Query Manager) | did -b qmd 23,26 | .remove qmd.blocked.txt | did -ra qmd 9 List cleared | dialog -v qmd qmd }
  125.   if ($did == 24) {
  126.     var %friendadd = $?="Please fill in the nickname you are trying to add"
  127.     if (!%friendadd) { noop $input(Please fill in a valid nickname!,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
  128.     if ($read(qmd.friends.txt,w,%friendadd)) { noop $input(%friendadd is already known on the friendlist,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
  129.     else {
  130.       write qmd.friends.txt %friendadd
  131.       noop $input(%friendadd has been added to the friendlist!,iwo,Absent's Query Manager)
  132.       did -e qmd 16,25
  133.       did -r qmd 8
  134.       dialog -v qmd qmd
  135.       var %f 1
  136.       while (%f <= $lines(qmd.friends.txt)) {
  137.         did -a qmd 8 $read(qmd.friends.txt,%f)
  138.         inc %f
  139.       }
  140.     }
  141.   }
  142.   if ($did == 25) { noop $input(All friend users are removed!,iwo,Absent's Query Manager) | did -b qmd 16,25 | .remove qmd.friends.txt | did -ra qmd 8 List cleared | dialog -v qmd qmd }
  143.   if ($did == 26) {
  144.     if (!$did(9).seltext) {
  145.       noop $input(Please select a nick to unblock!,uwo,Absent's Query Manager)
  146.       dialog -v qmd qmd
  147.     }
  148.     elseif (!$did(9).seltext) { halt }
  149.     var %dblocked $read(qmd.blocked.txt,w,$did(9).seltext)
  150.     if (%dblocked != $did(9).seltext) { halt }
  151.     write -dl [ $+ [ $readn ] ] qmd.blocked.txt
  152.     did -d qmd 9 $did(9).seltext
  153.     noop $input($did(9).seltext has been removed from the blocklist,uwo,Absent's Query Manager)
  154.     did -r qmd 9
  155.     dialog -v qmd qmd
  156.     if (!$read(qmd.blocked.txt)) {
  157.       did -ra qmd 9 No users found
  158.       did -b qmd 23,26
  159.     }
  160.     else {
  161.       var %x = 1
  162.       while ( %x <= $lines(qmd.blocked.txt)) {
  163.         did -a qmd 9 $read(qmd.blocked.txt,%x)
  164.         inc %x
  165.       }
  166.     }
  167.   }
  168.   if ($did == 27) {
  169.     if ($lines(qmd.txt) == 0) {
  170.       noop $input(Unable to open the logfile because its empty,uho,Absent's Query Manager)
  171.     }
  172.     else { //run qmd.txt }
  173.   }
  174.   if ($did == 28) {
  175.     if ($lines(qmd.txt) == 0) {
  176.       noop $input(Unable to clear the logfile because its empty,uho,Absent's Query Manager)
  177.     }
  178.     else { .timer 1 1 //remove qmd.txt | noop $input(Successfully cleared the logfile! Total of $lines(qmd.txt) lines,uio,Absent's Query Manager) }
  179.   }
  180. }
  181. on *:open:?:*:{
  182.   if ($nick == $me) { halt }
  183.   if (%tomany > 2) { .ignore -u30 $address($nick,1) | halt }
  184.   if ($read(qmd.friends.txt, w,* $+ $nick $+ *)) { halt }
  185.   if ($read(qmd.blocked.txt, w,* $+ $nick $+ *)) { .timerBLOCKEDPM 1 5 echo -a 5Query attempt by $nick (blocked) | write qmd.txt $upper($nick) - $1- - ( $+ $upper($fulldate) $+ ) | close -m $nick | halt }
  186.   var %protected Q G S -sbnc PsyBNC X
  187.   if ($istok(%protected,$nick,32)) { halt }
  188.   if (!%qmd) { halt }
  189.   qmd
  190.   if (!$did(qmd,5)) { did -a qmd 5 $nick }
  191.   inc %Qcount
  192.   set -u3 %tomany $calc($iif(%tomany,$v1,0) +1)
  193.   did -a qmd 1 $nick
  194.   did -a qmd 4 $1-
  195.   did -ra qmd 6 $nick
  196.   did -ra qmd 7 $fulldate
  197.   .timer 1 2 msg $nick Please wait for me to accept or reject this private message. Remember that, i might not be here. 14[3Query ID:7 %Qcount $+ 14]
  198. }
RAW Paste Data
Top