diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_antibear.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_filter.h | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 87 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 10 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 10 |
6 files changed, 38 insertions, 88 deletions
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index 0c65adab3..aecf143ec 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -48,10 +48,8 @@ class ModuleAntiBear : public Module { ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), 86400, ServerInstance->Config->ServerName, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString()); - if (ServerInstance->XLines->AddLine(zl)) + if (ServerInstance->XLines->AddLine(zl,NULL)) { - // XXX move events into the xline manager - FOREACH_MOD(I_OnAddGLine,OnAddZLine(86400, NULL, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->MakeHostIP())); ServerInstance->XLines->ApplyLines(); } else diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index cd37b6895..987995271 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -115,10 +115,9 @@ class DNSBLResolver : public Resolver { KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); - if (ServerInstance->XLines->AddLine(kl)) + if (ServerInstance->XLines->AddLine(kl,NULL)) { ServerInstance->XLines->ApplyLines(); - FOREACH_MOD(I_OnAddKLine,OnAddKLine(ConfEntry->duration, NULL, reason, them->MakeHostIP())); } else delete kl; @@ -128,10 +127,9 @@ class DNSBLResolver : public Resolver { GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); - if (ServerInstance->XLines->AddLine(gl)) + if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); - FOREACH_MOD(I_OnAddGLine,OnAddGLine(ConfEntry->duration, NULL, reason, them->MakeHostIP())); } else delete gl; @@ -141,10 +139,9 @@ class DNSBLResolver : public Resolver { ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), them->GetIPString()); - if (ServerInstance->XLines->AddLine(zl)) + if (ServerInstance->XLines->AddLine(zl,NULL)) { ServerInstance->XLines->ApplyLines(); - FOREACH_MOD(I_OnAddZLine,OnAddZLine(ConfEntry->duration, NULL, reason, them->GetIPString())); } else delete zl; diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index fc0d97938..c15b54201 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -281,10 +281,9 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri if (f->action == "gline") { GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); - if (ServerInstance->XLines->AddLine(gl)) + if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); - FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP())); } else delete gl; @@ -369,10 +368,9 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters { /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */ GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); - if (ServerInstance->XLines->AddLine(gl)) + if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); - FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP())); } else delete gl; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 7a0c0a2e1..87206ea2a 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -736,83 +736,47 @@ void ModuleSpanningTree::OnOper(User* user, const std::string &opertype) } } -void ModuleSpanningTree::OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason) +void ModuleSpanningTree::OnAddLine(XLine* line, User* user) { - if (!source) + if (!user) { /* Server-set lines */ char data[MAXBUF]; - snprintf(data,MAXBUF,"%c %s %s %lu %lu :%s", linetype, host.c_str(), ServerInstance->Config->ServerName, (unsigned long)ServerInstance->Time(false), - (unsigned long)duration, reason.c_str()); + snprintf(data,MAXBUF,"%c %s %s %lu %lu :%s", line->type, line->Displayable(), ServerInstance->Config->ServerName, line->set_time, + line->duration, line->reason); std::deque<std::string> params; params.push_back(data); Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ADDLINE", params); } else { - if (IS_LOCAL(source)) + if (user && IS_LOCAL(user)) { char type[8]; - snprintf(type,8,"%cLINE",linetype); - std::string stype = type; - if (adding) - { - char sduration[MAXBUF]; - snprintf(sduration,MAXBUF,"%ld",duration); - std::deque<std::string> params; - params.push_back(host); - params.push_back(sduration); - params.push_back(":"+reason); - Utils->DoOneToMany(source->uuid,stype,params); - } - else - { - std::deque<std::string> params; - params.push_back(host); - Utils->DoOneToMany(source->uuid,stype,params); - } + snprintf(type,8,"%cLINE",line->type); + std::string stype(type); + char sduration[MAXBUF]; + snprintf(sduration,MAXBUF,"%ld",line->duration); + std::deque<std::string> params; + params.push_back(line->Displayable()); + params.push_back(ConvToStr(line->duration)); + params.push_back(std::string(":")+line->reason); + Utils->DoOneToMany(user->uuid,stype,params); } } } -void ModuleSpanningTree::OnAddGLine(long duration, User* source, const std::string &reason, const std::string &hostmask) -{ - OnLine(source,hostmask,true,'G',duration,reason); -} - -void ModuleSpanningTree::OnAddZLine(long duration, User* source, const std::string &reason, const std::string &ipmask) -{ - OnLine(source,ipmask,true,'Z',duration,reason); -} - -void ModuleSpanningTree::OnAddQLine(long duration, User* source, const std::string &reason, const std::string &nickmask) -{ - OnLine(source,nickmask,true,'Q',duration,reason); -} - -void ModuleSpanningTree::OnAddELine(long duration, User* source, const std::string &reason, const std::string &hostmask) +void ModuleSpanningTree::OnDelLine(XLine* line, User* user) { - OnLine(source,hostmask,true,'E',duration,reason); -} - -void ModuleSpanningTree::OnDelGLine(User* source, const std::string &hostmask) -{ - OnLine(source,hostmask,false,'G',0,""); -} - -void ModuleSpanningTree::OnDelZLine(User* source, const std::string &ipmask) -{ - OnLine(source,ipmask,false,'Z',0,""); -} - -void ModuleSpanningTree::OnDelQLine(User* source, const std::string &nickmask) -{ - OnLine(source,nickmask,false,'Q',0,""); -} - -void ModuleSpanningTree::OnDelELine(User* source, const std::string &hostmask) -{ - OnLine(source,hostmask,false,'E',0,""); + if (user && IS_LOCAL(user)) + { + char type[8]; + snprintf(type,8,"%cLINE",line->type); + std::string stype(type); + std::deque<std::string> params; + params.push_back(line->Displayable()); + Utils->DoOneToMany(user->uuid,stype,params); + } } void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const std::string &text) @@ -1030,8 +994,7 @@ void ModuleSpanningTree::Implements(char* List) List[I_OnWallops] = List[I_OnUserNotice] = List[I_OnUserMessage] = List[I_OnBackgroundTimer] = 1; List[I_OnUserJoin] = List[I_OnChangeHost] = List[I_OnChangeName] = List[I_OnUserPart] = List[I_OnUserConnect] = 1; List[I_OnUserQuit] = List[I_OnUserPostNick] = List[I_OnUserKick] = List[I_OnRemoteKill] = List[I_OnRehash] = 1; - List[I_OnOper] = List[I_OnAddGLine] = List[I_OnAddZLine] = List[I_OnAddQLine] = List[I_OnAddELine] = 1; - List[I_OnDelGLine] = List[I_OnDelZLine] = List[I_OnDelQLine] = List[I_OnDelELine] = List[I_ProtoSendMode] = List[I_OnMode] = 1; + List[I_OnOper] = List[I_OnAddLine] = List[I_OnDelLine] = List[I_ProtoSendMode] = List[I_OnMode] = 1; List[I_OnStats] = List[I_ProtoSendMetaData] = List[I_OnEvent] = List[I_OnSetAway] = List[I_OnCancelAway] = List[I_OnPostCommand] = 1; } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index dab1b2420..77b4d52ed 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -178,14 +178,8 @@ class ModuleSpanningTree : public Module virtual void OnRehash(User* user, const std::string ¶meter); virtual void OnOper(User* user, const std::string &opertype); void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason); - virtual void OnAddGLine(long duration, User* source, const std::string &reason, const std::string &hostmask); - virtual void OnAddZLine(long duration, User* source, const std::string &reason, const std::string &ipmask); - virtual void OnAddQLine(long duration, User* source, const std::string &reason, const std::string &nickmask); - virtual void OnAddELine(long duration, User* source, const std::string &reason, const std::string &hostmask); - virtual void OnDelGLine(User* source, const std::string &hostmask); - virtual void OnDelZLine(User* source, const std::string &ipmask); - virtual void OnDelQLine(User* source, const std::string &nickmask); - virtual void OnDelELine(User* source, const std::string &hostmask); + virtual void OnAddLine(XLine* line, User* user); + virtual void OnDelLine(XLine* line, User* user); virtual void OnMode(User* user, void* dest, int target_type, const std::string &text); virtual int OnStats(char statschar, User* user, string_list &results); virtual void OnSetAway(User* user); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 8a68d71c5..27ba4cfe8 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -532,30 +532,30 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque<std::string> &par { case 'Z': xl = (XLine*)(new ZLine(Instance, Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str())); - propogate = Instance->XLines->AddLine(xl); + propogate = Instance->XLines->AddLine(xl,NULL); Instance->XLines->zline_set_creation_time(params[1].c_str(), atoi(params[3].c_str())); break; case 'Q': xl = (XLine*)(new QLine(Instance, Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), params[1].c_str())); - propogate = Instance->XLines->AddLine(xl); + propogate = Instance->XLines->AddLine(xl,NULL); Instance->XLines->qline_set_creation_time(params[1].c_str(), atoi(params[3].c_str())); break; case 'E': ih = Instance->XLines->IdentSplit(params[1]); xl = (XLine*)(new GLine(Instance, Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), ih.first.c_str(), ih.second.c_str())); - propogate = Instance->XLines->AddLine(xl); + propogate = Instance->XLines->AddLine(xl,NULL); Instance->XLines->eline_set_creation_time(params[1].c_str(), atoi(params[3].c_str())); break; case 'G': ih = Instance->XLines->IdentSplit(params[1]); xl = (XLine*)(new GLine(Instance, Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), ih.first.c_str(), ih.second.c_str())); - propogate = Instance->XLines->AddLine(xl); + propogate = Instance->XLines->AddLine(xl,NULL); Instance->XLines->gline_set_creation_time(params[1].c_str(), atoi(params[3].c_str())); break; case 'K': ih = Instance->XLines->IdentSplit(params[1]); xl = (XLine*)(new KLine(Instance, Instance->Time(), atoi(params[4].c_str()), params[2].c_str(), params[5].c_str(), ih.first.c_str(), ih.second.c_str())); - propogate = Instance->XLines->AddLine(xl); + propogate = Instance->XLines->AddLine(xl,NULL); break; default: /* Just in case... */ |