diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-09 14:45:51 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-09 14:46:11 -0500 |
| commit | cd06a27e20717cdfbcc6840328f67405acc7c9e7 (patch) | |
| tree | 9cc2e9c67c749f4a9e263d586a244b7e7746b5fd /client/application.go | |
| parent | dc957f6bb77c9d89b52f22b605f79f7be110f546 (diff) | |
jump to message
Diffstat (limited to 'client/application.go')
| -rw-r--r-- | client/application.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/client/application.go b/client/application.go index 6b88281..f6310b9 100644 --- a/client/application.go +++ b/client/application.go @@ -30,9 +30,9 @@ type application struct { func newApplication(serverAddress string) *application { var app application app.Client = client.New(serverAddress) - app.goTo(app.cmdWindow.Location()) app.cache = object.NewCache(&app) app.windowCache = window.NewCache() + app.goTo(app.cmdWindow.Location()) app.cmdWindow.info("welcome! type /help for help. try: /join talk") app.cmdWindow.info("connecting to %s", app.Client.Address) @@ -71,17 +71,24 @@ func (a *application) OnDisconnect(err error) { func (a *application) OnEvent(cmd proto.Command) { switch cmd.Kind { case "p": - cw := a.windowCache.Get(channelLocation {cmd.Target}).(*channelWindow) - if cw != nil && len(cmd.Args) > 0 { - cw.put(cmd.Args[0]) + if len(cmd.Args) == 0 { + break } + a.windowCache.ForAll(func(win window.Window) { + switch win.(type) { + case *channelWindow: + if win.(*channelWindow).location.id == cmd.Target { + win.(*channelWindow).put(cmd.Args[0]) + } + } + }) case "update": if len(cmd.Args) > 0 { a.onUpdate(cmd.Target, cmd.Args[0]) } case "delete": a.cache.Gone(cmd.Target) - cl := channelLocation {cmd.Target} + cl := channelLocation {id: cmd.Target} if a.windowCache.Get(cl) != nil { a.windowCache.Evict(cl) a.removeFromHistory(cl) |
