Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dialog -l management {
- title "Networks + Channels Management"
- size -1 -1 289 149
- option dbu
- button "Close this window", 1, 47 131 193 16, default ok
- list 2, 2 15 71 98, disable size hsbar vsbar sort
- button "Add Network", 3, 74 18 37 30
- button "Del Network", 4, 74 80 37 30, disable
- button "Clear all networks", 6, 5 114 65 10, disable
- text "Networks:", 7, 27 6 44 8
- list 8, 216 15 71 98, disable size hsbar vsbar sort
- button "Add Channel", 9, 178 18 37 30, disable
- button "Del Channel", 10, 178 80 37 30, disable
- button "Clear all channels", 12, 218 114 65 10, disable
- text "Channels:", 5, 237 6 44 8
- }
- ON *:DIALOG:management:*:*: {
- if ($devent == init) { management_networks_list }
- if ($devent == sclick) {
- if ($did == 2) {
- var %s = $did($did).seltext
- if (!%s) { return }
- did -e $dname 4,6,9
- did -b $dname 10,12
- management_channels_list %s
- }
- if ($did == 8) {
- var %s = $did($did).seltext
- if (!%s) { return }
- did -e $dname 10,12
- }
- if ($did == 3) {
- var %f = management.db
- var %h = MANAGEMENT
- var %a = $input(Enter here the network to add:,eqodbu,Enter)
- if (!%a) { management | return }
- if ($management_check_network(%a)) { noop $input(This network is already exists!,houdb,Error) | management | return }
- hadd -m MANAGEMENT %a
- hsave %h $qt(%f)
- management_networks_list
- }
- if ($did == 4) {
- var %f = management.db
- var %h = MANAGEMENT
- var %s = $did(2).seltext
- if (!%s) { return }
- did -b $dname 4,9
- hdel %h %s
- hsave %h $qt(%f)
- management_networks_list
- }
- if ($did == 6) {
- var %f = management.db
- var %h = MANAGEMENT
- if ($hget(%h)) { hfree %h }
- if ($isfile(%f)) { .remove $qt(%f) }
- management_networks_list
- }
- if ($did == 9) {
- var %f = management.db
- var %h = MANAGEMENT
- var %n = $did(2).seltext
- if (!%n) { return }
- var %a = $input(Enter here a channel to add for %n network:,eqodbu,Enter)
- if (!%a) { management | return }
- var %c = $hget(%h,%n)
- 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 }
- if ($chr(44) isin %a) { noop $input(Please specify only one channel without using commas!,houdb,Error) | management | return }
- if ($chr(32) isin %a) { noop $input(Please do not specify spaces into the channel name!,houdb,Error) | management | return }
- if ($istok(%c,%a,44)) { noop $input(This channel is already exists in %n network!,houdb,Error) | management | return }
- var %c = $addtok(%c,%a,44)
- hadd MANAGEMENT %n %c
- hsave %h $qt(%f)
- management_channels_list %n
- }
- if ($did == 10) {
- var %f = management.db
- var %h = MANAGEMENT
- var %n = $did(2).seltext
- var %s = $did(8).seltext
- if (!%n) || (!%s) { return }
- var %c = $hget(%h,%n)
- var %c = $remtok(%c,%s,1,44)
- hdel %h %n
- hadd %h %n %c
- hsave %h $qt(%f)
- management_channels_list %n
- }
- if ($did == 12) {
- var %f = management.db
- var %h = MANAGEMENT
- var %n = $did(2).seltext
- if (!%n) { return }
- hdel %h %n
- hadd %h %n
- hsave %h $qt(%f)
- management_channels_list %n
- }
- }
- }
- ON *:START: {
- if (!$starting) { return }
- var %f = management.db
- var %h = MANAGEMENT
- hmake %h 500
- if ($file(%f)) { hload %h $qt(%f) }
- }
- menu status {
- Networks + Channels Management: { management }
- }
- alias management {
- var %d = management
- if ($dialog(%d)) { dialog -ve %d %d | return }
- dialog -md %d %d
- }
- alias management_check {
- if ($0 !== 2) { return 0 }
- var %h = MANAGEMENT
- var %c = $hget(%h,$1)
- if (!%c) { return 0 }
- if ($istok(%c,$2,44)) { return 1 }
- return 0
- }
- alias -l management_check_network {
- if (!$1) { return 0 }
- var %h = MANAGEMENT
- var %t = $hget(%h,0).item
- if (!$hget(%h)) || (!%t) { return 0 }
- var %i = 1
- while (%i <= %t) {
- var %m = $hget(%h,%i).item
- if ($1 == %m) { return 1 }
- inc %i
- }
- return 0
- }
- alias -l management_channels_list {
- var %d = management
- var %h = MANAGEMENT
- if (!$1) || (!$dialog(%d)) { return }
- var %t = $hget(%h,$1)
- did -r %d 8
- if (!%t) { did -b %d 8,10,12 | return }
- did -b %d 10
- did -e %d 8,12
- var %i = 1
- while (%i <= $numtok(%t,44)) {
- var %c = $gettok(%t,%i,44)
- if (!%c) { goto next }
- did -a %d 8 %c
- :next
- inc %i
- }
- }
- alias -l management_networks_list {
- var %d = management
- var %h = MANAGEMENT
- if (!$dialog(%d)) { return }
- var %t = $hget(%h,0).item
- did -r %d 2,8
- if (!$hget(%h)) || (!%t) { did -b %d 2,8,9,4,6,10,12 | return }
- did -b %d 4,9,10,12
- did -e %d 2,6
- var %i = 1
- while (%i <= %t) {
- var %n = $hget(%h,%i).item
- if (!%n) { goto next }
- did -a %d 2 %n
- :next
- inc %i
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement