diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-08 23:29:21 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-08 23:29:21 +0000 |
commit | 7e843c22e16c81054bad18073d24fe1a07026431 (patch) | |
tree | 44ca0213c7d7a80270b993fec1fbed275ec56424 /src/modules/extra | |
parent | c440038736f749a56dbac1badee5b2f099286117 (diff) |
Update Event and Request APIs
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11808 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 59 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 32 | ||||
-rw-r--r-- | src/modules/extra/m_regex_pcre.cpp | 18 | ||||
-rw-r--r-- | src/modules/extra/m_regex_posix.cpp | 20 | ||||
-rw-r--r-- | src/modules/extra/m_regex_tre.cpp | 18 | ||||
-rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 17 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 57 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 51 | ||||
-rw-r--r-- | src/modules/extra/m_ziplink.cpp | 47 |
9 files changed, 90 insertions, 229 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index a0ac9ffac..a921dea8e 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -99,7 +99,7 @@ class ModuleSQL : public Module ModuleSQL(); ~ModuleSQL(); unsigned long NewID(); - const char* OnRequest(Request* request); + void OnRequest(Request& request); void OnRehash(User* user); Version GetVersion(); }; @@ -340,7 +340,7 @@ class SQLConnection : public classbase mysql_query(connection,initquery.c_str()); /* Parse the command string and dispatch it to mysql */ - SQLrequest& req = queue.front(); + SQLrequest* req = queue.front(); /* Pointer to the buffer we screw around with substitution in */ char* query; @@ -354,17 +354,17 @@ class SQLConnection : public classbase /* The length of the longest parameter */ maxparamlen = 0; - for(ParamL::iterator i = req.query.p.begin(); i != req.query.p.end(); i++) + for(ParamL::iterator i = req->query.p.begin(); i != req->query.p.end(); i++) { if (i->size() > maxparamlen) maxparamlen = i->size(); } /* How many params are there in the query? */ - paramcount = count(req.query.q.c_str(), '?'); + paramcount = count(req->query.q.c_str(), '?'); /* This stores copy of params to be inserted with using numbered params 1;3B*/ - ParamL paramscopy(req.query.p); + ParamL paramscopy(req->query.p); /* To avoid a lot of allocations, allocate enough memory for the biggest the escaped query could possibly be. * sizeofquery + (maxtotalparamlength*2) + 1 @@ -372,16 +372,16 @@ class SQLConnection : public classbase * The +1 is for null-terminating the string for mysql_real_escape_string */ - query = new char[req.query.q.length() + (maxparamlen*paramcount*2) + 1]; + query = new char[req->query.q.length() + (maxparamlen*paramcount*2) + 1]; queryend = query; /* Okay, now we have a buffer large enough we need to start copying the query into it and escaping and substituting * the parameters into it... */ - for(unsigned long i = 0; i < req.query.q.length(); i++) + for(unsigned long i = 0; i < req->query.q.length(); i++) { - if(req.query.q[i] == '?') + if(req->query.q[i] == '?') { /* We found a place to substitute..what fun. * use mysql calls to escape and write the @@ -404,11 +404,11 @@ class SQLConnection : public classbase /* Let's check if it's a numbered param. And also calculate it's number. */ - while ((i < req.query.q.length() - 1) && (req.query.q[i+1] >= '0') && (req.query.q[i+1] <= '9')) + while ((i < req->query.q.length() - 1) && (req->query.q[i+1] >= '0') && (req->query.q[i+1] <= '9')) { numbered = true; ++i; - paramnum = paramnum * 10 + req.query.q[i] - '0'; + paramnum = paramnum * 10 + req->query.q[i] - '0'; } if (paramnum > paramscopy.size() - 1) @@ -424,35 +424,35 @@ class SQLConnection : public classbase queryend += len; } - else if (req.query.p.size()) + else if (req->query.p.size()) { - unsigned long len = mysql_real_escape_string(connection, queryend, req.query.p.front().c_str(), req.query.p.front().length()); + unsigned long len = mysql_real_escape_string(connection, queryend, req->query.p.front().c_str(), req->query.p.front().length()); queryend += len; - req.query.p.pop_front(); + req->query.p.pop_front(); } else break; } else { - *queryend = req.query.q[i]; + *queryend = req->query.q[i]; queryend++; } } *queryend = 0; - req.query.q = query; + req->query.q = query; - if (!mysql_real_query(connection, req.query.q.data(), req.query.q.length())) + if (!mysql_real_query(connection, req->query.q.data(), req->query.q.length())) { /* Successfull query */ res = mysql_use_result(connection); unsigned long rows = mysql_affected_rows(connection); - MySQLresult* r = new MySQLresult(Parent, req.GetSource(), res, rows, req.id); + MySQLresult* r = new MySQLresult(Parent, req->source, res, rows, req->id); r->dbid = this->GetID(); - r->query = req.query.q; + r->query = req->query.q; /* Put this new result onto the results queue. * XXX: Remember to mutex the queue! */ @@ -465,9 +465,9 @@ class SQLConnection : public classbase /* XXX: See /usr/include/mysql/mysqld_error.h for a list of * possible error numbers and error messages */ SQLerror e(SQL_QREPLY_FAIL, ConvToStr(mysql_errno(connection)) + std::string(": ") + mysql_error(connection)); - MySQLresult* r = new MySQLresult(Parent, req.GetSource(), e, req.id); + MySQLresult* r = new MySQLresult(Parent, req->source, e, req->id); r->dbid = this->GetID(); - r->query = req.query.q; + r->query = req->query.q; Parent->ResultsMutex.Lock(); rq.push_back(r); @@ -698,8 +698,8 @@ ModuleSQL::ModuleSQL() : rehashing(false) } ServerInstance->Modules->PublishInterface("SQL", this); - Implementation eventlist[] = { I_OnRehash, I_OnRequest }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 1); } ModuleSQL::~ModuleSQL() @@ -719,23 +719,20 @@ unsigned long ModuleSQL::NewID() return ++currid; } -const char* ModuleSQL::OnRequest(Request* request) +void ModuleSQL::OnRequest(Request& request) { - if(strcmp(SQLREQID, request->GetId()) == 0) + if(strcmp(SQLREQID, request.id) == 0) { - SQLrequest* req = (SQLrequest*)request; + SQLrequest* req = (SQLrequest*)&request; ConnMap::iterator iter; - const char* returnval = NULL; - Dispatcher->LockQueue(); ConnMutex.Lock(); if((iter = Connections.find(req->dbid)) != Connections.end()) { req->id = NewID(); - iter->second->queue.push(*req); - returnval = SQLSUCCESS; + iter->second->queue.push(new SQLrequest(*req)); } else { @@ -747,11 +744,7 @@ const char* ModuleSQL::OnRequest(Request* request) /* Yes, it's possible this will generate a spurious wakeup. * That's fine, it'll just get ignored. */ - - return returnval; } - - return NULL; } void ModuleSQL::OnRehash(User* user) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index c0b2bbac8..df0ca7f42 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -403,8 +403,8 @@ class SQLConn : public EventHandler if(!qinprog && queue.totalsize()) { /* There's no query currently in progress, and there's queries in the queue. */ - SQLrequest& query = queue.front(); - DoQuery(query); + SQLrequest* query = queue.front(); + DoQuery(*query); } if(PQconsumeInput(sql)) @@ -421,10 +421,10 @@ class SQLConn : public EventHandler else if (qinprog) { /* Grab the request we're processing */ - SQLrequest& query = queue.front(); + SQLrequest* query = queue.front(); /* Get a pointer to the module we're about to return the result to */ - Module* to = query.GetSource(); + Module* to = query->source; /* Fetch the result.. */ PGresult* result = PQgetResult(sql); @@ -444,10 +444,10 @@ class SQLConn : public EventHandler if(to) { /* ..and the result */ - PgSQLresult reply(us, to, query.id, result); + PgSQLresult reply(us, to, query->id, result); /* Fix by brain, make sure the original query gets sent back in the reply */ - reply.query = query.query.q; + reply.query = query->query.q; switch(PQresultStatus(result)) { @@ -709,13 +709,13 @@ class SQLConn : public EventHandler SQLerror Query(const SQLrequest &req) { - queue.push(req); + queue.push(new SQLrequest(req)); if(!qinprog && queue.totalsize()) { /* There's no query currently in progress, and there's queries in the queue. */ - SQLrequest& query = queue.front(); - return DoQuery(query); + SQLrequest* query = queue.front(); + return DoQuery(*query); } else { @@ -782,8 +782,8 @@ class ModulePgSQL : public Module ReadConf(); ServerInstance->Modules->PublishInterface("SQL", this); - Implementation eventlist[] = { I_OnUnloadModule, I_OnRequest, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, 3); + Implementation eventlist[] = { I_OnUnloadModule, I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 2); } virtual ~ModulePgSQL() @@ -911,27 +911,23 @@ class ModulePgSQL : public Module ServerInstance->Timers->AddTimer(retimer); } - virtual const char* OnRequest(Request* request) + void OnRequest(Request& request) { - if(strcmp(SQLREQID, request->GetId()) == 0) + if(strcmp(SQLREQID, request.id) == 0) { - SQLrequest* req = (SQLrequest*)request; + SQLrequest* req = (SQLrequest*)&request; ConnMap::iterator iter; if((iter = connections.find(req->dbid)) != connections.end()) { /* Execute query */ req->id = NewID(); req->error = iter->second->Query(*req); - - return (req->error.Id() == SQL_NO_ERROR) ? sqlsuccess : NULL; } else { req->error.Id(SQL_BAD_DBID); - return NULL; } } - return NULL; } virtual void OnUnloadModule(Module* mod, const std::string& name) diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 782847736..16d0cfe15 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -72,8 +72,6 @@ class ModuleRegexPCRE : public Module public: ModuleRegexPCRE() { ServerInstance->Modules->PublishInterface("RegularExpression", this); - Implementation eventlist[] = { I_OnRequest }; - ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() @@ -86,20 +84,18 @@ public: ServerInstance->Modules->UnpublishInterface("RegularExpression", this); } - virtual const char* OnRequest(Request* request) + void OnRequest(Request& request) { - if (strcmp("REGEX-NAME", request->GetId()) == 0) + if (strcmp("REGEX-NAME", request.id) == 0) { - return "pcre"; + static_cast<RegexNameRequest&>(request).result = "pcre"; } - else if (strcmp("REGEX", request->GetId()) == 0) + else if (strcmp("REGEX", request.id) == 0) { - RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; - std::string rx = rfr->GetRegex(); - rfr->result = new PCRERegex(rx); - return "OK"; + RegexFactoryRequest& rfr = (RegexFactoryRequest&)request; + std::string rx = rfr.GetRegex(); + rfr.result = new PCRERegex(rx); } - return NULL; } }; diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 7afaad076..62b44e0e4 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -78,8 +78,8 @@ private: public: ModuleRegexPOSIX() { ServerInstance->Modules->PublishInterface("RegularExpression", this); - Implementation eventlist[] = { I_OnRequest, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 1); OnRehash(NULL); } @@ -99,20 +99,18 @@ public: extended = Conf.ReadFlag("posix", "extended", 0); } - virtual const char* OnRequest(Request* request) + void OnRequest(Request& request) { - if (strcmp("REGEX-NAME", request->GetId()) == 0) + if (strcmp("REGEX-NAME", request.id) == 0) { - return "posix"; + static_cast<RegexNameRequest&>(request).result = "posix"; } - else if (strcmp("REGEX", request->GetId()) == 0) + else if (strcmp("REGEX", request.id) == 0) { - RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; - std::string rx = rfr->GetRegex(); - rfr->result = new POSIXRegex(rx, extended); - return "OK"; + RegexFactoryRequest& rfr = (RegexFactoryRequest&)request; + std::string rx = rfr.GetRegex(); + rfr.result = new POSIXRegex(rx, extended); } - return NULL; } }; diff --git a/src/modules/extra/m_regex_tre.cpp b/src/modules/extra/m_regex_tre.cpp index 41aaec31c..f2a9004bd 100644 --- a/src/modules/extra/m_regex_tre.cpp +++ b/src/modules/extra/m_regex_tre.cpp @@ -78,8 +78,6 @@ class ModuleRegexTRE : public Module public: ModuleRegexTRE() { ServerInstance->Modules->PublishInterface("RegularExpression", this); - Implementation eventlist[] = { I_OnRequest }; - ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() @@ -92,20 +90,18 @@ public: ServerInstance->Modules->UnpublishInterface("RegularExpression", this); } - virtual const char* OnRequest(Request* request) + void OnRequest(Request& request) { - if (strcmp("REGEX-NAME", request->GetId()) == 0) + if (strcmp("REGEX-NAME", request.id) == 0) { - return "tre"; + static_cast<RegexNameRequest&>(request).result = "tre"; } - else if (strcmp("REGEX", request->GetId()) == 0) + else if (strcmp("REGEX", request.id) == 0) { - RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; - std::string rx = rfr->GetRegex(); - rfr->result = new TRERegex(rx); - return "OK"; + RegexFactoryRequest& rfr = (RegexFactoryRequest&)request; + std::string rx = rfr.GetRegex(); + rfr.result = new TRERegex(rx); } - return NULL; } }; diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 806cbce72..680053bf1 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -399,7 +399,7 @@ class SQLConn : public classbase *queryend = 0; req.query.q = query; - SQLite3Result* res = new SQLite3Result(mod, req.GetSource(), req.id); + SQLite3Result* res = new SQLite3Result(mod, req.source, req.id); res->dbid = host.id; res->query = req.query.q; paramlist params; @@ -467,7 +467,7 @@ class SQLConn : public classbase while (results.size()) { SQLite3Result* res = results[0]; - if (res->GetDest()) + if (res->dest) { res->Send(); } @@ -552,8 +552,8 @@ class ModuleSQLite3 : public Module ReadConf(); ServerInstance->Modules->PublishInterface("SQL", this); - Implementation eventlist[] = { I_OnRequest, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual ~ModuleSQLite3() @@ -695,25 +695,22 @@ class ModuleSQLite3 : public Module ReadConf(); } - virtual const char* OnRequest(Request* request) + void OnRequest(Request& request) { - if(strcmp(SQLREQID, request->GetId()) == 0) + if(strcmp(SQLREQID, request.id) == 0) { - SQLrequest* req = (SQLrequest*)request; + SQLrequest* req = (SQLrequest*)&request; ConnMap::iterator iter; if((iter = connections.find(req->dbid)) != connections.end()) { req->id = NewID(); req->error = iter->second->Query(*req); - return SQLSUCCESS; } else { req->error.Id(SQL_BAD_DBID); - return NULL; } } - return NULL; } unsigned long NewID() diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 813ae9e9b..3530b0e1f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -14,7 +14,7 @@ #include "inspircd.h" #include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include "transport.h" +#include "ssl.h" #include "m_cap.h" #ifdef WINDOWS @@ -160,7 +160,7 @@ class ModuleSSLGnuTLS : public Module // Void return, guess we assume success gnutls_certificate_set_dh_params(x509_cred, dh_params); - Implementation eventlist[] = { I_On005Numeric, I_OnRequest, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, + Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, I_OnEvent, I_OnHookIO }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); @@ -352,52 +352,11 @@ class ModuleSSLGnuTLS : public Module } } - const char* OnRequest(Request* request) + void OnRequest(Request& request) { - ISHRequest* ISR = static_cast<ISHRequest*>(request); - if (strcmp("IS_NAME", request->GetId()) == 0) - { - return "gnutls"; - } - else if (strcmp("IS_HOOK", request->GetId()) == 0) - { - ISR->Sock->AddIOHook(this); - return "OK"; - } - else if (strcmp("IS_UNHOOK", request->GetId()) == 0) - { - ISR->Sock->DelIOHook(); - return "OK"; - } - else if (strcmp("IS_HSDONE", request->GetId()) == 0) - { - if (ISR->Sock->GetFd() < 0) - return "OK"; - - issl_session* session = &sessions[ISR->Sock->GetFd()]; - return (session->status == ISSL_HANDSHAKING_READ || session->status == ISSL_HANDSHAKING_WRITE) ? NULL : "OK"; - } - else if (strcmp("IS_ATTACH", request->GetId()) == 0) - { - if (ISR->Sock->GetFd() > -1) - { - issl_session* session = &sessions[ISR->Sock->GetFd()]; - if (session->sess) - { - if (static_cast<Extensible*>(ServerInstance->SE->GetRef(ISR->Sock->GetFd())) == static_cast<Extensible*>(ISR->Sock)) - { - return "OK"; - } - } - } - } - else if (strcmp("GET_CERT", request->GetId()) == 0) - { - Module* sslinfo = ServerInstance->Modules->Find("m_sslinfo.so"); - if (sslinfo) - return sslinfo->OnRequest(request); - } - return NULL; + Module* sslinfo = ServerInstance->Modules->Find("m_sslinfo.so"); + if (sslinfo) + sslinfo->OnRequest(request); } @@ -735,10 +694,10 @@ class ModuleSSLGnuTLS : public Module info_done_dealloc: gnutls_x509_crt_deinit(cert); info_done: - BufferedSocketFingerprintSubmission(user, this, sslinfo, certinfo).Send(); + SSLCertSubmission(user, this, sslinfo, certinfo); } - void OnEvent(Event* ev) + void OnEvent(Event& ev) { capHandler.HandleEvent(ev); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index f566b326b..8af930aa9 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -14,7 +14,7 @@ #include "inspircd.h" #include <openssl/ssl.h> #include <openssl/err.h> -#include "transport.h" +#include "ssl.h" #ifdef WINDOWS #pragma comment(lib, "libeay32MTd") @@ -128,7 +128,7 @@ class ModuleSSLOpenSSL : public Module // Needs the flag as it ignores a plain /rehash OnModuleRehash(NULL,"ssl"); Implementation eventlist[] = { - I_On005Numeric, I_OnRequest, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, + I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnPostConnect, I_OnHookIO }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } @@ -291,46 +291,11 @@ class ModuleSSLOpenSSL : public Module } - const char* OnRequest(Request* request) + void OnRequest(Request& request) { - ISHRequest* ISR = (ISHRequest*)request; - if (strcmp("IS_NAME", request->GetId()) == 0) - { - return "openssl"; - } - else if (strcmp("IS_HOOK", request->GetId()) == 0) - { - ISR->Sock->AddIOHook(this); - return "OK"; - } - else if (strcmp("IS_UNHOOK", request->GetId()) == 0) - { - ISR->Sock->DelIOHook(); - return "OK"; - } - else if (strcmp("IS_HSDONE", request->GetId()) == 0) - { - if (ISR->Sock->GetFd() < 0) - return "OK"; - - issl_session* session = &sessions[ISR->Sock->GetFd()]; - return (session->status == ISSL_HANDSHAKING) ? NULL : "OK"; - } - else if (strcmp("IS_ATTACH", request->GetId()) == 0) - { - issl_session* session = &sessions[ISR->Sock->GetFd()]; - if (session->sess) - { - return "OK"; - } - } - else if (strcmp("GET_CERT", request->GetId()) == 0) - { - Module* sslinfo = ServerInstance->Modules->Find("m_sslinfo.so"); - if (sslinfo) - return sslinfo->OnRequest(request); - } - return NULL; + Module* sslinfo = ServerInstance->Modules->Find("m_sslinfo.so"); + if (sslinfo) + sslinfo->OnRequest(request); } @@ -618,7 +583,7 @@ class ModuleSSLOpenSSL : public Module if (!cert) { certinfo->error = "Could not get peer certificate: "+std::string(get_error()); - BufferedSocketFingerprintSubmission(user, this, sslinfo, certinfo).Send(); + SSLCertSubmission(user, this, sslinfo, certinfo); return; } @@ -653,7 +618,7 @@ class ModuleSSLOpenSSL : public Module } X509_free(cert); - BufferedSocketFingerprintSubmission(user, this, sslinfo, certinfo).Send(); + SSLCertSubmission(user, this, sslinfo, certinfo); } void Prioritize() diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 976a27b5c..4b53cf389 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -13,12 +13,10 @@ #include "inspircd.h" #include <zlib.h> -#include "transport.h" #include <iostream> /* $ModDesc: Provides zlib link support for servers */ /* $LinkerFlags: -lz */ -/* $ModDep: transport.h */ /* * ZLIB_BEST_COMPRESSION (9) is used for all sending of data with @@ -57,7 +55,7 @@ class ModuleZLib : public Module public: ModuleZLib() - { + { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); sessions = new izip_session[ServerInstance->SE->GetMaxFds()]; @@ -66,8 +64,8 @@ class ModuleZLib : public Module total_out_compressed = total_in_compressed = 0; total_out_uncompressed = total_in_uncompressed = 0; - Implementation eventlist[] = { I_OnStats, I_OnRequest }; - ServerInstance->Modules->Attach(eventlist, this, 2); + Implementation eventlist[] = { I_OnStats }; + ServerInstance->Modules->Attach(eventlist, this, 1); // Allocate a buffer which is used for reading and writing data net_buffer_size = ServerInstance->Config->NetBufferSize; @@ -83,44 +81,7 @@ class ModuleZLib : public Module Version GetVersion() { - return Version("Provides zlib link support for servers", VF_VENDOR, API_VERSION); - } - - - /* Handle BufferedSocketHook API requests */ - const char* OnRequest(Request* request) - { - ISHRequest* ISR = (ISHRequest*)request; - if (strcmp("IS_NAME", request->GetId()) == 0) - { - /* Return name */ - return "zip"; - } - else if (strcmp("IS_HOOK", request->GetId()) == 0) - { - ISR->Sock->AddIOHook(this); - return "OK"; - } - else if (strcmp("IS_UNHOOK", request->GetId()) == 0) - { - ISR->Sock->DelIOHook(); - return "OK"; - } - else if (strcmp("IS_HSDONE", request->GetId()) == 0) - { - /* Check for completion of handshake - * (actually, this module doesnt handshake) - */ - return "OK"; - } - else if (strcmp("IS_ATTACH", request->GetId()) == 0) - { - /* Attach certificate data to the inspsocket - * (this module doesnt do that, either) - */ - return NULL; - } - return NULL; + return Version("Provides zlib link support for servers", VF_VENDOR); } /* Handle stats z (misc stats) */ |