]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/uid.cpp
Fix various rline bugs, implement /stats R, and fix the issue where you get no error...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / uid.cpp
index abde297a253a8cee368ef6ce9db2d06542471cb5..14c4e2bb59077c4037d637360b73d0c1b7ef248b 100644 (file)
@@ -114,24 +114,35 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
        unsigned int paramptr = 9;
        for (std::string::iterator v = params[8].begin(); v != params[8].end(); v++)
        {
+               if (*v == '+')
+                       continue;
+
                /* For each mode thats set, increase counter */
                ModeHandler* mh = Instance->Modes->FindMode(*v, MODETYPE_USER);
 
                if (mh)
                {
-                       if (mh->GetNumParams(true) && (paramptr < params.size()))
-                               mh->OnModeChange(_new, _new, NULL, params[paramptr++], true);
+                       if (mh->GetNumParams(true))
+                       {
+                               if (paramptr < params.size() - 1)
+                                       mh->OnModeChange(_new, _new, NULL, params[paramptr++], true);
+                               else
+                                       Instance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, expected a parameter for user mode '%c' but there aren't enough parameters in the command!", *v);
+                       }
                        else
                                mh->OnModeChange(_new, _new, NULL, empty, true);
                        _new->SetMode(*v, true);
                        mh->ChangeCount(1);
                }
+               else
+                       Instance->Logs->Log("m_spanningtree", DEBUG, "Warning: Broken UID command, unknown user mode '%c' in the mode string!", *v);
        }
 
        //_new->ProcessNoticeMasks(params[7].c_str());
 
        /* now we've done with modes processing, put the + back for remote servers */
-       params[8] = "+" + params[8];
+       if (params[8][0] != '+')
+               params[8] = "+" + params[8];
 
 #ifdef SUPPORT_IP6LINKS
        if (params[6].find_first_of(":") != std::string::npos)