summaryrefslogtreecommitdiff
path: root/src/chanserv.c
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-04-21 11:19:52 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-04-21 11:19:52 +0000
commitab0dc81bc28f0802dc80e6848d3f813baef28f2e (patch)
tree0d374642fcec755c172368fc476985b50bca72b0 /src/chanserv.c
parentdf8e1b5f39359de9003918f7c3beace9070e71c9 (diff)
BUILD : 1.7.18 (1237) BUGS : 661 NOTES : Fixed DefCon which did not force DefConChanModes when it was enabled
git-svn-id: svn://svn.anope.org/anope/trunk@1237 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@956 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/chanserv.c')
-rw-r--r--src/chanserv.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/chanserv.c b/src/chanserv.c
index 6add49727..ac82b8edf 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -1072,7 +1072,12 @@ void save_cs_rdb_dbase(void)
/*************************************************************************/
/* Check the current modes on a channel; if they conflict with a mode lock,
- * fix them. */
+ * fix them.
+ *
+ * Also check to make sure that every mode set or unset is allowed by the
+ * defcon mlock settings. This is more important than any normal channel
+ * mlock'd mode. --gdex (21-04-07)
+ */
void check_modes(Channel * c)
{
@@ -1109,6 +1114,7 @@ void check_modes(Channel * c)
}
c->chanserv_modecount++;
+ /* Check if the channel is registered; if not remove mode -r */
if (!(ci = c->ci)) {
if (ircd->regmode) {
if (c->mode & ircd->regmode) {
@@ -1119,8 +1125,14 @@ void check_modes(Channel * c)
return;
}
+ /* Initialize te modes-var to set all modes not set yet but which should
+ * be set as by mlock and defcon.
+ */
modes = ~c->mode & ci->mlock_on;
+ if (DefConModesSet)
+ modes |= (~c->mode & DefConModesOn);
+ /* Initialize the buffers */
*end++ = '+';
cbmi = cbmodeinfos;
@@ -1131,7 +1143,12 @@ void check_modes(Channel * c)
/* Add the eventual parameter and modify the Channel structure */
if (cbmi->getvalue && cbmi->csgetvalue) {
- char *value = cbmi->csgetvalue(ci);
+ char *value;
+ /* Check if it's a defcon or mlock mode */
+ if (DefConModesOn & cbmi->flag)
+ value = cbmi->csgetvalue(&DefConModesCI);
+ else
+ value = cbmi->csgetvalue(ci);
cbm = &cbmodes[(int) cbmi->mode];
cbm->setvalue(c, value);
@@ -1143,10 +1160,17 @@ void check_modes(Channel * c)
}
}
} else if (cbmi->getvalue && cbmi->csgetvalue
- && (ci->mlock_on & cbmi->flag)
+ && ((ci->mlock_on & cbmi->flag)
+ || (DefConModesOn & cbmi->flag))
&& (c->mode & cbmi->flag)) {
char *value = cbmi->getvalue(c);
- char *csvalue = cbmi->csgetvalue(ci);
+ char *csvalue;
+
+ /* Check if it's a defcon or mlock mode */
+ if (DefConModesOn & cbmi->flag)
+ csvalue = cbmi->csgetvalue(&DefConModesCI);
+ else
+ csvalue = cbmi->csgetvalue(ci);
/* Lock and actual values don't match, so fix the mode */
if (value && csvalue && strcmp(value, csvalue)) {
@@ -1166,6 +1190,8 @@ void check_modes(Channel * c)
end--;
modes = c->mode & ci->mlock_off;
+ if (DefConModesSet)
+ modes |= (~c->mode & DefConModesOff);
if (modes) {
*end++ = '-';