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.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/server/channel/channel.go b/server/channel/channel.go
index 50b43b6..9a3134e 100644
--- a/server/channel/channel.go
+++ b/server/channel/channel.go
@@ -10,6 +10,7 @@ import (
type ChannelStore struct {
world *object.World
byName map[string]*Channel
+ deleted map[string]Tombstone
}
type Channel struct {
@@ -23,8 +24,14 @@ type Channel struct {
Stream session.Stream
}
+type Tombstone struct {
+ name string
+}
+
func NewStore(world *object.World) *ChannelStore {
- return &ChannelStore {world, make(map[string]*Channel)}
+ return &ChannelStore {
+ world, make(map[string]*Channel), make(map[string]Tombstone),
+ }
}
func (cs *ChannelStore) CreateChannel(name string) (*Channel, *proto.Fail) {
@@ -139,6 +146,10 @@ func (c *Channel) Delete() {
}
delete(c.store.byName, c.name)
c.store.world.RemoveObject(c.id)
+
+ deleted := Tombstone {c.name}
+ c.store.deleted[c.id] = deleted
+ c.store.world.PutObject(c.id, deleted)
}
func (c *Channel) GetInfo() proto.Object {
@@ -146,3 +157,9 @@ func (c *Channel) GetInfo() proto.Object {
"channel", c.id, map[string]string {"": c.name},
}
}
+
+func (t Tombstone) GetInfo() proto.Object {
+ return proto.Object {
+ "deleted", "", map[string]string {"": t.name},
+ }
+}