ChatChannel Class Reference

A chat channel. More...

#include <chatchannel.hpp>

List of all members.

Public Types

typedef std::vector< ChatClient * > ChannelUsers

Public Member Functions

 ChatChannel (int id, const std::string &name, const std::string &announcement=std::string(), const std::string &password=std::string(), bool joinable=true)
 Constructor.
int getId () const
 Get the ID of the channel.
const std::string & getName () const
 Get the name of the channel.
const std::string & getAnnouncement () const
 Get the announcement string of the channel.
const std::string & getPassword () const
 Get the password of the channel.
void setName (const std::string &channelName)
 Sets the name of the channel.
void setAnnouncement (const std::string &channelAnnouncement)
 Sets the announcement string of the channel.
void setPassword (const std::string &channelPassword)
 Sets the password of the channel.
const ChannelUsers & getUserList () const
 Gets the list of the users registered in the channel.
bool addUser (ChatClient *)
 Adds a user to the channel.
bool removeUser (ChatClient *)
 Removes a user from the channel.
void removeAllUsers ()
 Empties a channel from its users (admin included).
bool canJoin () const
 Get whether a user can join this channel.
void setUserMode (ChatClient *, unsigned char mode)
 Set user mode.
std::string getUserMode (ChatClient *)
 Get user mode.


Detailed Description

A chat channel.

Optionally a channel is private, in which case a password is required to join it.

No logic is currently associated with a chat channel except for making sure that no user joins the channel twice and checking that a user who leaves actually existed in the channel.

Todo:
b_lindeijer: It would be nicer when some more logic could be placed in this class to remove some weight from the ChatHandler.

Definition at line 41 of file chatchannel.hpp.


Constructor & Destructor Documentation

ChatChannel::ChatChannel ( int  id,
const std::string &  name,
const std::string &  announcement = std::string(),
const std::string &  password = std::string(),
bool  joinable = true 
)

Constructor.

Parameters:
name the name of the channel.
announcement a welcome message.
password password (for private channels).
privacy whether this channel is private.

Definition at line 28 of file chatchannel.cpp.


Member Function Documentation

bool ChatChannel::addUser ( ChatClient user  ) 

Adds a user to the channel.

Returns:
whether the user was successfully added

Definition at line 41 of file chatchannel.cpp.

References ChatClient::channels, ChatClient::characterName, and setUserMode().

bool ChatChannel::removeUser ( ChatClient user  ) 

Removes a user from the channel.

Returns:
whether the user was successfully removed

Definition at line 71 of file chatchannel.cpp.

References ChatClient::channels, and ChatClient::userModes.


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