00001 /* $Id: room.hpp jjs $ */ 00002 /* 00003 Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl> 00004 Part of the Moros Project http://moros.sourceforge.net/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License. 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY. 00010 00011 See the COPYING file for more details. 00012 */ 00013 #ifndef __ROOM_H 00014 #define __ROOM_H 00015 00016 #include <map> 00017 00018 enum member_status { 00019 Status_none, 00020 Status_muted, 00021 Status_member, 00022 Status_moderator, 00023 Status_leader 00024 }; 00025 00027 00028 enum room_type { 00029 Room_open, 00030 Room_invitation, 00031 Room_private 00032 }; 00033 00034 00036 class room_member { 00037 public: 00039 class member *mem; 00041 int status; 00043 int time; 00044 00045 room_member() { 00046 mem=NULL; 00047 status=Status_none; 00048 time=0; 00049 } 00050 }; 00051 00053 00054 class room { 00055 public: 00057 std::string name; 00059 std::string description; 00060 int type; 00062 bool silenced; 00067 class member *leader; 00069 std::map<std::string, room_member> members; 00070 00071 room(std::string roomname="") { 00072 name = roomname; 00073 description = ""; 00074 type = Room_open; 00075 silenced = false; 00076 } 00077 00078 string state() { 00079 switch(type) { 00080 case Room_open: 00081 if (silenced) return "silenced"; 00082 return "open"; 00083 } 00084 return "INVITATION"; 00085 } 00086 }; 00087 00088 #endif // __ROOM_H