diff options
author | viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-03 20:11:12 +0000 |
---|---|---|
committer | viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-03 20:11:12 +0000 |
commit | 790dc8a4bf326a7598fc41aa8c018e867edee33a (patch) | |
tree | 281aa0f14877734a92336a21355eb945a8d1517e /src/botserv.c | |
parent | 482a8aa766c9e1a96ff63b44ed319fe51588c35c (diff) |
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
Diffstat (limited to 'src/botserv.c')
-rw-r--r-- | src/botserv.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/botserv.c b/src/botserv.c index 57719a003..f8eea632e 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -757,25 +757,17 @@ static UserData *get_user_data(Channel * c, User * u) void bot_join(ChannelInfo * ci) { - int i; - if (!ci || !ci->c || !ci->bi) return; if (BSSmartJoin) { /* We check for bans */ - int count = ci->c->bancount; - if (count) { - char botmask[BUFSIZE]; + if (ci->c->bans && ci->c->bans->count) { char buf[BUFSIZE]; - char **bans = scalloc(sizeof(char *) * count, 1); char *av[4]; + Entry *ban, *next; int ac; - memcpy(bans, ci->c->bans, sizeof(char *) * count); - snprintf(botmask, sizeof(botmask), "%s!%s@%s", ci->bi->nick, - ci->bi->user, ci->bi->host); - if (ircdcap->tsmode) { snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL)); av[0] = ci->c->name; @@ -788,21 +780,16 @@ void bot_join(ChannelInfo * ci) ac = 3; } - for (i = 0; i < count; i++) { - if (match_wild_nocase(ci->c->bans[i], botmask)) { - anope_cmd_mode(ci->bi->nick, ci->name, "-b %s", - bans[i]); + for (ban = ci->c->bans->entries; ban; ban = next) { + next = ban->next; + if (entry_match(ban, ci->bi->nick, ci->bi->user, ci->bi->host, 0)) { + anope_cmd_mode(whosends(ci), ci->name, "-b %s", ban->mask); if (ircdcap->tsmode) - av[3] = sstrdup(bans[i]); + av[3] = ban->mask; else - av[2] = sstrdup(bans[i]); - - do_cmode(ci->bi->nick, ac, av); + av[2] = ban->mask; - if (ircdcap->tsmode) - free(av[3]); - else - free(av[2]); + do_cmode(whosends(ci), ac, av); } } @@ -810,8 +797,6 @@ void bot_join(ChannelInfo * ci) free(av[2]); else free(av[1]); - - free(bans); } /* Should we be invited? */ |