summaryrefslogtreecommitdiff
path: root/modules/commands/cs_updown.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-04-07 23:46:44 -0500
committerAdam <Adam@anope.org>2013-04-07 23:46:44 -0500
commitfb7fef7a849342ab8463743497e781c5c3e6ae88 (patch)
tree5d230a68b6eed70c7b4f718410dd62fea779654c /modules/commands/cs_updown.cpp
parent36602224b8b1a11326a224779d16bcb12f0ed532 (diff)
Optimizations of much of the more commonly used code
Diffstat (limited to 'modules/commands/cs_updown.cpp')
-rw-r--r--modules/commands/cs_updown.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp
index 27e1984d1..ecce1e51d 100644
--- a/modules/commands/cs_updown.cpp
+++ b/modules/commands/cs_updown.cpp
@@ -30,7 +30,7 @@ class CommandCSUp : public Command
return;
for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
{
- Channel *c = (*it)->chan;
+ Channel *c = it->second->chan;
c->SetCorrectModes(source.GetUser(), true, false);
}
}
@@ -87,13 +87,10 @@ class CommandCSDown : public Command
{
void RemoveAll(User *u, Channel *c)
{
- for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- {
- ChannelMode *cm = ModeManager::ChannelModes[i];
-
- if (cm != NULL && cm->type == MODE_STATUS)
- c->RemoveMode(NULL, cm, u->nick);
- }
+ ChanUserContainer *cu = c->FindUser(u);
+ if (cu != NULL)
+ for (size_t i = 0; i < cu->status.Modes().length(); ++i)
+ c->RemoveMode(NULL, ModeManager::FindChannelModeByChar(cu->status.Modes()[i]), u->GetUID());
}
public:
@@ -111,7 +108,7 @@ class CommandCSDown : public Command
return;
for (User::ChanUserList::iterator it = source.GetUser()->chans.begin(); it != source.GetUser()->chans.end(); ++it)
{
- Channel *c = (*it)->chan;
+ Channel *c = it->second->chan;
RemoveAll(source.GetUser(), c);
}
}