diff options
author | Joe <rbo@gmx.us> | 2024-04-25 20:20:20 +0200 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-04-25 20:20:20 +0200 |
commit | 72ee87d8c097449a315b476f0b359ae6c44c26cf (patch) | |
tree | 122153aa21ae063b9c3a1692ee95aab2f90ed42a /src/e_events.go | |
parent | goot test (diff) | |
download | hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.gz hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.bz2 hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.xz hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.zst hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.zip |
wo edit was fast
Diffstat (limited to 'src/e_events.go')
-rw-r--r-- | src/e_events.go | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/e_events.go b/src/e_events.go index 8f631a6..9a2b867 100644 --- a/src/e_events.go +++ b/src/e_events.go @@ -324,23 +324,33 @@ func e_set_drive_keys(data *HardData) { data.ui.insert_sel_max = INS_RDP_OK + len(data.insert.Drive) } +func e_set_protocol_max(data *HardData, in *HostNode) { + switch in.Protocol { + case PROTOCOL_SSH: + data.ui.insert_sel_max = INS_SSH_OK + case PROTOCOL_RDP: + data.ui.insert_sel_max = INS_RDP_OK + len(in.Drive) + case PROTOCOL_CMD: + data.ui.insert_sel_max = INS_CMD_OK + case PROTOCOL_OS: + data.ui.insert_sel_max = INS_OS_OK + } +} + func e_set_protocol_defaults(data *HardData, in *HostNode) { switch in.Protocol { case PROTOCOL_SSH: in.Port = 22 - data.ui.insert_sel_max = INS_SSH_OK case PROTOCOL_RDP: in.Port = 3389 in.Quality = 2 in.Width = 1600 in.Height = 1200 in.Dynamic = true - data.ui.insert_sel_max = INS_RDP_OK + len(in.Drive) in.drive_keys = nil case PROTOCOL_CMD: in.Silent = false in.Shell = []string{"/bin/sh", "-c"} - data.ui.insert_sel_max = INS_CMD_OK case PROTOCOL_OS: in.Stack.RegionName = "eu-west-0" in.Stack.IdentityAPI = "3" @@ -349,27 +359,32 @@ func e_set_protocol_defaults(data *HardData, in *HostNode) { in.Stack.VolumeAPI = "3.42" in.Stack.EndpointType = "publicURL" in.Stack.Interface = "public" - data.ui.insert_sel_max = INS_OS_OK } + e_set_protocol_max(data, in) } -func e_paste_prepare_item(yank *ItemsNode) HostNode { +func e_deep_copy_host(base *HostNode) HostNode { new_host := HostNode{} - new_host = *yank.Host - new_host.Name += " (copy)" - if yank.Host.Drive != nil { - new_host.Drive = make(map[string]string, len(yank.Host.Drive)) - for k, v := range yank.Host.Drive { + new_host = *base + if base.Drive != nil { + new_host.Drive = make(map[string]string, len(base.Drive)) + for k, v := range base.Drive { new_host.Drive[k] = v } } - if yank.Host.Shell != nil { - new_host.Shell = make([]string, len(yank.Host.Shell)) - copy(new_host.Shell, yank.Host.Shell) + if base.Shell != nil { + new_host.Shell = make([]string, len(base.Shell)) + copy(new_host.Shell, base.Shell) } return new_host } +func e_paste_prepare_item(yank *ItemsNode) HostNode { + new_host := e_deep_copy_host(yank.Host) + new_host.Name += " (copy)" + return new_host +} + // func e_paste_item(litems *ItemsList, item ItemsNode) { // curr := litems.curr // } |