ChatChannelManager Class Reference

The chat channel manager takes care of registering and removing public and private chat channels. More...

#include <chatchannelmanager.hpp>

List of all members.

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.
ChatChannelgetChannel (int channelId)
 Returns the chat channel with the given channel ID.
ChatChannelgetChannel (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.


Detailed Description

The chat channel manager takes care of registering and removing public and private chat channels.

Every channel gets a unique channel ID.

Definition at line 35 of file chatchannelmanager.hpp.


Member Function Documentation

int ChatChannelManager::createNewChannel ( const std::string &  channelName,
const std::string &  channelAnnouncement,
const std::string &  channelPassword,
bool  joinable 
)

Create a new chat channel.

Returns:
the ID of the registered 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.

Returns:
true if created successfully, false otherwise.

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.

Returns:
a list of 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.

Returns:
the id of the channel, 0 if it was unsuccessful.

Definition at line 117 of file chatchannelmanager.cpp.

ChatChannel * ChatChannelManager::getChannel ( int  channelId  ) 

Returns the chat channel with the given channel ID.

Returns:
The chat channel, or NULL when it doesn't exist.

Definition at line 128 of file chatchannelmanager.cpp.

ChatChannel * ChatChannelManager::getChannel ( const std::string &  name  ) 

Returns the chat channel with the given channel name.

Returns:
The chat channel, or NULL when it doesn't exist.

Definition at line 135 of file chatchannelmanager.cpp.

void ChatChannelManager::removeUserFromAllChannels ( ChatClient user  ) 

Remove a user from all channels.

Used at logout.

See also:
ChatChannel::removeUserFromChannel

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.

Parameters:
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.

Parameters:
channelId a channel ID

Definition at line 176 of file chatchannelmanager.cpp.

Referenced by tryNewPublicChannel().


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5