]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Left figure from output
[user/henk/code/inspircd.git] / src / modules.cpp
index 984f9f5be87322fc0a1029fda0a92b97ea80c2f5..f5728acde878a27edca8ba20a455f0b9c6b98101 100644 (file)
@@ -22,17 +22,6 @@ using namespace std;
 #include "inspircd_util.h"
 #include <unistd.h>
 #include <sys/errno.h>
-
-#ifdef USE_KQUEUE
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/time.h>
-#endif
-
-#ifdef USE_EPOLL
-#include <sys/epoll.h>
-#endif
-
 #include <time.h>
 #include <string>
 #ifdef GCC3
@@ -58,15 +47,9 @@ using namespace std;
 #include "helperfuncs.h"
 #include "hashcomp.h"
 #include "socket.h"
+#include "socketengine.h"
 
-#ifdef USE_KQUEUE
-extern int kq;
-#endif
-
-#ifdef USE_EPOLL
-int ep;
-#endif
-
+extern SocketEngine* SE;
 extern int MODCOUNT;
 extern std::vector<Module*> modules;
 extern std::vector<ircd_module*> factory;
@@ -108,7 +91,7 @@ extern int portCount;
 
 extern int ports[MAXSOCKS];
 
-
+class Server;
 
 extern std::stringstream config_f;
 
@@ -303,15 +286,14 @@ std::string Event::GetEventID()
 
 
 // These declarations define the behavours of the base class Module (which does nothing at all)
-               Module::Module() { }
+
+               Module::Module(Server* Me) { }
                Module::~Module() { }
 void           Module::OnUserConnect(userrec* user) { }
 void           Module::OnUserQuit(userrec* user, std::string message) { }
 void           Module::OnUserDisconnect(userrec* user) { }
 void           Module::OnUserJoin(userrec* user, chanrec* channel) { }
 void           Module::OnUserPart(userrec* user, chanrec* channel) { }
-void           Module::OnPacketTransmit(std::string &data, std::string serv) { }
-void           Module::OnPacketReceive(std::string &data, std::string serv) { }
 void           Module::OnRehash(std::string parameter) { }
 void           Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
 int            Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; }
@@ -367,11 +349,28 @@ void              Module::OnGetServerDescription(std::string servername,std::string &descrip
 void           Module::OnSyncUser(userrec* user, Module* proto, void* opaque) { };
 void           Module::OnSyncChannel(chanrec* chan, Module* proto, void* opaque) { };
 void           Module::ProtoSendMode(void* opaque, int target_type, void* target, std::string modeline) { };
-void           OnWallops(userrec* user, std::string text) { };
-
-// server is a wrapper class that provides methods to all of the C-style
-// exports in the core
-//
+void           Module::OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, std::string extname) { };
+void           Module::OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, std::string extname) { };
+void           Module::OnDecodeMetaData(int target_type, void* target, std::string extname, std::string extdata) { };
+void           Module::ProtoSendMetaData(void* opaque, int target_type, void* target, std::string extname, std::string extdata) { };
+void           Module::OnWallops(userrec* user, std::string text) { };
+void           Module::OnChangeHost(userrec* user, std::string newhost) { };
+void           Module::OnChangeName(userrec* user, std::string gecos) { };
+void           Module::OnAddGLine(long duration, userrec* source, std::string reason, std::string hostmask) { };
+void           Module::OnAddZLine(long duration, userrec* source, std::string reason, std::string ipmask) { };
+void           Module::OnAddKLine(long duration, userrec* source, std::string reason, std::string hostmask) { };
+void           Module::OnAddQLine(long duration, userrec* source, std::string reason, std::string nickmask) { };
+void           Module::OnAddELine(long duration, userrec* source, std::string reason, std::string hostmask) { };
+void           Module::OnDelGLine(userrec* source, std::string hostmask) { };
+void           Module::OnDelZLine(userrec* source, std::string ipmask) { };
+void           Module::OnDelKLine(userrec* source, std::string hostmask) { };
+void           Module::OnDelQLine(userrec* source, std::string nickmask) { };
+void           Module::OnDelELine(userrec* source, std::string hostmask) { };
+void           Module::OnCleanup(int target_type, void* item) { };
+
+/* server is a wrapper class that provides methods to all of the C-style
+ * exports in the core
+ */
 
 Server::Server()
 {
@@ -662,26 +661,7 @@ bool Server::UserToPseudo(userrec* user,std::string message)
        user->fd = FD_MAGIC_NUMBER;
        user->ClearBuffer();
        Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
-#ifdef USE_KQUEUE
-        struct kevent ke;
-        EV_SET(&ke, old_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
-        int i = kevent(kq, &ke, 1, 0, 0, NULL);
-        if (i == -1)
-        {
-                log(DEBUG,"kqueue: Failed to remove user from queue!");
-        }
-#endif
-#ifdef USE_EPOLL
-        struct epoll_event ev;
-        ev.events = EPOLLIN | EPOLLET;
-        ev.data.fd = old_fd;
-        int i = epoll_ctl(ep, EPOLL_CTL_DEL, old_fd, &ev);
-        if (i < 0)
-        {
-                log(DEBUG,"epoll: List deletion failure!");
-        }
-#endif
-
+       SE->DelFd(old_fd);
         shutdown(old_fd,2);
         close(old_fd);
        return true;
@@ -695,7 +675,7 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
        Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick);
        kill_link(alive,message.c_str());
        fd_ref_table[zombie->fd] = zombie;
-        for (int i = 0; i != MAXCHANS; i++)
+        for (int i = 0; i < zombie->chans.size(); i++)
         {
                 if (zombie->chans[i].channel != NULL)
                 {