feat: handle more commands and properly implement older ones

* fix parser tests
* write logs to file
* gracefully terminate program
* make viewport follow output
* properly handle channel nicks and display them in the sidepanel
* general refactors and fixes
This commit is contained in:
2022-01-15 21:56:06 +02:00
parent 8a7e1568ae
commit 22d5e39899
15 changed files with 487 additions and 181 deletions
+4 -6
View File
@@ -30,7 +30,7 @@ import (
type Screen int
const (
Login = iota
Login Screen = iota
MainScreen
)
@@ -52,15 +52,13 @@ func initialUiState(client *client.Client) UI {
}
}
func InitialState() State {
func InitialState() *State {
client := &client.Client{}
s := State{
return &State{
Client: client,
UI: initialUiState(client),
}
return s
}
func (s State) Init() tea.Cmd {
@@ -94,7 +92,7 @@ func (s State) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
s.UI.CurrentScreen = MainScreen
// create new client with the provided host and port
(*s.Client) = client.NewClient(host, port, tlsEnabled)
s.Client.Initialize(host, port, tlsEnabled)
s.Client.Register(nickname, password, channel)
// 512 bytes as a base + 8192 additional bytes for tags