diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-10 17:34:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-10 17:34:57 +0000 |
commit | 425ab67e76483e6adc424adda3c5e7357c140743 (patch) | |
tree | dc07622e2347ee335f950bf44aa280c8111b7c02 | |
parent | 16e8b383c5e222f03f45804d120f07a72d224163 (diff) |
Improve speed of these, and only send out snotice if the gline doesnt already exist
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6287 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_gline.cpp | 5 | ||||
-rw-r--r-- | src/cmd_kline.cpp | 27 | ||||
-rw-r--r-- | src/cmd_qline.cpp | 23 | ||||
-rw-r--r-- | src/cmd_zline.cpp | 23 |
4 files changed, 48 insertions, 30 deletions
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp index f2b3b02a6..b5e361e82 100644 --- a/src/cmd_gline.cpp +++ b/src/cmd_gline.cpp @@ -39,18 +39,21 @@ CmdResult cmd_gline::Handle (const char** parameters, int pcnt, userrec *user) if (ServerInstance->XLines->add_gline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0])) { + int to_apply = APPLY_GLINES; + FOREACH_MOD(I_OnAddGLine,OnAddGLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); if (!ServerInstance->Duration(parameters[1])) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent G-line for %s.",user->nick,parameters[0]); + to_apply |= APPLY_PERM_ONLY; } else { ServerInstance->SNO->WriteToSnoMask('x',"%s added timed G-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); } - ServerInstance->XLines->apply_lines(APPLY_GLINES); + ServerInstance->XLines->apply_lines(to_apply); } else { diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp index 56ec75a8f..de1cb8366 100644 --- a/src/cmd_kline.cpp +++ b/src/cmd_kline.cpp @@ -37,19 +37,24 @@ CmdResult cmd_kline::Handle (const char** parameters, int pcnt, userrec *user) return CMD_FAILURE; } - ServerInstance->XLines->add_kline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]); - FOREACH_MOD(I_OnAddKLine,OnAddKLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); - - if (!ServerInstance->Duration(parameters[1])) - { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent K-line for %s.",user->nick,parameters[0]); - } - else + if (ServerInstance->XLines->add_kline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0])) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); - } + int to_apply = APPLY_KLINES; + + FOREACH_MOD(I_OnAddKLine,OnAddKLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); + + if (!ServerInstance->Duration(parameters[1])) + { + ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent K-line for %s.",user->nick,parameters[0]); + to_apply |= APPLY_PERM_ONLY; + } + else + { + ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); + } - ServerInstance->XLines->apply_lines(APPLY_KLINES); + ServerInstance->XLines->apply_lines(to_apply); + } } else { diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp index 3bffa2f34..951f39df8 100644 --- a/src/cmd_qline.cpp +++ b/src/cmd_qline.cpp @@ -37,17 +37,22 @@ CmdResult cmd_qline::Handle (const char** parameters, int pcnt, userrec *user) return CMD_FAILURE; } - ServerInstance->XLines->add_qline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]); - FOREACH_MOD(I_OnAddQLine,OnAddQLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); - if (!ServerInstance->Duration(parameters[1])) + if (ServerInstance->XLines->add_qline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0])) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]); - } - else - { - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); + int to_apply = APPLY_QLINES; + + FOREACH_MOD(I_OnAddQLine,OnAddQLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); + if (!ServerInstance->Duration(parameters[1])) + { + to_apply |= APPLY_PERM_ONLY; + ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]); + } + else + { + ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); + } + ServerInstance->XLines->apply_lines(to_apply); } - ServerInstance->XLines->apply_lines(APPLY_QLINES); } else { diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp index c0ddf0db6..46d24f3bd 100644 --- a/src/cmd_zline.cpp +++ b/src/cmd_zline.cpp @@ -38,17 +38,22 @@ CmdResult cmd_zline::Handle (const char** parameters, int pcnt, userrec *user) if (ServerInstance->IPMatchesEveryone(parameters[0],user)) return CMD_FAILURE; - ServerInstance->XLines->add_zline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]); - FOREACH_MOD(I_OnAddZLine,OnAddZLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); - if (!ServerInstance->Duration(parameters[1])) + if (ServerInstance->XLines->add_zline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0])) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s.",user->nick,parameters[0]); - } - else - { - ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); + int to_apply = APPLY_ZLINES; + + FOREACH_MOD(I_OnAddZLine,OnAddZLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0])); + if (!ServerInstance->Duration(parameters[1])) + { + to_apply |= APPLY_PERM_ONLY; + ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s.",user->nick,parameters[0]); + } + else + { + ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->Duration(parameters[1])); + } + ServerInstance->XLines->apply_lines(to_apply); } - ServerInstance->XLines->apply_lines(APPLY_ZLINES); } else { |