diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-16 06:57:14 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-16 06:57:14 +0000 |
| commit | ff13d00eb50a228e05c4c37b0757082ca8bc9e4a (patch) | |
| tree | 9e3c000e91963de7c696bb3733fbb33a994a445b /include/channels.h | |
| parent | aaf1cefd1c34e08d68725d459cab02128daf72e6 (diff) | |
Removed c_userlist and u_chanlist, replaced with std::list
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2764 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include/channels.h')
| -rw-r--r-- | include/channels.h | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/include/channels.h b/include/channels.h index 0cd1829e2..3baae9f1b 100644 --- a/include/channels.h +++ b/include/channels.h @@ -9,6 +9,39 @@ * */ +struct UserData +{ + UserData() + { + lastline = NULL; + last_use = time(NULL); + } + + virtual ~UserData() { delete [] lastline; } + + /* Data validity */ + time_t last_use; + + /* for flood kicker */ + int16 lines; + time_t last_start; + + /* for repeat kicker */ + char *lastline; + int16 times; +}; + +struct UserContainer +{ + User *user; + UserData *ud; + + UserContainer(User *u) : user(u) { ud = new UserData; } + virtual ~UserContainer() { delete ud; } +}; + +typedef std::list<UserContainer *> CUserList; + enum ChannelFlags { /* Channel still exists when emptied */ @@ -24,6 +57,9 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> */ std::map<ChannelModeName, std::string> Params; + /* Modes set on the channel */ + std::bitset<128> modes; + public: /** Default constructor * @param name The channel name @@ -42,14 +78,13 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> char *topic; std::string topic_setter; time_t topic_time; /* When topic was set */ - std::bitset<128> modes; EList *bans; EList *excepts; EList *invites; - struct c_userlist *users; - uint16 usercount; + /* List of users in the channel */ + CUserList users; BanData *bd; @@ -74,8 +109,12 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> */ void DeleteUser(User *u); - /** - * See if a channel has a mode + /** See if the channel has any modes at all + * @return true or false + */ + inline const bool HasModes() const { return modes.count(); } + + /** See if a channel has a mode * @param Name The mode name * @return true or false */ |
