1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 17:03:13 +02:00

BUILD : 1.7.21 (1426) BUGS : 876 NOTES : We now support CIDR in channel ban/invite/except lists. Introduces new CIDR capable generic lists system.

git-svn-id: svn://svn.anope.org/anope/trunk@1426 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1141 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b
2008-09-03 20:11:12 +00:00
parent 482a8aa766
commit 790dc8a4bf
30 changed files with 861 additions and 353 deletions
+35 -46
View File
@@ -85,65 +85,54 @@ int do_clear(User * u)
notice_lang(s_ChanServ, u, PERMISSION_DENIED);
} else if (stricmp(what, "bans") == 0) {
char *av[2];
int i;
Entry *ban, *next;
/* Save original ban info */
int count = c->bancount;
char **bans = scalloc(sizeof(char *) * count, 1);
for (i = 0; i < count; i++)
bans[i] = sstrdup(c->bans[i]);
for (i = 0; i < count; i++) {
av[0] = sstrdup("-b");
av[1] = bans[i];
anope_cmd_mode(whosends(ci), chan, "%s %s", av[0], av[1]);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[1]);
free(av[0]);
if (c->bans && c->bans->count) {
for (ban = c->bans->entries; ban; ban = next) {
next = ban->next;
av[0] = sstrdup("-b");
av[1] = sstrdup(ban->mask);
anope_cmd_mode(whosends(ci), chan, "-b %s", ban->mask);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[0]);
free(av[1]);
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_BANS, chan);
free(bans);
} else if (ircd->except && stricmp(what, "excepts") == 0) {
char *av[2];
int i;
Entry *except, *next;
/* Save original except info */
int count = c->exceptcount;
char **excepts = scalloc(sizeof(char *) * count, 1);
for (i = 0; i < count; i++)
excepts[i] = sstrdup(c->excepts[i]);
for (i = 0; i < count; i++) {
av[0] = sstrdup("-e");
av[1] = excepts[i];
anope_cmd_mode(whosends(ci), chan, "%s %s", av[0], av[1]);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[1]);
free(av[0]);
if (c->excepts && c->excepts->count) {
for (except = c->excepts->entries; except; except = next) {
next = except->next;
av[0] = sstrdup("-e");
av[1] = sstrdup(except->mask);
anope_cmd_mode(whosends(ci), chan, "-e %s", except->mask);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[0]);
free(av[1]);
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_EXCEPTS, chan);
free(excepts);
} else if (ircd->invitemode && stricmp(what, "invites") == 0) {
char *av[2];
int i;
Entry *invite, *next;
/* Save original except info */
int count = c->invitecount;
char **invites = scalloc(sizeof(char *) * count, 1);
for (i = 0; i < count; i++)
invites[i] = sstrdup(c->invite[i]);
for (i = 0; i < count; i++) {
av[0] = sstrdup("-I");
av[1] = invites[i];
anope_cmd_mode(whosends(ci), chan, "%s %s", av[0], av[1]);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[1]);
free(av[0]);
if (c->invites && c->invites->count) {
for (invite = c->invites->entries; invite; invite = next) {
next = invite->next;
av[0] = sstrdup("-I");
av[1] = sstrdup(invite->mask);
anope_cmd_mode(whosends(ci), chan, "-I %s", invite->mask);
chan_set_modes(whosends(ci), c, 2, av, 0);
free(av[0]);
free(av[1]);
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_INVITES, chan);
free(invites);
} else if (stricmp(what, "modes") == 0) {
char *argv[2];
@@ -189,7 +178,7 @@ int do_clear(User * u)
}
check_modes(c);
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_MODES, chan);
} else if (stricmp(what, "ops") == 0) {
char *av[4];
+25 -54
View File
@@ -75,13 +75,8 @@ int do_clearmodes(User * u)
char *chan = strtok(NULL, " ");
Channel *c;
int all = 0;
int count; /* For saving ban info */
char **bans; /* For saving ban info */
int exceptcount; /* For saving except info */
char **excepts; /* For saving except info */
int invitecount; /* For saving invite info */
char **invites; /* For saving invite info */
struct c_userlist *cu, *next;
Entry *entry, *nexte;
if (!chan) {
syntax_error(s_OperServ, u, "CLEARMODES", OPER_CLEARMODES_SYNTAX);
@@ -286,67 +281,43 @@ int do_clearmodes(User * u)
}
/* Clear bans */
count = c->bancount;
bans = scalloc(sizeof(char *) * count, 1);
for (i = 0; i < count; i++)
bans[i] = sstrdup(c->bans[i]);
for (i = 0; i < count; i++) {
argv[0] = sstrdup("-b");
argv[1] = bans[i];
anope_cmd_mode(s_OperServ, c->name, "-b %s", argv[1]);
chan_set_modes(s_OperServ, c, 2, argv, 0);
free(argv[1]);
free(argv[0]);
if (c->bans && c->bans->count) {
for (entry = c->bans->entries; entry; entry = nexte) {
nexte = entry->next;
argv[0] = sstrdup("-b");
argv[1] = sstrdup(entry->mask);
anope_cmd_mode(s_OperServ, c->name, "-b %s", entry->mask);
chan_set_modes(s_OperServ, c, 2, argv, 0);
free(argv[0]);
free(argv[1]);
}
}
free(bans);
excepts = NULL;
if (ircd->except) {
/* Clear excepts */
exceptcount = c->exceptcount;
excepts = scalloc(sizeof(char *) * exceptcount, 1);
for (i = 0; i < exceptcount; i++)
excepts[i] = sstrdup(c->excepts[i]);
for (i = 0; i < exceptcount; i++) {
/* Clear excepts */
if (ircd->except && c->excepts && c->excepts->count) {
for (entry = c->excepts->entries; entry; entry = nexte) {
nexte = entry->next;
argv[0] = sstrdup("-e");
argv[1] = excepts[i];
anope_cmd_mode(s_OperServ, c->name, "-e %s", argv[1]);
argv[1] = sstrdup(entry->mask);
anope_cmd_mode(s_OperServ, c->name, "-e %s", entry->mask);
chan_set_modes(s_OperServ, c, 2, argv, 0);
free(argv[1]);
free(argv[0]);
}
if (excepts) {
free(excepts);
free(argv[1]);
}
}
if (ircd->invitemode) {
/* Clear invites */
invitecount = c->invitecount;
invites = scalloc(sizeof(char *) * invitecount, 1);
for (i = 0; i < invitecount; i++)
invites[i] = sstrdup(c->invite[i]);
for (i = 0; i < invitecount; i++) {
/* Clear invites */
if (ircd->invitemode && c->invites && c->invites->count) {
for (entry = c->invites->entries; entry; entry = nexte) {
nexte = entry->next;
argv[0] = sstrdup("-I");
argv[1] = invites[i];
anope_cmd_mode(s_OperServ, c->name, "-I %s", argv[1]);
argv[1] = sstrdup(entry->mask);
anope_cmd_mode(s_OperServ, c->name, "-I %s", entry->mask);
chan_set_modes(s_OperServ, c, 2, argv, 0);
free(argv[1]);
free(argv[0]);
free(argv[1]);
}
free(invites);
}
}
if (all) {