]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Fixed bug where putting too many spaces in a privmsg disconnected the user
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 3b11f8d1695ee8bf89d0f926f54ae9b2191b30c2..d0fa2d71be64d5a14e15c467b5529728e801ed2f 100644 (file)
@@ -3419,6 +3419,7 @@ void Error(int status)
        exit(status);
 }
 
+
 int main (int argc, char *argv[])
 {
        Start();
@@ -3645,7 +3646,7 @@ void handle_privmsg(char **parameters, int pcnt, userrec *user)
                        
                        int MOD_RESULT = 0;
 
-                       FOREACH_RESULT(OnUserPreMessage(user,chan,TYPE_USER,std::string(parameters[1])));
+                       FOREACH_RESULT(OnUserPreMessage(user,chan,TYPE_CHANNEL,std::string(parameters[1])));
                        if (MOD_RESULT) {
                                return;
                        }
@@ -4298,7 +4299,7 @@ void handle_modules(char **parameters, int pcnt, userrec *user)
        for (int i = 0; i < module_names.size(); i++)
        {
                        Version V = modules[i]->GetVersion();
-                       WriteServ(user->fd,"900 0x%08lx %d.%d.%d.%d :%s",modules[i],V.Major,V.Minor,V.Revision,V.Build,module_names[i].c_str());
+                       WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,module_names[i].c_str());
        }
 }
 
@@ -4681,10 +4682,19 @@ void process_command(userrec *user, char* cmd)
        }
        
        int total_params = 0;
-       for (int q = 0; q < strlen(cmd); q++)
+       if (strlen(cmd)>2)
        {
-               if (cmd[q] == ' ')
-                       total_params++;
+               for (int q = 0; q < strlen(cmd)-1; q++)
+               {
+                       if ((cmd[q] == ' ') && (cmd[q+1] == ':'))
+                       {
+                               total_params++;
+                               // found a 'trailing', we dont count them after this.
+                               break;
+                       }
+                       if (cmd[q] == ' ')
+                               total_params++;
+               }
        }
        
        // another phidjit bug...