]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Switch from std::stringstream to irc::spacesepstream.
authorPeter Powell <petpow@saberuk.com>
Thu, 19 Oct 2017 10:55:17 +0000 (11:55 +0100)
committerPeter Powell <petpow@saberuk.com>
Thu, 19 Oct 2017 13:58:21 +0000 (14:58 +0100)
The latter is more suited to the things we have previously been
using std::stringstream for.

src/modules/m_conn_umodes.cpp
src/modules/m_opermodes.cpp
src/modules/m_shun.cpp
src/wildcard.cpp

index acac7640adf0149ce1ecf4117e83d387469ee671..c439f3bfeccf0fb6a18787b41f720a2b736bcd62 100644 (file)
@@ -47,13 +47,13 @@ class ModuleModesOnConnect : public Module
                if (!ThisModes.empty())
                {
                        std::string buf;
-                       std::stringstream ss(ThisModes);
+                       irc::spacesepstream ss(ThisModes);
 
                        std::vector<std::string> modes;
                        modes.push_back(user->nick);
 
                        // split ThisUserModes into modes and mode params
-                       while (ss >> buf)
+                       while (ss.GetToken(buf))
                                modes.push_back(buf);
 
                        ServerInstance->Parser.CallHandler("MODE", modes, user);
index 33ebb57a04c37dee58af5306916585f4abe891e3..6a18e9c9d198f241c395b078ddd74f3d111cda2f 100644 (file)
@@ -52,12 +52,12 @@ class ModuleModesOnOper : public Module
                        smodes = "+" + smodes;
 
                std::string buf;
-               std::stringstream ss(smodes);
+               irc::spacesepstream ss(smodes);
                std::vector<std::string> modes;
 
                modes.push_back(u->nick);
                // split into modes and mode params
-               while (ss >> buf)
+               while (ss.GetToken(buf))
                        modes.push_back(buf);
 
                ServerInstance->Parser.CallHandler("MODE", modes, u);
index 28faf898b061aa0d6bb3247285b8baed8fa072e6..417d67b69fd1df260358c8e50417d814b3091719 100644 (file)
@@ -217,10 +217,10 @@ class ModuleShun : public Module
 
                ShunEnabledCommands.clear();
 
-               std::stringstream dcmds(cmds);
+               irc::spacesepstream dcmds(cmds);
                std::string thiscmd;
 
-               while (dcmds >> thiscmd)
+               while (dcmds.GetToken(thiscmd))
                {
                        ShunEnabledCommands.insert(thiscmd);
                }
index 6711f953aa9b7a311d0c91a6a741769ebf437422..4a313af760b34e2d7d4443005f4978be990c0ac7 100644 (file)
@@ -109,9 +109,9 @@ bool InspIRCd::MatchCIDR(const char* str, const char* mask, unsigned const char*
 
 bool InspIRCd::MatchMask(const std::string& masks, const std::string& hostname, const std::string& ipaddr)
 {
-       std::stringstream masklist(masks);
+       irc::spacesepstream masklist(masks);
        std::string mask;
-       while (masklist >> mask)
+       while (masklist.GetToken(mask))
        {
                if (InspIRCd::Match(hostname, mask, ascii_case_insensitive_map) ||
                        InspIRCd::MatchCIDR(ipaddr, mask, ascii_case_insensitive_map))