diff options
Diffstat (limited to 'src/modules/m_spanningtree/fjoin.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index df11aa091..41a860915 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -94,7 +94,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src } else if (ourTS > TS) { - chan = NukeChannel(chan, channel, TS); + chan = Channel::Nuke(chan, channel, TS); if (incremental) { ServerInstance->SNO->WriteToSnoMask('d', "Incremental merge FJOIN recieved for %s", chan->name.c_str()); @@ -162,56 +162,3 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src } return CMD_SUCCESS; } - -Channel* CommandFJoin::NukeChannel(Channel* old, const std::string& channel, time_t newTS) -{ - time_t oldTS = old->age; - ServerInstance->SNO->WriteToSnoMask('d', "Recreating channel"); - if (((ModuleSpanningTree*)(Module*)creator)->Utils->AnnounceTSChange) - old->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", - old->name.c_str(), channel.c_str(), (unsigned long) oldTS, (unsigned long) newTS); - - // prepare a mode change that removes all modes on the channel - irc::modestacker stack; - for (ModeIDIter id; id; id++) - { - ModeHandler* mh = ServerInstance->Modes->FindMode(id); - - /* Passing a pointer to a modestacker here causes the mode to be put onto the mode stack, - * rather than applied immediately. Module unloads require this to be done immediately, - * for this function we require tidyness instead. Fixes bug #493 - */ - if (mh && mh->GetModeType() == MODETYPE_CHANNEL) - mh->RemoveMode(old, &stack); - } - - // don't process the change, just send it to clients - ServerInstance->Modes->Send(ServerInstance->FakeClient, old, stack); - - // unhook the old channel - chan_hash::iterator iter = ServerInstance->chanlist->find(old->name); - ServerInstance->chanlist->erase(iter); - - // create the new channel (which inserts itself in chanlist) - Channel* chan = new Channel(channel, newTS); - - // migrate all the users to the new channel - // This has the side effect of dropping their permissions (op/voice/etc) - for(UserMembIter i = old->userlist.begin(); i != old->userlist.end(); i++) - { - User* u = i->first; - Membership* memb = i->second; - u->chans.erase(memb); - memb->cull(); - delete memb; - memb = chan->AddUser(u); - u->chans.insert(memb); - } - // nuke the old channel - old->userlist.clear(); - old->cull(); - delete old; - - return chan; -} - |
