mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
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:
+4
-6
@@ -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
|
||||
|
||||
@@ -19,13 +19,8 @@ package app
|
||||
import tea "github.com/charmbracelet/bubbletea"
|
||||
|
||||
func (s *State) Quit() tea.Msg {
|
||||
if s.Client.Quit != nil {
|
||||
close(s.Client.Quit)
|
||||
}
|
||||
|
||||
if s.Client.TcpConn != nil {
|
||||
s.Client.SendCommand("QUIT")
|
||||
s.Client.TcpConn.Close()
|
||||
}
|
||||
|
||||
return tea.Quit()
|
||||
|
||||
Reference in New Issue
Block a user