]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/mode.cpp
Add a metric assload of TRANSLATE macros to modules.
[user/henk/code/inspircd.git] / src / mode.cpp
index 14dd39b335a25630bbbeee4e724795469fa54003..7321d11c425a9cb86a539a33d72e2695f081a358 100644 (file)
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "modules.h"
 #include "inspstring.h"
-#include "mode.h"
 
 /* +s (secret) */
 #include "modes/cmode_s.h"
@@ -79,6 +76,7 @@ unsigned int ModeHandler::GetCount()
 void ModeHandler::ChangeCount(int modifier)
 {
        count += modifier;
+       ServerInstance->Log(DEBUG,"Change count for mode %c is now %d", mode, count);
 }
 
 ModeType ModeHandler::GetModeType()
@@ -127,6 +125,10 @@ void ModeHandler::DisplayList(userrec* user, chanrec* channel)
 {
 }
 
+void ModeHandler::DisplayEmptyList(userrec* user, chanrec* channel)
+{
+}
+
 bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
 {
        return (ours < theirs);
@@ -326,6 +328,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
                                if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
                                {
                                        user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
+                                       mh->DisplayEmptyList(user, targetchannel);
                                        continue;
                                }
 
@@ -484,7 +487,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
 
                                                                        /* Yerk, invalid! */
                                                                        if ((parameter.find(':') == 0) || (parameter.rfind(' ') != std::string::npos))
-                                                                               parameter = "";
+                                                                               parameter.clear();
                                                                }
                                                                else
                                                                {
@@ -564,6 +567,8 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
                                                                /* Add the mode letter */
                                                                output_sequence.push_back(modechar);
 
+                                                               modehandlers[handler_id]->ChangeCount(adding ? 1 : -1);
+
                                                                /* Is there a valid parameter for this mode? If so add it to the parameter list */
                                                                if ((modehandlers[handler_id]->GetNumParams(adding)) && (!parameter.empty()))
                                                                {
@@ -691,7 +696,7 @@ bool ModeParser::AddMode(ModeHandler* mh, unsigned const char modeletter)
         * If they do that, thats their problem, and if i ever EVER see an
         * official InspIRCd developer do that, i'll beat them with a paddle!
         */
-       if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z'))
+       if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z') || (mh->GetPrefix() > 126))
                return false;
 
        /* A mode prefix of ',' is not acceptable, it would fuck up server to server.