diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-10 22:56:03 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-10 22:56:03 +0000 |
| commit | b73210e538038a8dd803c0c250369b8fd3c2b3f7 (patch) | |
| tree | 5e35bc86ca22875321378dd755d32999efdf7bb3 /src/core | |
| parent | 01d43e7db5514e29460c7952762739cdb7ee4b23 (diff) | |
Rewrote the code that handles and sends kicks
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2746 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/bs_kick.c | 2 | ||||
| -rw-r--r-- | src/core/cs_akick.c | 13 | ||||
| -rw-r--r-- | src/core/cs_ban.c | 14 | ||||
| -rw-r--r-- | src/core/cs_clear.c | 14 | ||||
| -rw-r--r-- | src/core/cs_forbid.c | 6 | ||||
| -rw-r--r-- | src/core/cs_kick.c | 15 | ||||
| -rw-r--r-- | src/core/cs_suspend.c | 7 | ||||
| -rw-r--r-- | src/core/os_kick.c | 10 |
8 files changed, 13 insertions, 68 deletions
diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index daf09350a..dbff0e788 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -15,8 +15,6 @@ #include "module.h" -int do_kickcmd(User * u); - class CommandBSKick : public Command { public: diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index 881cd01ec..d07e820a8 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -482,7 +482,6 @@ class CommandCSAKick : public Command Channel *c = ci->c; c_userlist *cu, *unext; int count = 0; - const char *argv[3]; if (!c) { @@ -495,17 +494,9 @@ class CommandCSAKick : public Command while (cu) { unext = cu->next; - if (check_kick(cu->user, c->name.c_str(), c->creation_time)) + if (ci->CheckKick(cu->user)) { - argv[0] = sstrdup(c->name.c_str()); - argv[1] = sstrdup(cu->user->nick.c_str()); - argv[2] = sstrdup(Config.CSAutokickReason); - - do_kick(Config.s_ChanServ, 3, argv); - - delete [] argv[2]; - delete [] argv[1]; - delete [] argv[0]; + c->Kick(NULL, cu->user, "%s", Config.CSAutokickReason); count++; } cu = unext; diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c index aaf36ac27..68248e02b 100644 --- a/src/core/cs_ban.c +++ b/src/core/cs_ban.c @@ -75,18 +75,10 @@ class CommandCSBan : public Command if (!is_on_chan(c, u2)) return MOD_CONT; - if ((ci->HasFlag(CI_SIGNKICK)) - || ((ci->HasFlag(CI_SIGNKICK_LEVEL)) - && !check_access(u, ci, CA_SIGNKICK))) - ircdproto->SendKick(whosends(ci), ci->c, u2, "%s (%s)", reason, u->nick.c_str()); + if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !check_access(u, ci, CA_SIGNKICK))) + c->Kick(whosends(ci), u2, "%s (%s)", reason, u->nick.c_str()); else - ircdproto->SendKick(whosends(ci), ci->c, u2, "%s", reason); - - const char *kav[4]; - kav[0] = ci->name.c_str(); - kav[1] = target; - kav[2] = reason; - do_kick(Config.s_ChanServ, 3, kav); + c->Kick(whosends(ci), u2, "%s", reason); } return MOD_CONT; diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c index 1de6ca1ff..9f2f1cce5 100644 --- a/src/core/cs_clear.c +++ b/src/core/cs_clear.c @@ -148,22 +148,12 @@ class CommandCSClear : public Command notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_VOICES, chan); } else if (what == "users") { - const char *av[3]; struct c_userlist *cu, *bnext; - char buf[256]; - - snprintf(buf, sizeof(buf), "CLEAR USERS command from %s", u->nick.c_str()); + std::string buf = "CLEAR USERS command from " + u->nick; for (cu = c->users; cu; cu = bnext) { bnext = cu->next; - av[0] = sstrdup(chan); - av[1] = sstrdup(cu->user->nick.c_str()); - av[2] = sstrdup(buf); - ircdproto->SendKick(whosends(ci), c, cu->user, av[2]); - do_kick(Config.s_ChanServ, 3, av); - delete [] av[2]; - delete [] av[1]; - delete [] av[0]; + c->Kick(NULL, cu->user, buf.c_str()); } notice_lang(Config.s_ChanServ, u, CHAN_CLEARED_USERS, chan); } else { diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index 82b045b48..7abf355ac 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -82,11 +82,7 @@ class CommandCSForbid : public Command if (is_oper(cu->user)) continue; - av[0] = c->name.c_str(); - av[1] = cu->user->nick.c_str(); - av[2] = reason ? reason : getstring(cu->user->nc, CHAN_FORBID_REASON); - ircdproto->SendKick(findbot(Config.s_ChanServ), c, cu->user, av[2]); - do_kick(Config.s_ChanServ, 3, av); + c->Kick(findbot(Config.s_ChanServ), cu->user, "%s", reason ? reason : getstring(cu->user->nc, CHAN_FORBID_REASON)); } } diff --git a/src/core/cs_kick.c b/src/core/cs_kick.c index 898fb898b..1cda01867 100644 --- a/src/core/cs_kick.c +++ b/src/core/cs_kick.c @@ -63,19 +63,10 @@ class CommandCSKick : public Command } else if (is_protected(u2)) { notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); } else { - const char *av[3]; - - if ((ci->HasFlag(CI_SIGNKICK)) - || ((ci->HasFlag(CI_SIGNKICK_LEVEL)) - && !check_access(u, ci, CA_SIGNKICK))) - ircdproto->SendKick(whosends(ci), ci->c, u2, "%s (%s)", - reason, u->nick.c_str()); + if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !check_access(u, ci, CA_SIGNKICK))) + ci->c->Kick(whosends(ci), u2, "%s (%s)", reason, u->nick.c_str()); else - ircdproto->SendKick(whosends(ci), ci->c, u2, "%s", reason); - av[0] = ci->name.c_str(); - av[1] = target; - av[2] = reason; - do_kick(Config.s_ChanServ, 3, av); + ci->c->Kick(whosends(ci), u2, "%s", reason); } return MOD_CONT; } diff --git a/src/core/cs_suspend.c b/src/core/cs_suspend.c index fdd40c796..4a47091eb 100644 --- a/src/core/cs_suspend.c +++ b/src/core/cs_suspend.c @@ -63,7 +63,6 @@ class CommandCSSuspend : public Command if ((c = findchan(ci->name.c_str()))) { struct c_userlist *cu, *nextu; - const char *av[3]; for (cu = c->users; cu; cu = nextu) { @@ -72,11 +71,7 @@ class CommandCSSuspend : public Command if (is_oper(cu->user)) continue; - av[0] = c->name.c_str(); - av[1] = cu->user->nick.c_str(); - av[2] = reason ? reason : getstring(cu->user->nc, CHAN_SUSPEND_REASON); - ircdproto->SendKick(findbot(Config.s_ChanServ), c, cu->user, av[2]); - do_kick(Config.s_ChanServ, 3, av); + c->Kick(NULL, cu->user, "%s", reason ? reason : getstring(cu->user->nc, CHAN_SUSPEND_REASON)); } } diff --git a/src/core/os_kick.c b/src/core/os_kick.c index 096e81c4c..678934fbb 100644 --- a/src/core/os_kick.c +++ b/src/core/os_kick.c @@ -24,7 +24,6 @@ class CommandOSKick : public Command CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - const char *argv[3]; const char *chan = params[0].c_str(), *nick = params[1].c_str(), *s = params[2].c_str(); Channel *c; User *u2; @@ -45,16 +44,9 @@ class CommandOSKick : public Command return MOD_CONT; } - ircdproto->SendKick(findbot(Config.s_OperServ), c, u2, "%s (%s)", u->nick.c_str(), s); + c->Kick(findbot(Config.s_OperServ), u2, "%s (%s)", u->nick.c_str(), s); if (Config.WallOSKick) ircdproto->SendGlobops(findbot(Config.s_OperServ), "%s used KICK on %s/%s", u->nick.c_str(), u2->nick.c_str(), chan); - argv[0] = sstrdup(chan); - argv[1] = sstrdup(u2->nick.c_str()); - argv[2] = sstrdup(s); - do_kick(Config.s_OperServ, 3, argv); - delete [] argv[2]; - delete [] argv[1]; - delete [] argv[0]; return MOD_CONT; } |
