]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/fmode.cpp
m_spanningtree Remove the MAP ISUPPORT token
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / fmode.cpp
index bad68f05370e8c5e99d5d4d304a22ab2237832b4..56757a8b73f989757350a8f0e2d8758b8df2264e 100644 (file)
 /** FMODE command - server mode with timestamp checks */
 CmdResult CommandFMode::Handle(User* who, std::vector<std::string>& 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<std::string>& params)
        ServerInstance->Modes->Process(modelist, who, flags);
        return CMD_SUCCESS;
 }
-
-