func addRoom(env cells.Environment, buildingName string, roomName string) { r := newRoom(roomName, buildingName, []string{"hell"}) roomID := identifier.Identifier("room", buildingName, roomName) env.StartCell(roomID, r) paID := identifier.Identifier("building", buildingName, "pa") subscribe(env, paID, roomID) env.EmitNew(identifier.Identifier("building", buildingName), ROOM_ADDED, cells.PayloadValues{ "room": roomID, }, nil) }
func addLogUser(env cells.Environment, buildingName string, roomName string) { roomID := identifier.Identifier("room", buildingName, roomName) userID := makeUserID("logger") lu := &logUser{} lu.name = "logger" env.StartCell(userID, lu) subscribe(env, roomID, userID) env.EmitNew(roomID, "user-added", cells.PayloadValues{ "user": userID, }, nil) }
func addUser(env cells.Environment, buildingName string, roomName string, userName string) string { roomID := identifier.Identifier("room", buildingName, roomName) userID := makeUserID(userName) u := newUser(userName) env.StartCell(userID, u) subscribe(env, roomID, userID) env.EmitNew(roomID, USER_ADDED, cells.PayloadValues{ "user": userID, }, nil) return userID }