diff options
Diffstat (limited to 'go-src/windows.go')
| -rw-r--r-- | go-src/windows.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/go-src/windows.go b/go-src/windows.go index 3bc621c..95478c6 100644 --- a/go-src/windows.go +++ b/go-src/windows.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "runtime" + "strconv" "strings" "gitlab.com/Syndamia/ctfc/go-src/ui" @@ -68,6 +69,8 @@ func chatsWindow(values ...string) { clearScreen() ui.NormalBox(true, "Direct Messages", "Account", "Logout") + allChats := getAllChats() + ui.NumberedFields(allChats...) ui.PageField(0, 0) ui.EmptyLine() @@ -83,7 +86,12 @@ func chatsWindow(values ...string) { inputAction{"H", chatsWindow, []string{"ShowHelp"}}, ) if !handled { - defer showError(invalidCommand, chatsWindow) + // if is number + if chatI, err := strconv.Atoi(input); chatI >= 0 && chatI <= len(allChats) && err == nil { + defer chatWindow(strings.Split(allChats[chatI-1], " : ")[0]) + } else { + defer showError(invalidCommand, chatsWindow) + } } } @@ -106,8 +114,13 @@ func createChatWindow(values ...string) { } func chatWindow(values ...string) { + clearScreen() + currChat := getChat(values[0]) fmt.Println(currChat) + + ui.InputField("Enter anything") + defer chatsWindow() } func logoutWindow(...string) { |
