summaryrefslogtreecommitdiff
path: root/client/application.go
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-02 16:32:49 -0500
committercitrons <citrons@mondecitronne.com>2025-06-02 16:36:36 -0500
commitfdaf24fd0aff9e1089157fd65d81a5aa3fe550bd (patch)
tree4b44f73af9cd139b698bf85dc23d6380b4f7d28a /client/application.go
parent30243fd5c596704d5e30b8ea19a05af1dd287d2e (diff)
user statuses
Diffstat (limited to 'client/application.go')
-rw-r--r--client/application.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/client/application.go b/client/application.go
index 5ac3b9d..fb12717 100644
--- a/client/application.go
+++ b/client/application.go
@@ -64,7 +64,7 @@ func (a *application) OnEvent(cmd proto.Command) {
}
case "update":
if len(cmd.Args) > 0 {
- a.cache.Update(cmd.Target, cmd.Args[0])
+ a.onUpdate(cmd.Target, cmd.Args[0])
}
case "delete":
a.cache.Gone(cmd.Target)
@@ -80,6 +80,13 @@ func (a *application) OnResponse(requestId string, cmd proto.Command) {
}
}
+func (a *application) onUpdate(target string, update proto.Object) {
+ if target == a.uid {
+ a.logUserUpdate(target, update)
+ }
+ a.cache.Update(target, update)
+}
+
func (a *application) Sub(id string) {
a.Request(proto.NewCmd("s", id), func(cmd proto.Command) {
if cmd.Kind == "i" && len(cmd.Args) > 0 {
@@ -126,12 +133,7 @@ func (a *application) auth(name string, authCallback func(success bool)) {
}
func (a *application) sendUpdate(o proto.Object, cb func(proto.Command)) {
- a.Request(proto.NewCmd("update", o.Id, o), func(response proto.Command) {
- if response.Kind == "ok" {
- a.cache.Update(o.Id, o)
- }
- cb(response)
- })
+ a.Request(proto.NewCmd("update", o.Id, o), cb)
}
func (a *application) lookup(
@@ -212,8 +214,6 @@ func (a *application) setNick(newName string) {
if len(response.Args) != 0 {
a.cmdWindow.err(proto.Strfail(response.Args[0]))
}
- case "ok":
- a.cmdWindow.info("your name is: %s", newName)
}
}
a.sendUpdate(