summaryrefslogtreecommitdiff
path: root/src/core/cs_clear.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-21 06:31:17 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-21 06:31:17 +0000
commit0ed0fa4af62554a7281d403b6895b29e198e8186 (patch)
tree4b0509084ef8181790f19c258c3bc1f5e38b80cc /src/core/cs_clear.c
parent15817208aae1c80e2b03668981ac9268d6a02dde (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/core/cs_clear.c')
-rw-r--r--src/core/cs_clear.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c
index 5f95e0cdc..0e8312f37 100644
--- a/src/core/cs_clear.c
+++ b/src/core/cs_clear.c
@@ -71,8 +71,6 @@ class CommandCSClear : public Command
}
else if (what == "ops")
{
- int isop, isadmin, isown;
-
if (ircd->svsmode_ucmode)
{
ircdproto->SendSVSModeChan(c, "-o", NULL);
@@ -94,18 +92,11 @@ class CommandCSClear : public Command
{
UserContainer *uc = *it;
- isop = chan_has_user_status(c, uc->user, CUS_OP);
- isadmin = chan_has_user_status(c, uc->user, CUS_PROTECT);
- isown = chan_has_user_status(c, uc->user, CUS_OWNER);
-
- if (!isop && !isadmin && !isown)
- continue;
-
- if (isown)
+ if (uc->Status->HasFlag(CMODE_OWNER))
c->RemoveMode(NULL, CMODE_OWNER, uc->user->nick);
- if (admin)
+ if (uc->Status->HasFlag(CMODE_PROTECT))
c->RemoveMode(NULL, CMODE_PROTECT, uc->user->nick);
- if (isop)
+ if (uc->Status->HasFlag(CMODE_OP))
c->RemoveMode(NULL, CMODE_OP, uc->user->nick);
}
}
@@ -115,18 +106,11 @@ class CommandCSClear : public Command
{
UserContainer *uc = *it;
- isop = chan_has_user_status(c, uc->user, CUS_OP);
- isadmin = chan_has_user_status(c, uc->user, CUS_PROTECT);
- isown = chan_has_user_status(c, uc->user, CUS_OWNER);
-
- if (!isop && !isadmin && !isown)
- continue;
-
- if (isown)
+ if (uc->Status->HasFlag(CMODE_OWNER))
c->RemoveMode(NULL, CMODE_OWNER, uc->user->nick);
- if (isadmin)
+ if (uc->Status->HasFlag(CMODE_PROTECT))
c->RemoveMode(NULL, CMODE_PROTECT, uc->user->nick);
- if (isop)
+ if (uc->Status->HasFlag(CMODE_OP))
c->RemoveMode(NULL, CMODE_OP, uc->user->nick);
}
}
@@ -139,10 +123,8 @@ class CommandCSClear : public Command
{
UserContainer *uc = *it;
- if (!chan_has_user_status(c, uc->user, CUS_HALFOP))
- continue;
-
- c->RemoveMode(NULL, CMODE_HALFOP, uc->user->nick);
+ if (uc->Status->HasFlag(CMODE_HALFOP))
+ c->RemoveMode(NULL, CMODE_HALFOP, uc->user->nick);
}
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_HOPS, chan);
@@ -153,10 +135,8 @@ class CommandCSClear : public Command
{
UserContainer *uc = *it;
- if (!chan_has_user_status(c, uc->user, CUS_VOICE))
- continue;
-
- c->RemoveMode(NULL, CMODE_VOICE, uc->user->nick);
+ if (uc->Status->HasFlag(CMODE_VOICE))
+ c->RemoveMode(NULL, CMODE_VOICE, uc->user->nick);
}
notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_VOICES, chan);