diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-03 16:29:11 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-06-03 16:29:11 +0000 |
commit | 0fdbf1d62c1add8800ffc7171a1911e1e243ac2a (patch) | |
tree | c22e6d658d908d3050cfe3dd5970f356e28aa465 /src/channel.h | |
parent | d4e8401e55c7bc3f5c8545b66167e8c3bf3cd380 (diff) | |
download | mana-0fdbf1d62c1add8800ffc7171a1911e1e243ac2a.tar.gz mana-0fdbf1d62c1add8800ffc7171a1911e1e243ac2a.tar.bz2 mana-0fdbf1d62c1add8800ffc7171a1911e1e243ac2a.tar.xz mana-0fdbf1d62c1add8800ffc7171a1911e1e243ac2a.zip |
channel announcements and leave / enter messages, chat code refactoring
Diffstat (limited to 'src/channel.h')
-rw-r--r-- | src/channel.h | 72 |
1 files changed, 63 insertions, 9 deletions
diff --git a/src/channel.h b/src/channel.h index ea6789ee..9f7557c1 100644 --- a/src/channel.h +++ b/src/channel.h @@ -27,15 +27,69 @@ class Channel { public: - Channel(short id); - std::string getName() const; - void setName(const std::string &channelName); - int getId() const { return mID; } - int getUserListSize() const; - std::string getUser(unsigned int i) const; + + typedef std::vector<std::string> ChannelUsers; + + /** + * Constructor. + * + * @param id the id associated with the channel. + * @param name the name of the channel. + * @param announcement a welcome message. + */ + Channel(short id, + const std::string &name, + const std::string &announcement = std::string()); + + /** + * Get the id associated witht his channel + */ + int getId() const { return mId; } + + /** + * Get this channel's name + */ + const std::string& getName() const + { return mName; } + + /** + * Get the announcement message for this channel + */ + const std::string& getAnnouncement() const + { return mAnnouncement; } + + /** + * Get the list of users in this channel + */ + const ChannelUsers& getUserList() const + { return mUserList; } + + /** + * Sets the name of the channel. + */ + void setName(const std::string &channelName) + { mName = channelName; } + + /** + * Sets the announcement string of the channel. + */ + void setAnnouncement(const std::string &channelAnnouncement) + { mAnnouncement = channelAnnouncement; } + + /** + * Adds a user to this channel. + */ + void addUser(const std::string &user); + + /** + * Removes a user from the channel. + */ + void removeUser(const std::string &user); + private: - typedef std::vector<std::string> Users; + + unsigned short mId; std::string mName; - short mID; - Users userList; + std::string mAnnouncement; + ChannelUsers mUserList; }; |