Seb icon

Query manager

Seb | PRO | 12/21/11 07:08:56 AM UTC | 0 ⭐ | 1504 👁️ | Never ⏰ | []
mIRC |

7.97 KB

|

None

|

0 👍

/

0 👎

#Query manager found on http://www.hawkee.com/snippet/4228/ (instructions on the link)
#I just modified the reply with colors for someone and posted it here.
 
dialog qmd {
  title "Absent's Query Manager"
  size -1 -1 324 144
  option dbu
  list 1, 8 25 82 109, size
  check "Enable Query manager", 2, 9 8 72 10
  box "Configuration panel", 3, 176 33 141 95
  list 4, 91 25 82 109, size
  edit "", 5, 184 53 125 12, read
  edit "", 6, 185 81 125 12, read
  edit "", 7, 185 110 125 12, read
  combo 8, 180 8 60 50, sort drop
  combo 9, 251 8 60 50, sort drop
  box "Blocklist", 10, 247 0 70 31
  box "Friendlist", 11, 176 0 70 31
  text "First Nick/Hostmask:", 12, 185 43 51 8
  text "Last Nick/Hostmask:", 13, 185 71 51 8
  text "Date/Time of Query:", 14, 186 99 51 8
  button "-", 16, 189 20 9 9
  button "+", 17, 250 20 9 9
  button "Accept", 18, 87 11 20 10
  box "Navigation panel", 19, 84 0 90 24
  button "Deny", 20, 108 11 20 10
  button "Block", 21, 129 11 20 10
  button "Friend", 22, 150 11 20 10
  button "Clear", 23, 270 20 19 9
  button "+", 24, 179 20 9 9
  button "Clear", 25, 199 20 19 9
  button "-", 26, 260 20 9 9
  button "Close", 15, 273 130 37 12, ok cancel
  button "Logs", 27, 228 130 37 12
  button "Clearlog", 28, 183 130 37 12
}
alias qmd { dialog $iif($dialog(qmd),-v,-md) qmd qmd }
menu * {
  .Query Manager:qmd
}
on *:dialog:qmd:init:0:{
  if (%qmd) { did -c qmd 2 }
  else { did -u qmd 2 }
  did -b qmd 18,20-22
  if (!$read(qmd.friends.txt)) { 
    did -b qmd 16,25
    did -ra qmd 8 No users found
  }
  elseif ($read(qmd.friends.txt)) {
    var %f 1
    while (%f <= $lines(qmd.friends.txt)) {
      did -a qmd 8 $read(qmd.friends.txt,%f))
      inc %f
    }
  }
  if (!$read(qmd.blocked.txt)) {
    did -b qmd 23,26
    did -ra qmd 9 No users found
  }
  elseif ($read(qmd.blocked.txt)) {
    var %b 1
    while (%b <= $lines(qmd.blocked.txt)) {
      did -a qmd 9 $read(qmd.blocked.txt,%b))
      inc %b
    }
  }
}
on *:dialog:qmd:sclick:1:{
  if ($did(qmd,18).sel) != 0) && ($did(qmd,18).seltext) != $null) {
    did -e qmd 18,20-22
  }
}
on *:dialog:qmd:sclick:*:{
  if ($did == 2) { 
    if (%qmd) { unset %qmd | did -u qmd 2 }
    else { set %qmd on | did -c qmd 2 }
  }
  if ($did == 16) {
    if (!$did(8).seltext) {
      noop $input(Please select a nick to unblock!,uwo,Absent's Query Manager) 
      dialog -v qmd qmd
    }
    elseif (!$did(8).seltext) { halt }
    var %dfriends $read(qmd.friends.txt,w,$did(8).seltext) 
    if (%dfriends != $did(8).seltext) { halt }
    write -dl [ $+ [ $readn ] ] qmd.friends.txt 
    did -d qmd 8 $did(8).seltext 
    noop $input($did(8).seltext has been removed from the friendlist,uwo,Absent's Query Manager)
    did -r qmd 8
    dialog -v qmd qmd
    if (!$read(qmd.friends.txt)) {
      did -ra qmd 8 No users found
      did -b qmd 16,25
    }
    else {
      var %x = 1
      while ( %x <= $lines(qmd.friends.txt)) {
        did -a qmd 8 $read(qmd.friends.txt,%x)
        inc %x
      }
    }
  }
  if ($did == 17) { 
    var %blockadd = $?="Please fill in the nickname you are trying to add"
    if (!%blockadd) { noop $input(Please fill in a valid nickname!,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
    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 }
    else { 
      write qmd.blocked.txt %blockadd
      noop $input(%blockadd has been added to the blocklist!,uwo,Absent's Query Manager)
      did -e qmd 23,26
      did -r qmd 9
      dialog -v qmd qmd
      var %b 1
      while (%b <= $lines(qmd.blocked.txt)) {
        did -a qmd 9 $read(qmd.blocked.txt,%b)
        inc %b
      }
    }
  }
  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 }
  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 }
  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 }
  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 }
  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 }
  if ($did == 24) { 
    var %friendadd = $?="Please fill in the nickname you are trying to add"
    if (!%friendadd) { noop $input(Please fill in a valid nickname!,uwo,Absent's Query Manager) | dialog -v qmd qmd | halt }
    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 }
    else { 
      write qmd.friends.txt %friendadd
      noop $input(%friendadd has been added to the friendlist!,iwo,Absent's Query Manager)
      did -e qmd 16,25
      did -r qmd 8
      dialog -v qmd qmd
      var %f 1
      while (%f <= $lines(qmd.friends.txt)) {
        did -a qmd 8 $read(qmd.friends.txt,%f)
        inc %f
      }
    }
  }
  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 }
  if ($did == 26) {
    if (!$did(9).seltext) {
      noop $input(Please select a nick to unblock!,uwo,Absent's Query Manager) 
      dialog -v qmd qmd
    }
    elseif (!$did(9).seltext) { halt }
    var %dblocked $read(qmd.blocked.txt,w,$did(9).seltext) 
    if (%dblocked != $did(9).seltext) { halt }
    write -dl [ $+ [ $readn ] ] qmd.blocked.txt 
    did -d qmd 9 $did(9).seltext 
    noop $input($did(9).seltext has been removed from the blocklist,uwo,Absent's Query Manager)
    did -r qmd 9
    dialog -v qmd qmd
    if (!$read(qmd.blocked.txt)) {
      did -ra qmd 9 No users found
      did -b qmd 23,26
    }
    else {
      var %x = 1
      while ( %x <= $lines(qmd.blocked.txt)) {
        did -a qmd 9 $read(qmd.blocked.txt,%x)
        inc %x
      }
    }
  }
  if ($did == 27) { 
    if ($lines(qmd.txt) == 0) {
      noop $input(Unable to open the logfile because its empty,uho,Absent's Query Manager)
    }
    else { //run qmd.txt } 
  }
  if ($did == 28) {
    if ($lines(qmd.txt) == 0) {
      noop $input(Unable to clear the logfile because its empty,uho,Absent's Query Manager) 
    }
    else { .timer 1 1 //remove qmd.txt | noop $input(Successfully cleared the logfile! Total of $lines(qmd.txt) lines,uio,Absent's Query Manager) } 
  }
}
on *:open:?:*:{
  if ($nick == $me) { halt }
  if (%tomany > 2) { .ignore -u30 $address($nick,1) | halt }
  if ($read(qmd.friends.txt, w,* $+ $nick $+ *)) { halt }
  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 }
  var %protected Q G S -sbnc PsyBNC X 
  if ($istok(%protected,$nick,32)) { halt }
  if (!%qmd) { halt }
  qmd
  if (!$did(qmd,5)) { did -a qmd 5 $nick }
  inc %Qcount
  set -u3 %tomany $calc($iif(%tomany,$v1,0) +1)
  did -a qmd 1 $nick
  did -a qmd 4 $1-
  did -ra qmd 6 $nick
  did -ra qmd 7 $fulldate
  .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] 
}

Comments