00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _TMWSERV_CHATCHANNELHANDLER_H_
00025 #define _TMWSERV_CHATCHANNELHANDLER_H_
00026
00027 #include <map>
00028
00029 #include "chat-server/chatchannel.hpp"
00030
00031 class ChatChannelManager {
00032
00033 public:
00034
00038 ChatChannelManager();
00039
00043 ~ChatChannelManager();
00044
00051 short registerPublicChannel(const std::string& channelName,
00052 const std::string& channelAnnouncement,
00053 const std::string& channelPassword);
00054
00061 short registerPrivateChannel(const std::string& channelName,
00062 const std::string& channelAnnouncement,
00063 const std::string& channelPassword);
00064
00068 bool removeChannel(short channelId);
00069
00075 std::string getPublicChannelNames(short *numChannels);
00076
00082 short getNumberOfChannelUsers(const std::string &channelName);
00083
00090 short getChannelId(const std::string& channelName);
00091
00097 std::string getChannelName(short channelId);
00098
00104 std::string getChannelAnnouncement(short channelId);
00105
00111 bool setChannelAnnouncement(short channelId, std::string const &channelAnnouncement);
00112
00118 bool setChannelPassword(short channelId, const std::string& channelPassword);
00119
00125 std::string getChannelPassword(short channelId);
00126
00132 bool getChannelPrivacy(short channelId);
00133
00139 ChatChannel _getChannel(short channelId);
00140
00144 bool addUserInChannel(std::string const &, short channelId);
00145
00149 bool removeUserFromChannel(std::string const &, short channelId);
00150
00155 void removeUserFromEveryChannels(std::string const &);
00156
00160 std::vector< std::string > const &getUserListInChannel(short channelId);
00161
00165 bool isChannelRegistered(short channelId);
00166
00167 private:
00168
00174 std::map<short, ChatChannel> mChatChannels;
00175
00176 };
00177
00178 extern ChatChannelManager *chatChannelManager;
00179
00180 #endif