#include <chatchannel.hpp>
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. |
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.
Definition at line 41 of file chatchannel.hpp.
ChatChannel::ChatChannel | ( | int | id, | |
const std::string & | name, | |||
const std::string & | announcement = std::string() , |
|||
const std::string & | password = std::string() , |
|||
bool | joinable = true | |||
) |
Constructor.
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.
bool ChatChannel::addUser | ( | ChatClient * | user | ) |
Adds a user to the channel.
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.
Definition at line 71 of file chatchannel.cpp.
References ChatClient::channels, and ChatClient::userModes.