]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix RPL_SERVERVERSION treating the modes as a single parameter.
authorPeter Powell <petpow@saberuk.com>
Wed, 4 Oct 2017 13:10:19 +0000 (14:10 +0100)
committerPeter Powell <petpow@saberuk.com>
Wed, 4 Oct 2017 13:10:19 +0000 (14:10 +0100)
include/mode.h
src/mode.cpp
src/users.cpp

index 6b481e7796c744a2efbf2e5055401b2899d9c25c..ec293e4970dbd4701bd5563bb593f36c11ec4251 100644 (file)
@@ -586,7 +586,7 @@ class CoreExport ModeParser : public fakederef<ModeParser>
 
        /** Cached mode list for use in 004 numeric
         */
-       std::string Cached004ModeList;
+       TR1NS::array<std::string, 3> Cached004ModeList;
 
  public:
        typedef std::vector<ListModeBase*> ListModeList;
@@ -755,13 +755,13 @@ class CoreExport ModeParser : public fakederef<ModeParser>
         */
        PrefixMode* FindPrefix(unsigned const char pfxletter);
 
-       /** Returns a list of modes, space seperated by type:
+       /** Returns an array of modes:
         * 1. User modes
         * 2. Channel modes
         * 3. Channel modes that require a parameter when set
         * This is sent to users as the last part of the 004 numeric
         */
-       const std::string& GetModeListFor004Numeric();
+       const TR1NS::array<std::string, 3>& GetModeListFor004Numeric();
 
        /** Generates a list of modes, comma seperated by type:
         *  1; Listmodes EXCEPT those with a prefix
@@ -800,7 +800,7 @@ class CoreExport ModeParser : public fakederef<ModeParser>
        void ShowListModeList(User* user, Channel* chan, ModeHandler* mh);
 };
 
-inline const std::string& ModeParser::GetModeListFor004Numeric()
+inline const TR1NS::array<std::string, 3>& ModeParser::GetModeListFor004Numeric()
 {
        return Cached004ModeList;
 }
index c4969d467d0527d3315e0a9dd76043a35f31a31e..fd5e307074e2aea1e0ee0bf97f22f2fe3eefdf8b 100644 (file)
@@ -720,7 +720,9 @@ std::string ModeParser::CreateModeList(ModeType mt, bool needparam)
 
 void ModeParser::RecreateModeListFor004Numeric()
 {
-       Cached004ModeList = CreateModeList(MODETYPE_USER) + " " + CreateModeList(MODETYPE_CHANNEL) + " " + CreateModeList(MODETYPE_CHANNEL, true);
+       Cached004ModeList[0] = CreateModeList(MODETYPE_USER);
+       Cached004ModeList[1] = CreateModeList(MODETYPE_CHANNEL);
+       Cached004ModeList[2] = CreateModeList(MODETYPE_CHANNEL, true);
 }
 
 PrefixMode* ModeParser::FindPrefix(unsigned const char pfxletter)
index 7d72692d9284103eb55403660fcdcbdb6a06cc57..4945cbb21621d9d4fefd848025c74f5ea16b1346 100644 (file)
@@ -541,8 +541,8 @@ void LocalUser::FullConnect()
        this->WriteNumeric(RPL_YOURHOSTIS, InspIRCd::Format("Your host is %s, running version %s", ServerInstance->Config->ServerName.c_str(), INSPIRCD_BRANCH));
        this->WriteNumeric(RPL_SERVERCREATED, InspIRCd::TimeString(ServerInstance->startup_time, "This server was created %H:%M:%S %b %d %Y"));
 
-       const std::string& modelist = ServerInstance->Modes->GetModeListFor004Numeric();
-       this->WriteNumeric(RPL_SERVERVERSION, ServerInstance->Config->ServerName, INSPIRCD_BRANCH, modelist);
+       const TR1NS::array<std::string, 3>& modelist = ServerInstance->Modes->GetModeListFor004Numeric();
+       this->WriteNumeric(RPL_SERVERVERSION, ServerInstance->Config->ServerName, INSPIRCD_BRANCH, modelist[0], modelist[1], modelist[2]);
 
        ServerInstance->ISupport.SendTo(this);