diff options
Diffstat (limited to 'client/application.go')
| -rw-r--r-- | client/application.go | 18 |
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( |
