]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_remove.cpp
Added <oper:swhois> to m_swhois, which will override <type:swhois> if specified
[user/henk/code/inspircd.git] / src / modules / m_remove.cpp
index 9966fbfb3ac0fc559cb21e5ae1c5a16e6aeae90e..8d303d3e036688ea4cd0cee6bdb8fdbba30272c0 100644 (file)
@@ -48,7 +48,8 @@ class RemoveBase
        enum ModeLevel { PEON = 0, HALFOP = 1, OP = 2, ADMIN = 3, OWNER = 4, ULINE = 5 };        
  
        /* This little function just converts a chanmode character (U ~ & @ & +) into an integer (5 4 3 2 1 0) */
-       /* XXX - this could be handy in the core, so it can be used elsewhere */
+       /* XXX - We should probably use the new mode prefix rank stuff
+        * for this instead now -- Brain */
        ModeLevel chartolevel(const std::string &privs)
        {
                if(privs.empty())
@@ -180,29 +181,25 @@ class RemoveBase
                        if ((ulevel > PEON) && (ulevel >= tlevel) && (tlevel != OWNER))
                        {
                                // no you can't just go from a std::ostringstream to a std::string, Om. -nenolod
-                               std::ostringstream reason_stream;
-                               std::string reasonparam;
+                               // but you can do this, nenolod -brain
+
+                               std::string reasonparam("No reason given");
                                
                                /* If a reason is given, use it */
                                if(pcnt > 2)
                                {
-                                       /* Use all the remaining parameters as the reason */
-                                       for(int i = 2; i < pcnt; i++)
-                                       {
-                                               reason_stream << " " << parameters[i];
-                                       }
-                                       
-                                       reasonparam = reason_stream.str();
-                                       reason_stream.clear();
+                                       /* Join params 2 ... pcnt - 1 (inclusive) into one */
+                                       irc::stringjoiner reason_join(" ", parameters, 2, pcnt - 1);
+                                       reasonparam = reason_join.GetJoined();
                                }
 
                                /* Build up the part reason string. */
-                               reason = "Removed by " + user->nick + ": " + reasonparam;
+                               reason = std::string("Removed by ") + user->nick + ": " + reasonparam;
 
                                channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick);
                                target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str());
 
-                               if (!channel->PartUser(target, reason.str().c_str()))
+                               if (!channel->PartUser(target, reason.c_str()))
                                        delete channel;
                        }
                        else
@@ -298,7 +295,7 @@ class ModuleRemove : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,1,0,VF_VENDOR,API_VERSION);
+               return Version(1,1,1,0,VF_VENDOR,API_VERSION);
        }
        
 };