diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-31 19:51:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-31 19:51:03 +0000 |
commit | c45fe6715d51a0b6565fee1321c45645883fa749 (patch) | |
tree | d34b69ddd88b2e7adda462b5e5e73455b60b3b91 /src | |
parent | b3f562c11d5429fc555b75ae2ac491fa2b4dc72d (diff) |
Fix up to pass User*
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8442 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_eline.cpp | 7 | ||||
-rw-r--r-- | src/commands/cmd_gline.cpp | 7 | ||||
-rw-r--r-- | src/commands/cmd_kline.cpp | 7 | ||||
-rw-r--r-- | src/commands/cmd_qline.cpp | 6 | ||||
-rw-r--r-- | src/commands/cmd_zline.cpp | 6 | ||||
-rw-r--r-- | src/configreader.cpp | 8 | ||||
-rw-r--r-- | src/userprocess.cpp | 2 | ||||
-rw-r--r-- | src/xline.cpp | 16 |
8 files changed, 27 insertions, 32 deletions
diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp index b32c2af91..cd0627178 100644 --- a/src/commands/cmd_eline.cpp +++ b/src/commands/cmd_eline.cpp @@ -39,10 +39,8 @@ CmdResult CommandEline::Handle (const char** parameters, int pcnt, User *user) long duration = ServerInstance->Duration(parameters[1]); ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str()); - if (ServerInstance->XLines->AddLine(el)) + if (ServerInstance->XLines->AddLine(el, user)) { - FOREACH_MOD(I_OnAddELine,OnAddELine(duration, user, parameters[2], parameters[0])); - if (!duration) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s.",user->nick,parameters[0]); @@ -62,9 +60,8 @@ CmdResult CommandEline::Handle (const char** parameters, int pcnt, User *user) } else { - if (ServerInstance->XLines->DelLine(parameters[0], 'E')) + if (ServerInstance->XLines->DelLine(parameters[0], 'E', user)) { - FOREACH_MOD(I_OnDelELine,OnDelELine(user, parameters[0])); ServerInstance->SNO->WriteToSnoMask('x',"%s Removed E-line on %s.",user->nick,parameters[0]); } else diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp index 4dde5298c..abe29d18e 100644 --- a/src/commands/cmd_gline.cpp +++ b/src/commands/cmd_gline.cpp @@ -43,10 +43,8 @@ CmdResult CommandGline::Handle (const char** parameters, int pcnt, User *user) long duration = ServerInstance->Duration(parameters[1]); GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str()); - if (ServerInstance->XLines->AddLine(gl)) + if (ServerInstance->XLines->AddLine(gl, user)) { - FOREACH_MOD(I_OnAddGLine,OnAddGLine(duration, user, parameters[2], parameters[0])); - if (!duration) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent G-line for %s.",user->nick,parameters[0]); @@ -69,9 +67,8 @@ CmdResult CommandGline::Handle (const char** parameters, int pcnt, User *user) } else { - if (ServerInstance->XLines->DelLine(parameters[0],'G')) + if (ServerInstance->XLines->DelLine(parameters[0],'G',user)) { - FOREACH_MOD(I_OnDelGLine,OnDelGLine(user, parameters[0])); ServerInstance->SNO->WriteToSnoMask('x',"%s Removed G-line on %s.",user->nick,parameters[0]); } else diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp index e15604711..de225b0f0 100644 --- a/src/commands/cmd_kline.cpp +++ b/src/commands/cmd_kline.cpp @@ -43,10 +43,8 @@ CmdResult CommandKline::Handle (const char** parameters, int pcnt, User *user) long duration = ServerInstance->Duration(parameters[1]); KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str()); - if (ServerInstance->XLines->AddLine(kl)) + if (ServerInstance->XLines->AddLine(kl,user)) { - FOREACH_MOD(I_OnAddKLine,OnAddKLine(duration, user, parameters[2], parameters[0])); - if (!duration) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent K-line for %s.",user->nick,parameters[0]); @@ -68,9 +66,8 @@ CmdResult CommandKline::Handle (const char** parameters, int pcnt, User *user) } else { - if (ServerInstance->XLines->DelLine(parameters[0],'K')) + if (ServerInstance->XLines->DelLine(parameters[0],'K',user)) { - FOREACH_MOD(I_OnDelKLine,OnDelKLine(user, parameters[0])); ServerInstance->SNO->WriteToSnoMask('x',"%s Removed K-line on %s.",user->nick,parameters[0]); } else diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp index 7ccfe6031..2922c09cf 100644 --- a/src/commands/cmd_qline.cpp +++ b/src/commands/cmd_qline.cpp @@ -37,9 +37,8 @@ CmdResult CommandQline::Handle (const char** parameters, int pcnt, User *user) long duration = ServerInstance->Duration(parameters[1]); QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]); - if (ServerInstance->XLines->AddLine(ql)) + if (ServerInstance->XLines->AddLine(ql,user)) { - FOREACH_MOD(I_OnAddQLine,OnAddQLine(duration, user, parameters[2], parameters[0])); if (!duration) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]); @@ -60,9 +59,8 @@ CmdResult CommandQline::Handle (const char** parameters, int pcnt, User *user) } else { - if (ServerInstance->XLines->DelLine(parameters[0],'Q')) + if (ServerInstance->XLines->DelLine(parameters[0],'Q',user)) { - FOREACH_MOD(I_OnDelQLine,OnDelQLine(user, parameters[0])); ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0]); } else diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index 9c1b3dfd0..e701867fb 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -45,9 +45,8 @@ CmdResult CommandZline::Handle (const char** parameters, int pcnt, User *user) ipaddr++; } ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ipaddr); - if (ServerInstance->XLines->AddLine(zl)) + if (ServerInstance->XLines->AddLine(zl,user)) { - FOREACH_MOD(I_OnAddZLine,OnAddZLine(duration, user, parameters[2], parameters[0])); if (!duration) { ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s.",user->nick,parameters[0]); @@ -68,9 +67,8 @@ CmdResult CommandZline::Handle (const char** parameters, int pcnt, User *user) } else { - if (ServerInstance->XLines->DelLine(parameters[0],'Z')) + if (ServerInstance->XLines->DelLine(parameters[0],'Z',user)) { - FOREACH_MOD(I_OnDelZLine,OnDelZLine(user, parameters[0])); ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Z-line on %s.",user->nick,parameters[0]); } else diff --git a/src/configreader.cpp b/src/configreader.cpp index 4c41cf247..8311ad58e 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1926,7 +1926,7 @@ bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* ipmask = values[1].GetString(); ZLine* zl = new ZLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ipmask); - if (!conf->GetInstance()->XLines->AddLine(zl)) + if (!conf->GetInstance()->XLines->AddLine(zl, NULL)) delete zl; return true; @@ -1938,7 +1938,7 @@ bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val const char* nick = values[1].GetString(); QLine* ql = new QLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, nick); - if (!conf->GetInstance()->XLines->AddLine(ql)) + if (!conf->GetInstance()->XLines->AddLine(ql, NULL)) delete ql; return true; @@ -1954,7 +1954,7 @@ bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &val IdentHostPair ih = xlm->IdentSplit(host); KLine* kl = new KLine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); - if (!xlm->AddLine(kl)) + if (!xlm->AddLine(kl, NULL)) delete kl; return true; } @@ -1969,7 +1969,7 @@ bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &val IdentHostPair ih = xlm->IdentSplit(host); ELine* el = new ELine(conf->GetInstance(), conf->GetInstance()->Time(), 0, "<Config>", reason, ih.first.c_str(), ih.second.c_str()); - if (!xlm->AddLine(el)) + if (!xlm->AddLine(el, NULL)) delete el; return true; } diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 39d3ad0ec..fd9d3f074 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -30,7 +30,7 @@ void FloodQuitUserHandler::Call(User* current) if (current->registered != REG_ALL) { ZLine* zl = new ZLine(Server, Server->Time(), 0, Server->Config->ServerName, "Flood from unregistered connection", current->GetIPString()); - if (Server->XLines->AddLine(zl)) + if (Server->XLines->AddLine(zl,NULL)) Server->XLines->ApplyLines(); else delete zl; diff --git a/src/xline.cpp b/src/xline.cpp index 1f2782c4d..9d0b12fa3 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -126,20 +126,23 @@ IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host) // adds a g:line /*bool XLineManager::AddELine(long duration, const char* source, const char* reason, const char* hostmask)*/ -bool XLineManager::AddLine(XLine* line) +bool XLineManager::AddLine(XLine* line, User* user) { /*IdentHostPair ih = IdentSplit(hostmask);*/ - if (DelLine(line->Displayable(), line->type, true)) + if (DelLine(line->Displayable(), line->type, user, true)) return false; /*ELine* item = new ELine(ServerInstance, ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/ active_lines.push_back(line); sort(active_lines.begin(), active_lines.end(), XLineManager::XSortComparison); + pending_lines.push_back(line); lookup_lines[line->type][line->Displayable()] = line; line->OnAdd(); + FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); + return true; } @@ -154,7 +157,7 @@ bool XLineManager::AddLine(XLine* line) // deletes a g:line, returns true if the line existed and was removed -bool XLineManager::DelLine(const char* hostmask, char type, bool simulate) +bool XLineManager::DelLine(const char* hostmask, char type, User* user, bool simulate) { IdentHostPair ih = IdentSplit(hostmask); for (std::vector<XLine*>::iterator i = active_lines.begin(); i != active_lines.end(); i++) @@ -170,7 +173,12 @@ bool XLineManager::DelLine(const char* hostmask, char type, bool simulate) active_lines.erase(i); if (lookup_lines.find(type) != lookup_lines.end()) lookup_lines[type].erase(hostmask); - /* XXX: Should erase from pending lines here */ + + FOREACH_MOD(I_OnDelLine,OnDelLine(user, *i)); + + std::vector<XLine*>::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), *i); + if (pptr != pending_lines.end()) + pending_lines.erase(pptr); } return true; } |