Advertisement
westor

Networks + Channels Management for Koragg v1.3

Feb 15th, 2020
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.15 KB | None | 0 0
  1. dialog -l management {
  2.   title "Networks + Channels Management"
  3.   size -1 -1 289 149
  4.   option dbu
  5.   button "Close this window", 1, 47 131 193 16, default ok
  6.   list 2, 2 15 71 98, disable size hsbar vsbar sort
  7.   button "Add Network", 3, 74 18 37 30
  8.   button "Del Network", 4, 74 80 37 30, disable
  9.   button "Clear all networks", 6, 5 114 65 10, disable
  10.   text "Networks:", 7, 27 6 44 8
  11.   list 8, 216 15 71 98, disable size hsbar vsbar sort
  12.   button "Add Channel", 9, 178 18 37 30, disable
  13.   button "Del Channel", 10, 178 80 37 30, disable
  14.   button "Clear all channels", 12, 218 114 65 10, disable
  15.   text "Channels:", 5, 237 6 44 8
  16. }
  17.  
  18. ON *:DIALOG:management:*:*: {
  19.   if ($devent == init) { management_networks_list }
  20.  
  21.   if ($devent == sclick) {
  22.     if ($did == 2) {
  23.       var %s = $did($did).seltext
  24.  
  25.       if (!%s) { return }
  26.  
  27.       did -e $dname 4,6,9
  28.       did -b $dname 10,12
  29.  
  30.       management_channels_list %s
  31.     }
  32.  
  33.     if ($did == 8) {
  34.       var %s = $did($did).seltext
  35.  
  36.       if (!%s) { return }
  37.  
  38.       did -e $dname 10,12
  39.     }
  40.  
  41.     if ($did == 3) {
  42.       var %f = management.db
  43.       var %h = MANAGEMENT
  44.  
  45.       var %a = $input(Enter here the network to add:,eqodbu,Enter)
  46.  
  47.       if (!%a) { management | return }
  48.       if ($management_check_network(%a)) { noop $input(This network is already exists!,houdb,Error) | management | return }
  49.  
  50.       hadd -m MANAGEMENT %a
  51.       hsave %h $qt(%f)
  52.  
  53.       management_networks_list
  54.     }
  55.  
  56.     if ($did == 4) {
  57.       var %f = management.db
  58.       var %h = MANAGEMENT
  59.       var %s = $did(2).seltext
  60.  
  61.       if (!%s) { return }
  62.  
  63.       did -b $dname 4,9
  64.  
  65.       hdel %h %s
  66.       hsave %h $qt(%f)
  67.  
  68.       management_networks_list
  69.     }
  70.  
  71.     if ($did == 6) {
  72.       var %f = management.db
  73.       var %h = MANAGEMENT
  74.  
  75.       if ($hget(%h)) { hfree %h }
  76.       if ($isfile(%f)) { .remove $qt(%f) }
  77.  
  78.       management_networks_list
  79.     }
  80.  
  81.     if ($did == 9) {
  82.       var %f = management.db
  83.       var %h = MANAGEMENT
  84.       var %n = $did(2).seltext
  85.  
  86.       if (!%n) { return }
  87.  
  88.       var %a = $input(Enter here a channel to add for %n network:,eqodbu,Enter)
  89.  
  90.       if (!%a) { management | return }
  91.  
  92.       var %c = $hget(%h,%n)
  93.  
  94.       if ($left(%a,1) !== $chr(35)) { noop $input(Please specify a correct channnel name using ' $+ $chr(35) $+ ' in front of the channel name!,houdb,Error) | management | return }
  95.       if ($chr(44) isin %a) { noop $input(Please specify only one channel without using commas!,houdb,Error) | management | return }
  96.       if ($chr(32) isin %a) { noop $input(Please do not specify spaces into the channel name!,houdb,Error) | management | return }
  97.       if ($istok(%c,%a,44)) { noop $input(This channel is already exists in %n network!,houdb,Error) | management | return }
  98.  
  99.       var %c = $addtok(%c,%a,44)
  100.  
  101.       hadd MANAGEMENT %n %c
  102.       hsave %h $qt(%f)
  103.  
  104.       management_channels_list %n
  105.     }
  106.  
  107.     if ($did == 10) {
  108.       var %f = management.db
  109.       var %h = MANAGEMENT
  110.       var %n = $did(2).seltext
  111.       var %s = $did(8).seltext
  112.  
  113.       if (!%n) || (!%s) { return }
  114.  
  115.       var %c = $hget(%h,%n)
  116.       var %c = $remtok(%c,%s,1,44)
  117.  
  118.       hdel %h %n
  119.       hadd %h %n %c
  120.       hsave %h $qt(%f)
  121.  
  122.       management_channels_list %n
  123.     }
  124.  
  125.     if ($did == 12) {
  126.       var %f = management.db
  127.       var %h = MANAGEMENT
  128.       var %n = $did(2).seltext
  129.  
  130.       if (!%n) { return }
  131.  
  132.       hdel %h %n
  133.       hadd %h %n
  134.       hsave %h $qt(%f)
  135.  
  136.       management_channels_list %n
  137.     }
  138.   }
  139.  
  140. }
  141.  
  142. ON *:START: {
  143.   if (!$starting) { return }
  144.  
  145.   var %f = management.db
  146.   var %h = MANAGEMENT
  147.  
  148.   hmake %h 500
  149.  
  150.   if ($file(%f)) { hload %h $qt(%f) }
  151. }
  152.  
  153. menu status {
  154.   Networks + Channels Management: { management }
  155. }
  156.  
  157. alias management {
  158.   var %d = management
  159.  
  160.   if ($dialog(%d)) { dialog -ve %d %d | return }
  161.  
  162.   dialog -md %d %d
  163. }
  164.  
  165. alias management_check {
  166.   if ($0 !== 2) { return 0 }
  167.   var %h = MANAGEMENT
  168.   var %c = $hget(%h,$1)
  169.  
  170.   if (!%c) { return 0 }
  171.  
  172.   if ($istok(%c,$2,44)) { return 1 }
  173.  
  174.   return 0
  175. }
  176.  
  177. alias -l management_check_network {
  178.   if (!$1) { return 0 }
  179.   var %h = MANAGEMENT
  180.   var %t = $hget(%h,0).item
  181.  
  182.   if (!$hget(%h)) || (!%t) { return 0 }
  183.  
  184.   var %i = 1
  185.   while (%i <= %t) {
  186.     var %m = $hget(%h,%i).item
  187.  
  188.     if ($1 == %m) { return 1 }
  189.  
  190.     inc %i
  191.   }
  192.  
  193.   return 0
  194. }
  195.  
  196. alias -l management_channels_list {
  197.   var %d = management
  198.   var %h = MANAGEMENT
  199.  
  200.   if (!$1) || (!$dialog(%d)) { return }
  201.  
  202.   var %t = $hget(%h,$1)
  203.  
  204.   did -r %d 8
  205.  
  206.   if (!%t) { did -b %d 8,10,12 | return }
  207.  
  208.   did -b %d 10
  209.   did -e %d 8,12
  210.  
  211.   var %i = 1
  212.   while (%i <= $numtok(%t,44)) {
  213.     var %c = $gettok(%t,%i,44)
  214.  
  215.     if (!%c) { goto next }
  216.  
  217.     did -a %d 8 %c
  218.  
  219.     :next
  220.     inc %i
  221.   }
  222. }
  223.  
  224. alias -l management_networks_list {
  225.   var %d = management
  226.   var %h = MANAGEMENT
  227.  
  228.   if (!$dialog(%d)) { return }
  229.  
  230.   var %t = $hget(%h,0).item
  231.  
  232.   did -r %d 2,8
  233.  
  234.   if (!$hget(%h)) || (!%t) { did -b %d 2,8,9,4,6,10,12 | return }
  235.  
  236.   did -b %d 4,9,10,12
  237.   did -e %d 2,6
  238.  
  239.   var %i = 1
  240.   while (%i <= %t) {
  241.     var %n = $hget(%h,%i).item
  242.  
  243.     if (!%n) { goto next }
  244.  
  245.     did -a %d 2 %n
  246.  
  247.     :next
  248.     inc %i
  249.   }
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement