]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add an optional bool to ModeParser::ModeString() to not give the nickname n times...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 1 Apr 2008 16:25:02 +0000 (16:25 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 1 Apr 2008 16:25:02 +0000 (16:25 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9242 e03df62e-2008-0410-955e-edbf42e46eb7

include/mode.h
src/mode.cpp

index f6022c0901e80a577e00e05578d6fcd66772cc11..ea52acf362a63ecf136a9f82e9d3cc33e8d0bffa 100644 (file)
@@ -520,9 +520,11 @@ class CoreExport ModeParser : public classbase
         * similar purposes.
         * @param user The username to look up
         * @param channel The channel name to look up the privilages of the user for
+        * @param nick_suffix true (the default) if you want nicknames in the mode string, for easy
+        * use with the mode stacker, false if you just want the "avh" part of "avh nick nick nick".
         * @return The mode string.
         */
-       std::string ModeString(User* user, Channel* channel);
+       std::string ModeString(User* user, Channel* channel, bool nick_suffix = true);
 };
 
 #endif
index db9641edbb77662b42c2479729d7926577152c9c..9b90599ceeb587203b8288b4a836df90a07eb79b 100644 (file)
@@ -879,7 +879,7 @@ ModeHandler* ModeParser::FindPrefix(unsigned const char pfxletter)
        return NULL;
 }
 
-std::string ModeParser::ModeString(User* user, Channel* channel)
+std::string ModeParser::ModeString(User* user, Channel* channel, bool nick_suffix)
 {
        std::string types;
        std::string pars;
@@ -897,14 +897,20 @@ std::string ModeParser::ModeString(User* user, Channel* channel)
                        ret = mh->ModeSet(NULL, user, channel, user->nick);
                        if ((ret.first) && (ret.second == user->nick))
                        {
-                               pars.append(" ");
-                               pars.append(user->nick);
+                               if (nick_suffix)
+                               {
+                                       pars.append(" ");
+                                       pars.append(user->nick);
+                               }
                                types.push_back(mh->GetModeChar());
                        }
                }
        }
 
-       return types+pars;
+       if (nick_suffix)
+               return types+pars;
+       else
+               return types;
 }
 
 std::string ModeParser::ChanModes()