#include <chatchannelmanager.hpp>
Public Member Functions | |
ChatChannelManager () | |
Constructor. | |
~ChatChannelManager () | |
Destructor. | |
int | createNewChannel (const std::string &channelName, const std::string &channelAnnouncement, const std::string &channelPassword, bool joinable) |
Create a new chat channel. | |
bool | tryNewPublicChannel (const std::string &name) |
Try to create a new public channel with the given name. | |
bool | removeChannel (int channelId) |
Remove a channel. | |
std::list< const ChatChannel * > | getPublicChannels () |
Returns a list containing all public channels. | |
int | getChannelId (const std::string &channelName) |
Get the id of a channel from its name. | |
ChatChannel * | getChannel (int channelId) |
Returns the chat channel with the given channel ID. | |
ChatChannel * | getChannel (const std::string &name) |
Returns the chat channel with the given channel name. | |
void | removeUserFromAllChannels (ChatClient *) |
Remove a user from all channels. | |
void | setChannelTopic (int channelId, const std::string &name) |
Set the topic of a channel. | |
bool | channelExists (int channelId) |
Returns whether a channel exists. | |
bool | channelExists (const std::string &channelName) |
int | nextUsable () |
Get next usable channel ID. |
Every channel gets a unique channel ID.
Definition at line 35 of file chatchannelmanager.hpp.
int ChatChannelManager::createNewChannel | ( | const std::string & | channelName, | |
const std::string & | channelAnnouncement, | |||
const std::string & | channelPassword, | |||
bool | joinable | |||
) |
Create a new chat channel.
Definition at line 44 of file chatchannelmanager.cpp.
References nextUsable().
Referenced by tryNewPublicChannel().
bool ChatChannelManager::tryNewPublicChannel | ( | const std::string & | name | ) |
Try to create a new public channel with the given name.
Definition at line 61 of file chatchannelmanager.cpp.
References channelExists(), createNewChannel(), GuildManager::doesExist(), utils::StringFilter::filterContent(), and utils::StringFilter::findDoubleQuotes().
std::list< const ChatChannel * > ChatChannelManager::getPublicChannels | ( | ) |
Returns a list containing all public channels.
Definition at line 100 of file chatchannelmanager.cpp.
int ChatChannelManager::getChannelId | ( | const std::string & | channelName | ) |
Get the id of a channel from its name.
Definition at line 117 of file chatchannelmanager.cpp.
ChatChannel * ChatChannelManager::getChannel | ( | int | channelId | ) |
Returns the chat channel with the given channel ID.
Definition at line 128 of file chatchannelmanager.cpp.
ChatChannel * ChatChannelManager::getChannel | ( | const std::string & | name | ) |
Returns the chat channel with the given channel name.
Definition at line 135 of file chatchannelmanager.cpp.
void ChatChannelManager::removeUserFromAllChannels | ( | ChatClient * | user | ) |
Remove a user from all channels.
Used at logout.
Definition at line 161 of file chatchannelmanager.cpp.
References ChatClient::channels, ChatClient::characterName, and ChatHandler::warnUsersAboutPlayerEventInChat().
Referenced by ChatHandler::computerDisconnected().
void ChatChannelManager::setChannelTopic | ( | int | channelId, | |
const std::string & | name | |||
) |
Set the topic of a channel.
topic | the new topic of the given channel |
Definition at line 149 of file chatchannelmanager.cpp.
References ChatHandler::warnUsersAboutPlayerEventInChat().
bool ChatChannelManager::channelExists | ( | int | channelId | ) |
Returns whether a channel exists.
channelId | a channel ID |
Definition at line 176 of file chatchannelmanager.cpp.
Referenced by tryNewPublicChannel().