]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
EXPERIMENTAL new socket engine code
[user/henk/code/inspircd.git] / src / channels.cpp
index 0995a2eaa55847bde1f67be66560ba06ad805738..6af23d3b0e1cbc7ca00ff2418c903bfd837f7e27 100644 (file)
  * ---------------------------------------------------
  */
 
+using namespace std;
+
+#include "inspircd_config.h"
 #include "inspircd.h"
 #include "inspircd_io.h"
 #include "inspircd_util.h"
-#include "inspircd_config.h"
 #include <unistd.h>
-#include <fcntl.h>
 #include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/utsname.h>
-#include <cstdio>
 #include <time.h>
 #include <string>
 #ifdef GCC3
 #include <map>
 #include <sstream>
 #include <vector>
-#include <errno.h>
 #include <deque>
-#include <errno.h>
-#include <unistd.h>
-#include <sched.h>
-#include "connection.h"
 #include "users.h"
-#include "servers.h"
 #include "ctables.h"
 #include "globals.h"
 #include "modules.h"
@@ -50,6 +44,8 @@
 #include "message.h"
 #include "mode.h"
 #include "xline.h"
+#include "inspstring.h"
+#include "helperfuncs.h"
 
 #ifdef GCC3
 #define nspace __gnu_cxx
 #define nspace std
 #endif
 
-using namespace std;
-
 extern int MODCOUNT;
-extern vector<Module*> modules;
-extern vector<ircd_module*> factory;
+extern std::vector<Module*> modules;
+extern std::vector<ircd_module*> factory;
 
 extern int LogLevel;
 extern char ServerName[MAXBUF];
@@ -87,22 +81,18 @@ extern int NetBufferSize;
 int MaxWhoResults;
 extern time_t nb_start;
 
-extern std::vector<int> fd_reap;
 extern std::vector<std::string> module_names;
 
 extern int boundPortCount;
 extern int portCount;
-extern int UDPportCount;
+
 extern int ports[MAXSOCKS];
-extern int defaultRoute;
 
-extern std::vector<long> auth_cookies;
 extern std::stringstream config_f;
 
-extern serverrec* me[32];
-
 extern FILE *log_file;
 
+extern time_t TIME;
 
 using namespace std;
 
@@ -116,13 +106,14 @@ chanrec::chanrec()
        strcpy(setby,"");
        strcpy(key,"");
        created = topicset = limit = 0;
-       topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
+       binarymodes = 0;
+       internal_userlist.clear();
 }
 
 void chanrec::SetCustomMode(char mode,bool mode_on)
 {
        if (mode_on) {
-               char m[3];
+               static char m[3];
                m[0] = mode;
                m[1] = '\0';
                if (!strchr(this->custom_modes,mode))
@@ -189,9 +180,39 @@ std::string chanrec::GetModeParameter(char mode)
                {
                        if ((i->mode == mode) && (!strcasecmp(this->name,i->channel)))
                        {
-                               return std::string(i->parameter);
+                               return i->parameter;
                        }
                }
        }
-       return std::string("");
+       return "";
+}
+
+long chanrec::GetUserCounter()
+{
+       return (this->internal_userlist.size());
+}
+
+void chanrec::AddUser(char* castuser)
+{
+       internal_userlist.push_back(castuser);
+       log(DEBUG,"Added casted user to channel's internal list");
+}
+
+void chanrec::DelUser(char* castuser)
+{
+       for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++)
+       {
+               if (*a == castuser)
+               {
+                       log(DEBUG,"Removed casted user from channel's internal list");
+                       internal_userlist.erase(a);
+                       return;
+               }
+       }
+       log(DEBUG,"BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!",name);
+}
+
+std::vector<char*> *chanrec::GetUsers()
+{
+       return &internal_userlist;
 }