ChatRoom* ChatManagerImplementation::createRoomByFullPath(const String& path) { StringTokenizer tokenizer(path); tokenizer.setDelimeter("."); String game; tokenizer.getStringToken(game); ChatRoom* gameRoom = getGameRoom(game); if (gameRoom == NULL) return NULL; String channel; ChatRoom* room = gameRoom; while (tokenizer.hasMoreTokens()) { tokenizer.getStringToken(channel); if (room->getSubRoom(channel) == NULL) break; else room = room->getSubRoom(channel); } if (room == gameRoom) return NULL; if (room->isPrivate()) return NULL; ChatRoom* newRoom = createRoom(channel, room); room->addSubRoom(newRoom); return newRoom; }
ChatRoom* ChatManagerImplementation::getChatRoomByGamePath(ChatRoom* game, const String& path) { StringTokenizer tokenizer(path); tokenizer.setDelimeter("."); String channel; ChatRoom* room = game; while (tokenizer.hasMoreTokens()) { tokenizer.getStringToken(channel); room = room->getSubRoom(channel); if (room == NULL) return NULL; } if (room == game) return NULL; else return room; }