]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
(TEST CODE) remote ping, do not use until debugged
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index 454604303161901ed84e4fc3937277de3d25cdd8..fc4ec970f69f59285f6073579b706b8ae7453777 100644 (file)
@@ -1286,7 +1286,10 @@ int usercount_invisible(void)
 
 int usercount_opers(void)
 {
-        return all_opers.size();
+       int c = 0;
+       for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
+               if (*i->second->oper) c++;
+        return c;
 }
 
 int usercount_unknown(void)
@@ -1462,3 +1465,36 @@ int InsertMode(std::string &output, const char* mode, unsigned short section)
        output.insert(pos, mode);
        return 1;
 }
+
+bool IsValidChannelName(const char *chname)
+{
+               char *c;
+
+               /* check for no name - don't check for !*chname, as if it is empty, it won't be '#'! */
+               if (!chname || *chname != '#')
+               {
+                               return false;
+               }
+
+               c = (char *)chname + 1;
+               while (*c)
+               {
+                               switch (*c)
+                               {
+                                               case ' ':
+                                               case ',':
+                                               case 7:
+                                                               return false;
+                               }
+
+                               c++;
+               }
+               
+               /* too long a name - note funky pointer arithmetic here. */
+               if ((c - chname) > CHANMAX)
+               {
+                               return false;
+               }
+
+               return true;
+}