diff options
Diffstat (limited to 'server/channel')
| -rw-r--r-- | server/channel/channel.go | 8 | ||||
| -rw-r--r-- | server/channel/command.go | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/server/channel/channel.go b/server/channel/channel.go index c4d2000..6ef21ba 100644 --- a/server/channel/channel.go +++ b/server/channel/channel.go @@ -102,7 +102,7 @@ func (c *Channel) NameFor(uid string) string { } u := c.store.world.GetObject(member) if u != nil { - members = append(members, u.GetInfo().Fields[""]) + members = append(members, u.InfoFor(uid).Fields[""]) } } sort.Strings(members) @@ -223,16 +223,12 @@ func (c *Channel) Kind() string { } } -func (c *Channel) GetInfoFor(uid string) proto.Object { +func (c *Channel) InfoFor(uid string) proto.Object { return proto.Object { c.Kind(), c.id, map[string]string {"": c.NameFor(uid)}, } } -func (c *Channel) GetInfo() proto.Object { - return c.GetInfoFor("") -} - func (t Tombstone) GetInfo() proto.Object { return proto.Object { "gone", "", map[string]string {"": t.name, "kind": "channel"}, diff --git a/server/channel/command.go b/server/channel/command.go index 3cbedab..3434326 100644 --- a/server/channel/command.go +++ b/server/channel/command.go @@ -49,11 +49,11 @@ func (c *Channel) SendRequest(r session.Request) { r.Reply(proto.NewCmd("p", c.id, c.Put(m))) case "i": - r.Reply(proto.NewCmd("i", "", c.GetInfoFor(r.From.UserId))) + r.Reply(proto.NewCmd("i", "", c.InfoFor(r.From.UserId))) case "s": r.From.Subscribe(&c.Stream) - r.Reply(proto.NewCmd("i", "", c.GetInfoFor(r.From.UserId))) + r.Reply(proto.NewCmd("i", "", c.InfoFor(r.From.UserId))) case "u": r.From.Unsubscribe(&c.Stream) @@ -127,7 +127,7 @@ func (c *Channel) SendRequest(r session.Request) { cmd := proto.NewCmd("list", c.Id()) for m, _ := range c.Members() { u := c.store.world.GetObject(m).(*user.User) - cmd.Args = append(cmd.Args, u.GetInfo()) + cmd.Args = append(cmd.Args, u.InfoFor(r.From.UserId)) } r.Reply(cmd) |
