diff options
Diffstat (limited to 'src/modules/m_spanningtree')
-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 |
3 files changed, 32 insertions, 75 deletions
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... */ |