From 17ab4104005cc5098d9152e6c90d54977222dd06 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 17 May 2010 20:33:28 -0400 Subject: Removed process_numlist and having to mark everything as "in use" and constantly checking it. Replaced with a better system. --- src/chanserv.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/chanserv.c') diff --git a/src/chanserv.c b/src/chanserv.c index 7f5602ed1..17dd65a7b 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -788,15 +788,15 @@ void cs_remove_nick(const NickCore * nc) { ca = ci->GetAccess(j - 1); - if (ca->in_use && ca->nc == nc) + if (ca->nc == nc) ci->EraseAccess(j - 1); } for (j = ci->GetAkickCount(); j > 0; --j) { akick = ci->GetAkick(j - 1); - if (akick->InUse && akick->HasFlag(AK_ISNICK) && akick->nc == nc) - ci->EraseAkick(akick); + if (akick->HasFlag(AK_ISNICK) && akick->nc == nc) + ci->EraseAkick(j - 1); } } } @@ -1054,6 +1054,22 @@ int get_access_level(ChannelInfo * ci, NickAlias * na) return access->level; } +int get_access_level(ChannelInfo *ci, NickCore *nc) +{ + if (!ci || !nc) + return 0; + + if (nc == ci->founder) + return ACCESS_FOUNDER; + + ChanAccess *access = ci->GetAccess(nc); + + if (!access) + return 0; + else + return access->level; +} + const char *get_xop_level(int level) { ChannelMode *halfop = ModeManager::FindChannelModeByName(CMODE_HALFOP); @@ -1091,7 +1107,7 @@ AutoKick *is_stuck(ChannelInfo * ci, const char *mask) { AutoKick *akick = ci->GetAkick(i); - if (!akick->InUse || akick->HasFlag(AK_ISNICK) || !akick->HasFlag(AK_STUCK)) + if (akick->HasFlag(AK_ISNICK) || !akick->HasFlag(AK_STUCK)) continue; if (Anope::Match(akick->mask, mask, false)) @@ -1146,7 +1162,7 @@ void stick_all(ChannelInfo * ci) { AutoKick *akick = ci->GetAkick(i); - if (!akick->InUse || (akick->HasFlag(AK_ISNICK) || !akick->HasFlag(AK_STUCK))) + if (akick->HasFlag(AK_ISNICK) || !akick->HasFlag(AK_STUCK)) continue; ci->c->SetMode(NULL, CMODE_BAN, akick->mask.c_str()); -- cgit