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 /src/botserv.c | |
| 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 'src/botserv.c')
| -rw-r--r-- | src/botserv.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/src/botserv.c b/src/botserv.c index 855797ef1..25bebaed3 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -572,38 +572,31 @@ static BanData *get_ban_data(Channel * c, User * u) * Allocates it if necessary. */ -static UserData *get_user_data(Channel * c, User * u) +static UserData *get_user_data(Channel *c, User *u) { - struct c_userlist *user; - if (!c || !u) return NULL; - for (user = c->users; user; user = user->next) { - if (user->user == u) { - if (user->ud) { - time_t now = time(NULL); - - /* Checks whether data is obsolete */ - if (now - user->ud->last_use > Config.BSKeepData) { - if (user->ud->lastline) - delete [] user->ud->lastline; - /* We should not free and realloc, but reset to 0 - instead. */ - memset(user->ud, 0, sizeof(UserData)); - user->ud->last_use = now; - } + for (CUserList::iterator it = c->users.begin(); it != c->users.end(); ++it) + { + UserContainer *uc = *it; - return user->ud; - } else { - user->ud = new UserData; - user->ud->last_use = time(NULL); - user->ud->lines = 0; - user->ud->last_start = 0; - user->ud->lastline = NULL; - user->ud->times = 0; - return user->ud; + if (uc->user == u) + { + time_t now = time(NULL); + + /* Checks whether data is obsolete */ + if (now - uc->ud->last_use > Config.BSKeepData) + { + if (uc->ud->lastline) + delete [] uc->ud->lastline; + /* We should not free and realloc, but reset to 0 + instead. */ + memset(uc->ud, 0, sizeof(UserData)); + uc->ud->last_use = now; } + + return uc->ud; } } @@ -646,7 +639,7 @@ void bot_join(ChannelInfo * ci) /* Should we be invited? */ if (ci->c->HasMode(CMODE_INVITE) - || (limit && ci->c->usercount >= limit)) + || (limit && ci->c->users.size() >= limit)) ircdproto->SendNoticeChanops(ci->bi, ci->c, "%s invited %s into the channel.", ci->bi->nick.c_str(), ci->bi->nick.c_str()); |
