check_commands -> filter_commands
parent
7625d36c1c
commit
e9c9c852ab
|
@ -52,18 +52,10 @@ module Console::CommandDispatcher
|
|||
#
|
||||
# Returns the commands that meet the requirements
|
||||
#
|
||||
def check_commands(all, reqs=nil)
|
||||
def filter_commands(all, reqs)
|
||||
all.delete_if do |cmd, _desc|
|
||||
del = false
|
||||
reqs[cmd].each do |req|
|
||||
next if client.commands.include? req
|
||||
del = true
|
||||
break
|
||||
reqs[cmd].any? { |req| !client.commands.include?(req) }
|
||||
end
|
||||
del
|
||||
end
|
||||
|
||||
all
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -52,7 +52,7 @@ class Console::CommandDispatcher::Android
|
|||
'set_audio_mode' => ['android_set_audio_mode'],
|
||||
'wakelock' => ['android_wakelock'],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
def interval_collect_usage
|
||||
|
|
|
@ -41,7 +41,7 @@ class Console::CommandDispatcher::Extapi::Adsi
|
|||
"adsi_dc_enum" => [ "extapi_adsi_domain_query" ],
|
||||
"adsi_domain_query" => [ "extapi_adsi_domain_query" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -40,7 +40,7 @@ class Console::CommandDispatcher::Extapi::Clipboard
|
|||
"clipboard_monitor_purge" => [ "extapi_clipboard_monitor_purge" ],
|
||||
"clipboard_monitor_stop" => [ "extapi_clipboard_monitor_stop" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -31,7 +31,7 @@ class Console::CommandDispatcher::Extapi::Service
|
|||
"service_query" => [ "extapi_service_query" ],
|
||||
"service_control" => [ "extapi_service_control" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -27,7 +27,7 @@ class Console::CommandDispatcher::Extapi::Window
|
|||
reqs = {
|
||||
"window_enum" => [ "extapi_window_enum" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -31,7 +31,7 @@ class Console::CommandDispatcher::Extapi::Wmi
|
|||
reqs = {
|
||||
"wmi_query" => [ "extapi_wmi_query" ],
|
||||
}
|
||||
check_commands(all, reqs)
|
||||
filter_commands(all, reqs)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue