diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-21 06:31:17 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-21 06:31:17 +0000 |
| commit | 0ed0fa4af62554a7281d403b6895b29e198e8186 (patch) | |
| tree | 4b0509084ef8181790f19c258c3bc1f5e38b80cc /src/botserv.c | |
| parent | 15817208aae1c80e2b03668981ac9268d6a02dde (diff) | |
Rewrote how Anope stores channel status modes on users.
This allows 3rd party modules to add and track their own status mode.
Additionally we now store a users status in both the UserContainer and ChannelContainer.
This also fixes the ModeStacker to not send any mode strings unnecessarially and shuffles some code
around so we don't have to manually remove channels from users lists everywhere.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2775 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/botserv.c')
| -rw-r--r-- | src/botserv.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/botserv.c b/src/botserv.c index 25bebaed3..74066fe9a 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -132,16 +132,14 @@ void botmsgs(User * u, BotInfo * bi, char *buf) void botchanmsgs(User * u, ChannelInfo * ci, char *buf) { int c; - int16 cstatus = 0; char *cmd; UserData *ud; bool was_action = false; Command *command; std::string bbuf; - if (!u || !buf || !ci) { + if (!u || !buf || !ci || !ci->c) return; - } /* Answer to ping if needed, without breaking the buffer. */ if (!strnicmp(buf, "\1PING", 5)) { @@ -167,15 +165,16 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) * way. */ - /* We first retrieve the user status on the channel if needed */ - if (ci->botflags.HasFlag(BS_DONTKICKOPS) || ci->botflags.HasFlag(BS_DONTKICKVOICES)) - cstatus = chan_get_user_status(ci->c, u); - - if (buf && !check_access(u, ci, CA_NOKICK) && - (!ci->botflags.HasFlag(BS_DONTKICKOPS) - || !(cstatus & (CUS_HALFOP | CUS_OP | CUS_OWNER | CUS_PROTECT))) - && (!ci->botflags.HasFlag(BS_DONTKICKVOICES) || !(cstatus & CUS_VOICE))) { - + bool Allow = false; + if (!ci->botflags.HasFlag(BS_DONTKICKOPS) && !ci->botflags.HasFlag(BS_DONTKICKVOICES)) + Allow = true; + else if (ci->botflags.HasFlag(BS_DONTKICKOPS) && (ci->c->HasUserStatus(u, CMODE_HALFOP) || ci->c->HasUserStatus(u, CMODE_OP) || ci->c->HasUserStatus(u, CMODE_PROTECT) || ci->c->HasUserStatus(u, CMODE_OWNER))) + Allow = true; + else if (ci->botflags.HasFlag(BS_DONTKICKVOICES) && ci->c->HasUserStatus(u, CMODE_VOICE)) + Allow = true; + + if (buf && !check_access(u, ci, CA_NOKICK) && Allow) + { /* Bolds kicker */ if (ci->botflags.HasFlag(BS_KICK_BOLDS) && strchr(buf, 2)) { check_ban(ci, u, TTB_BOLDS); @@ -759,7 +758,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, const char *re { User *u = finduser(nick); - if (!u || !is_on_chan(ci->c, u)) + if (!u || !ci->c->FindUser(u)) return; if ((ModeManager::FindUserModeByName(UMODE_PROTECTED))) @@ -791,7 +790,7 @@ void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode, char *ni *buf = '\0'; u = finduser(nick); - if (!u || !is_on_chan(ci->c, u)) + if (!u || !ci->c->FindUser(u)) return; snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL))); |
