summaryrefslogtreecommitdiff
path: root/server/channel/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/channel/channel.go')
-rw-r--r--server/channel/channel.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/channel/channel.go b/server/channel/channel.go
index 056b942..c4d2000 100644
--- a/server/channel/channel.go
+++ b/server/channel/channel.go
@@ -88,11 +88,18 @@ func (cs *ChannelStore) ByName(name string) *Channel {
}
func (c *Channel) Name() string {
+ return c.NameFor("")
+}
+
+func (c *Channel) NameFor(uid string) string {
if !c.isDirect {
return c.name
} else {
var members []string
for member := range c.members {
+ if member == uid && len(c.members) > 1 {
+ continue
+ }
u := c.store.world.GetObject(member)
if u != nil {
members = append(members, u.GetInfo().Fields[""])
@@ -216,8 +223,14 @@ func (c *Channel) Kind() string {
}
}
+func (c *Channel) GetInfoFor(uid string) proto.Object {
+ return proto.Object {
+ c.Kind(), c.id, map[string]string {"": c.NameFor(uid)},
+ }
+}
+
func (c *Channel) GetInfo() proto.Object {
- return proto.Object {c.Kind(), c.id, map[string]string {"": c.Name()}}
+ return c.GetInfoFor("")
}
func (t Tombstone) GetInfo() proto.Object {