diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-21 06:31:17 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-21 06:31:17 +0000 |
| commit | 0ed0fa4af62554a7281d403b6895b29e198e8186 (patch) | |
| tree | 4b0509084ef8181790f19c258c3bc1f5e38b80cc /src/users.c | |
| parent | 15817208aae1c80e2b03668981ac9268d6a02dde (diff) | |
Rewrote how Anope stores channel status modes on users.
This allows 3rd party modules to add and track their own status mode.
Additionally we now store a users status in both the UserContainer and ChannelContainer.
This also fixes the ModeStacker to not send any mode strings unnecessarially and shuffles some code
around so we don't have to manually remove channels from users lists everywhere.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2775 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/users.c')
| -rw-r--r-- | src/users.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/users.c b/src/users.c index a1f9fb05c..c67d1a762 100644 --- a/src/users.c +++ b/src/users.c @@ -272,10 +272,7 @@ User::~User() while (!this->chans.empty()) { - ChannelContainer *cc = this->chans.front(); - cc->chan->DeleteUser(this); - delete cc; - this->chans.pop_front(); + this->chans.front()->chan->DeleteUser(this); } /* Cancel pending nickname enforcers, etc */ @@ -609,13 +606,26 @@ void User::SetModes(BotInfo *bi, const char *modes, ...) else this->SetMode(bi, um); } - else if (add == 0) + else { this->RemoveMode(bi, um); } } } +/** Find the channel container for Channel c that the user is on + * This is preferred over using FindUser in Channel, as there are usually more users in a channel + * than channels a user is in + * @param c The channel + * @return The channel container, or NULL + */ +ChannelContainer *User::FindChannel(Channel *c) +{ + for (UChannelList::iterator it = this->chans.begin(); it != this->chans.end(); ++it) + if ((*it)->chan == c) + return *it; + return NULL; +} /*************************************************************************/ |
