summaryrefslogtreecommitdiff
path: root/client/application.go
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2025-10-22 15:48:40 -0500
committerraven <citrons@mondecitronne.com>2025-10-22 16:23:32 -0500
commit4b54a1d11fd0fa355b244637612a3fd0af18c60c (patch)
tree43a2d2d1feff2caf40a2e33b6ac4d61185708ab3 /client/application.go
parent9126f2329aa21645e0d5622b0eeed402273efa95 (diff)
events generated from other clients on the same account
Diffstat (limited to 'client/application.go')
-rw-r--r--client/application.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/client/application.go b/client/application.go
index eb72d14..d396f24 100644
--- a/client/application.go
+++ b/client/application.go
@@ -78,11 +78,20 @@ func (a *application) OnEvent(cmd proto.Command) {
}
case "delete":
a.cache.Gone(cmd.Target)
+ fallthrough
+ case "leave":
cl := channelLocation {id: cmd.Target}
- if a.windowCache.Get(cl) != nil {
- a.windowCache.Evict(cl)
- a.removeFromHistory(cl)
+ w := a.windowCache.Get(cl)
+ if w != nil {
+ w.(*channelWindow).onLeaveChannel()
}
+ a.channelList.remove(cl)
+ case "join":
+ a.cache.Fetch(cmd.Target, func(ch *proto.Object) {
+ if ch != nil {
+ a.newChannel(*ch)
+ }
+ })
}
}
@@ -103,11 +112,8 @@ func (a *application) OnResponse(requestId string, cmd proto.Command) {
if len(cmd.Args) > 0 {
a.cmdWindow.info("your name is: %s", cmd.Args[0].Fields[""])
}
- case "p":
- if len(cmd.Args) > 0 {
- a.onPut(cmd.Target, cmd.Args[0])
- }
}
+ a.OnEvent(cmd)
}
func (a *application) onUpdate(target string, update proto.Object) {
@@ -248,6 +254,7 @@ func (a *application) join(channelName string) {
case *channelWindow:
w.(*channelWindow).endOfHistory = false
}
+ a.goTo(channelLocation {id: ch.Id})
case "fail":
if len(response.Args) > 0 {
f := proto.Fail(response.Args[0])
@@ -283,6 +290,7 @@ func (a *application) createChannel(name string) {
case "create":
if len(response.Args) > 0 {
a.newChannel(response.Args[0])
+ a.goTo(channelLocation {id: response.Args[0].Id})
}
case "fail":
if len(response.Args) > 0 {