]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/fmode.cpp
Only assign NewServices once the duplicate check is done.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / fmode.cpp
index 56757a8b73f989757350a8f0e2d8758b8df2264e..c3eaa7afa4ee68a272d2c09a53cb1d2bcf38c8c5 100644 (file)
@@ -1,7 +1,11 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2018 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012-2015 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
+ *   Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
  *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
@@ -21,8 +25,8 @@
 #include "inspircd.h"
 #include "commands.h"
 
-/** FMODE command - server mode with timestamp checks */
-CmdResult CommandFMode::Handle(User* who, std::vector<std::string>& params)
+/** FMODE command - channel mode change with timestamp checks */
+CmdResult CommandFMode::Handle(User* who, Params& params)
 {
        time_t TS = ServerCommand::ExtractTS(params[1]);
 
@@ -39,18 +43,17 @@ CmdResult CommandFMode::Handle(User* who, std::vector<std::string>& params)
        if (TS > ourTS)
                return CMD_FAILURE;
 
-       /* TS is equal or less: Merge the mode changes into ours and pass on.
+       /* TS is equal or less: apply the mode change locally and forward the message
         */
-       std::vector<std::string> modelist;
-       modelist.reserve(params.size()-1);
-       /* Insert everything into modelist except the TS (params[1]) */
-       modelist.push_back(params[0]);
-       modelist.insert(modelist.end(), params.begin()+2, params.end());
+
+       // Turn modes into a Modes::ChangeList; may have more elements than max modes
+       Modes::ChangeList changelist;
+       ServerInstance->Modes.ModeParamsToChangeList(who, MODETYPE_CHANNEL, params, changelist, 2);
 
        ModeParser::ModeProcessFlag flags = ModeParser::MODE_LOCALONLY;
        if ((TS == ourTS) && IS_SERVER(who))
                flags |= ModeParser::MODE_MERGE;
 
-       ServerInstance->Modes->Process(modelist, who, flags);
+       ServerInstance->Modes->Process(who, chan, NULL, changelist, flags);
        return CMD_SUCCESS;
 }