summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/cs_clear.c181
-rw-r--r--version.log3
2 files changed, 72 insertions, 112 deletions
diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c
index b1aaa81ee..70f01729d 100644
--- a/src/core/cs_clear.c
+++ b/src/core/cs_clear.c
@@ -194,38 +194,7 @@ int do_clear(User * u)
if (ircd->protect || ircd->admin) {
anope_cmd_svsmode_chan(av[0], ircd->adminunset, NULL);
}
- for (cu = c->users; cu; cu = next) {
- next = cu->next;
- isop = chan_has_user_status(c, cu->user, CUS_OP);
- isadmin = chan_has_user_status(c, cu->user, CUS_PROTECT);
- isown = chan_has_user_status(c, cu->user, CUS_OWNER);
- count = (isop ? 1 : 0) + (isadmin ? 1 : 0) + (isown ? 1 : 0);
-
- if (!isop && !isadmin && !isown)
- continue;
-
- snprintf(tmp, BUFSIZE, "-%s%s%s", (isop ? "o" : ""), (isadmin ?
- ircd->adminunset+1 : ""), (isown ? ircd->ownerunset+1 : ""));
-
- av[0] = chan; /* do_cmode can modify av[0] */
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
- av[1] = buf;
- av[2] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+3] = GET_USER(cu->user);
- ac = 3 + i;
- } else {
- av[1] = tmp;
- /* We have to give as much nicks as modes.. - Viper */
- for (i = 0; i < count; i++)
- av[i+2] = GET_USER(cu->user);
- ac = 2 + i;
- }
-
- do_cmode(s_ChanServ, ac, av);
- }
+ /* No need to do anything here - we will receive the mode changes from the IRCd and process them then */
} else {
for (cu = c->users; cu; cu = next) {
next = cu->next;
@@ -274,51 +243,46 @@ int do_clear(User * u)
char buf[BUFSIZE];
struct c_userlist *cu, *next;
- for (cu = c->users; cu; cu = next) {
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
- continue;
-
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
- av[0] = sstrdup(chan);
- av[1] = buf;
- av[2] = sstrdup("-h");
- av[3] = sstrdup(GET_USER(cu->user));
- ac = 4;
- } else {
- av[0] = sstrdup(chan);
- av[1] = sstrdup("-h");
- av[2] = sstrdup(GET_USER(cu->user));
- ac = 3;
- }
+ if (ircd->svsmode_ucmode) {
+ anope_cmd_svsmode_chan(chan, "-h", NULL);
+ /* No need to do anything here - we will receive the mode changes from the IRCd and process them then */
+ }
+ else {
+ for (cu = c->users; cu; cu = next) {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
+ continue;
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = sstrdup(chan);
+ av[1] = buf;
+ av[2] = sstrdup("-h");
+ av[3] = sstrdup(GET_USER(cu->user));
+ ac = 4;
+ } else {
+ av[0] = sstrdup(chan);
+ av[1] = sstrdup("-h");
+ av[2] = sstrdup(GET_USER(cu->user));
+ ac = 3;
+ }
- if (ircd->svsmode_ucmode) {
if (ircdcap->tsmode)
- anope_cmd_svsmode_chan(av[0], av[2], NULL);
+ anope_cmd_mode(whosends(ci), av[0], "%s %s", av[2], av[3]);
else
- anope_cmd_svsmode_chan(av[0], av[1], NULL);
+ anope_cmd_mode(whosends(ci), av[0], "%s %s", av[1], av[2]);
do_cmode(s_ChanServ, ac, av);
- break;
- } else {
- if (ircdcap->tsmode)
- anope_cmd_mode(whosends(ci), av[0], "%s %s", av[2],
- av[3]);
- else
- anope_cmd_mode(whosends(ci), av[0], "%s %s", av[1],
- av[2]);
- }
- do_cmode(s_ChanServ, ac, av);
- if (ircdcap->tsmode) {
- free(av[3]);
- free(av[2]);
- free(av[0]);
- } else {
- free(av[2]);
- free(av[1]);
- free(av[0]);
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ free(av[0]);
+ } else {
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
+ }
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_HOPS, chan);
@@ -328,52 +292,47 @@ int do_clear(User * u)
char buf[BUFSIZE];
struct c_userlist *cu, *next;
- for (cu = c->users; cu; cu = next) {
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_VOICE))
- continue;
-
- if (ircdcap->tsmode) {
- snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
- av[0] = sstrdup(chan);
- av[1] = buf;
- av[2] = sstrdup("-v");
- av[3] = sstrdup(GET_USER(cu->user));
- ac = 4;
- } else {
- av[0] = sstrdup(chan);
- av[1] = sstrdup("-v");
- av[2] = sstrdup(GET_USER(cu->user));
- ac = 3;
- }
+ if (ircd->svsmode_ucmode) {
+ anope_cmd_svsmode_chan(chan, "-v", NULL);
+ /* No need to do anything here - we will receive the mode changes from the IRCd and process them then */
+ }
+ else {
+ for (cu = c->users; cu; cu = next) {
+ next = cu->next;
+ if (!chan_has_user_status(c, cu->user, CUS_VOICE))
+ continue;
- if (ircd->svsmode_ucmode) {
- if (ircdcap->tsmode)
- anope_cmd_svsmode_chan(av[0], av[2], NULL);
- else
- anope_cmd_svsmode_chan(av[0], av[1], NULL);
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = sstrdup(chan);
+ av[1] = buf;
+ av[2] = sstrdup("-v");
+ av[3] = sstrdup(GET_USER(cu->user));
+ ac = 4;
+ } else {
+ av[0] = sstrdup(chan);
+ av[1] = sstrdup("-v");
+ av[2] = sstrdup(GET_USER(cu->user));
+ ac = 3;
+ }
- do_cmode(s_ChanServ, ac, av);
- break;
- } else {
if (ircdcap->tsmode) {
- anope_cmd_mode(whosends(ci), av[0], "%s %s", av[2],
- av[3]);
+ anope_cmd_mode(whosends(ci), av[0], "%s %s", av[2], av[3]);
} else {
- anope_cmd_mode(whosends(ci), av[0], "%s %s", av[1],
- av[2]);
+ anope_cmd_mode(whosends(ci), av[0], "%s %s", av[1], av[2]);
}
- }
- do_cmode(s_ChanServ, ac, av);
- if (ircdcap->tsmode) {
- free(av[3]);
- free(av[2]);
- free(av[0]);
- } else {
- free(av[2]);
- free(av[1]);
- free(av[0]);
+ do_cmode(s_ChanServ, ac, av);
+
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ free(av[0]);
+ } else {
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
+ }
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_VOICES, chan);
diff --git a/version.log b/version.log
index 4057d429f..666fc09e0 100644
--- a/version.log
+++ b/version.log
@@ -9,9 +9,10 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="4"
VERSION_EXTRA="-svn"
-VERSION_BUILD="2900"
+VERSION_BUILD="2903"
# $Log$ # Changes since the 1.8.4 Release
+#Revision 2903 - Removed some unnecessary redundant code in cs_clear
#Revision 2900 - Fixed /ns info to show when a nick expires to services opers, not only admins
#Revision 2899 - Fixed missing SID on FJOIN in InspIRCd12 protocol module
#Revision 2896 - Fixed bug #1153 - Always save channel topics internally, even if the new topic matches the last saved topic