]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/u_listmode.h
Remove calls to strdup() in core, it is not better than std::string
[user/henk/code/inspircd.git] / include / u_listmode.h
index b08ad8d4dc82ec131cc8f20c9fc8b3877168688e..0a2c25710568235ea65fc90211f25c64ef0456fe 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *         the file COPYING for details.
@@ -200,9 +200,6 @@ class ListModeBase : public ModeHandler
                if (el)
                {
                        irc::modestacker modestack(ServerInstance, false);
-                       std::deque<std::string> stackresult;
-                       std::vector<std::string> mode_junk;
-                       mode_junk.push_back(channel->name);
 
                        for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
@@ -215,14 +212,13 @@ class ListModeBase : public ModeHandler
                        if (stack)
                                return;
 
+                       std::vector<std::string> stackresult;
+                       stackresult.push_back(channel->name);
                        while (modestack.GetStackedLine(stackresult))
                        {
-                               for (size_t j = 0; j < stackresult.size(); j++)
-                               {
-                                       mode_junk.push_back(stackresult[j]);
-                               }
-
-                               ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
+                               ServerInstance->SendMode(stackresult, ServerInstance->FakeClient);
+                               stackresult.clear();
+                               stackresult.push_back(channel->name);
                        }
                }
        }
@@ -422,7 +418,9 @@ class ListModeBase : public ModeHandler
                modelist* mlist;
                chan->GetExt(infokey, mlist);
                irc::modestacker modestack(ServerInstance, true);
-               std::deque<std::string> stackresult;
+               std::vector<std::string> stackresult;
+               std::vector<TranslateType> types;
+               types.push_back(TR_TEXT);
                if (mlist)
                {
                        for (modelist::iterator it = mlist->begin(); it != mlist->end(); it++)
@@ -432,9 +430,9 @@ class ListModeBase : public ModeHandler
                }
                while (modestack.GetStackedLine(stackresult))
                {
-                       irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1);
-                       std::string line = mode_join.GetJoined();
-                       proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, line);
+                       types.assign(stackresult.size(), this->GetTranslateType());
+                       proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, stackresult, types);
+                       stackresult.clear();
                }
        }