]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Fix this not working.
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index 506b6e2d6d3006822665e98c0b7d8b285bba9feb..37a9e1b0417e42321e113906b1a761472495018b 100644 (file)
@@ -308,42 +308,29 @@ int InspIRCd::RegisteredUserCount()
        return clientlist->size() - this->UnregisteredUserCount();
 }
 
-int InspIRCd::InvisibleUserCount()
+int InspIRCd::ModeCount(const char mode)
 {
-       int c = 0;
+       ModeHandler* mh = this->Modes->FindMode(mode, MODETYPE_USER);
 
-       for (user_hash::const_iterator i = clientlist->begin(); i != clientlist->end(); i++)
-       {
-               c += ((i->second->registered == REG_ALL) && (i->second->modes[UM_INVISIBLE]));
-       }
+       if (mh)
+               return mh->GetCount();
+       else
+               return 0;
+}
 
-       return c;
+int InspIRCd::InvisibleUserCount()
+{
+       return ModeCount('i');
 }
 
 int InspIRCd::OperCount()
 {
-       int c = 0;
-
-       for (user_hash::const_iterator i = clientlist->begin(); i != clientlist->end(); i++)
-       {
-               if (*(i->second->oper))
-                       c++;
-       }
-       return c;
+       return this->all_opers.size();
 }
 
 int InspIRCd::UnregisteredUserCount()
 {
-       int c = 0;
-
-       for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
-       {
-               userrec* t = (userrec*)(*i);
-               if (t->registered != REG_ALL)
-                       c++;
-       }
-
-       return c;
+       return this->unregistered_count;
 }
 
 long InspIRCd::ChannelCount()
@@ -353,18 +340,10 @@ long InspIRCd::ChannelCount()
 
 long InspIRCd::LocalUserCount()
 {
-       int c = 0;
-
-       for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
-       {
-               userrec* t = (userrec*)(*i);
-               if (t->registered == REG_ALL)
-                       c++;
-       }
-
-       return c;
+       /* Doesnt count unregistered clients */
+       return (local_users.size() - this->UnregisteredUserCount());
 }
-
+       
 bool InspIRCd::IsChannel(const char *chname)
 {
        char *c;
@@ -429,8 +408,6 @@ bool InspIRCd::IsNick(const char* n)
 void InspIRCd::OpenLog(char** argv, int argc)
 {
        Config->MyDir = ServerConfig::GetFullProgDir(argv,argc);
-       Config->argv = argv;
-       Config->argc = argc;
 
        if (!*this->LogFileName)
        {