From c45fe6715d51a0b6565fee1321c45645883fa749 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 31 Oct 2007 19:51:03 +0000 Subject: Fix up to pass User* git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8442 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/xline.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/xline.cpp') 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::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::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), *i); + if (pptr != pending_lines.end()) + pending_lines.erase(pptr); } return true; } -- cgit v1.2.3