X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Ffmode.cpp;h=56757a8b73f989757350a8f0e2d8758b8df2264e;hb=bc51c8e4da14f405d6d6220a4453a58ebde580c6;hp=bad68f05370e8c5e99d5d4d304a22ab2237832b4;hpb=e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index bad68f053..56757a8b7 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -24,36 +24,15 @@ /** FMODE command - server mode with timestamp checks */ CmdResult CommandFMode::Handle(User* who, std::vector& params) { - time_t TS = ConvToInt(params[1]); - if (!TS) - { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropping link."); - ServerInstance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq, dropping link.", who->server->GetName().c_str()); - return CMD_INVALID; - } + time_t TS = ServerCommand::ExtractTS(params[1]); - /* Extract the TS value of the object, either User or Channel */ - time_t ourTS; - if (params[0][0] == '#') - { - Channel* chan = ServerInstance->FindChan(params[0]); - if (!chan) - /* Oops, channel doesn't exist! */ - return CMD_FAILURE; - - ourTS = chan->age; - } - else - { - User* user = ServerInstance->FindUUID(params[0]); - if (!user) - return CMD_FAILURE; - - if (IS_SERVER(user)) - return CMD_INVALID; + Channel* const chan = ServerInstance->FindChan(params[0]); + if (!chan) + // Channel doesn't exist + return CMD_FAILURE; - ourTS = user->age; - } + // Extract the TS of the channel in question + time_t ourTS = chan->age; /* If the TS is greater than ours, we drop the mode and don't pass it anywhere. */ @@ -75,5 +54,3 @@ CmdResult CommandFMode::Handle(User* who, std::vector& params) ServerInstance->Modes->Process(modelist, who, flags); return CMD_SUCCESS; } - -