diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-11-01 23:02:23 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-11-01 23:02:23 +0000 |
commit | 78f26492a65b438f5b87f1574ed7785fd77ae2f0 (patch) | |
tree | 769bec57879b1efa3ae37e0d8cb7b8de29b62452 /src/modules | |
parent | b438e659fea8d3808b4648d7fc77abccbb6165fc (diff) |
Second attempt at time() -> SI->Time(), now problems with the original were fixed. (SI::TIME was not initialised).
Thanks Namegduf!
(Please test, all, valdebug etc, report odd behaviour/warnings!)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10783 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 9 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_testclient.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_callerid.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_messageflood.cpp | 16 | ||||
-rw-r--r-- | src/modules/m_nickflood.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_randquote.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/handshaketimer.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_timedbans.cpp | 2 |
14 files changed, 36 insertions, 31 deletions
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index e57e40354..a3f995355 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -28,6 +28,8 @@ std::map<unsigned long,QueryInfo*> active_queries; class QueryInfo { +private: + InspIRCd* ServerInstance; public: QueryState qs; unsigned long id; @@ -41,8 +43,9 @@ public: time_t date; bool insert; - QueryInfo(const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) + QueryInfo(InspIRCd* Instance, const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) { + ServerInstance = Instance; qs = FIND_SOURCE; nick = n; source = s; @@ -50,7 +53,7 @@ public: id = i; category = cat; sourceid = nickid = hostid = -1; - date = time(NULL); + date = ServerInstance->Time(); insert = false; } @@ -250,7 +253,7 @@ class ModuleSQLLog : public Module SQLrequest req = SQLrequest(this, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { - QueryInfo* i = new QueryInfo(nick, source, host, req.id, category); + QueryInfo* i = new QueryInfo(ServerInstance, nick, source, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index adbd48fb6..cd0af7e8b 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -903,7 +903,7 @@ class ModuleSSLGnuTLS : public Module /* Beware here we do not check for errors. */ - if ((gnutls_x509_crt_get_expiration_time(cert) < time(0)) || (gnutls_x509_crt_get_activation_time(cert) > time(0))) + if ((gnutls_x509_crt_get_expiration_time(cert) < ServerInstance->Time()) || (gnutls_x509_crt_get_activation_time(cert) > ServerInstance->Time())) { certinfo->data.insert(std::make_pair("error","Not activated, or expired certificate")); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 389fffb85..796db66d7 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -871,7 +871,7 @@ class ModuleSSLOpenSSL : public Module certinfo->data.insert(std::make_pair("fingerprint",irc::hex(md, n))); } - if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), time(NULL)) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), time(NULL)) == 0)) + if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), ServerInstance->Time()) == 0)) { certinfo->data.insert(std::make_pair("error","Not activated, or expired certificate")); } diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index c5c07efc0..d80070939 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -40,7 +40,7 @@ public: if(target) { SQLrequest foo = SQLrequest(this, target, "foo", - SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % time(NULL)); + SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % ServerInstance->Time()); if(foo.Send()) { diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 0204ee77f..d8e50b280 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -338,7 +338,7 @@ public: if (i == dat->accepting.end()) { - time_t now = time(NULL); + time_t now = ServerInstance->Time(); /* +g and *not* accepted */ user->WriteNumeric(716, "%s %s :is in +g mode (server-side ignore).", user->nick.c_str(), dest->nick.c_str()); if (now > (dat->lastnotify + (time_t)notify_cooldown)) diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 33ba98aa4..40a007c2c 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -33,7 +33,7 @@ class joinfloodsettings : public classbase joinfloodsettings(int b, int c) : secs(b), joins(c) { - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; counter = 0; locked = false; }; @@ -41,10 +41,10 @@ class joinfloodsettings : public classbase void addjoin() { counter++; - if (time(NULL) > reset) + if (ServerInstance->Time() > reset) { counter = 0; - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; } } @@ -62,7 +62,7 @@ class joinfloodsettings : public classbase { if (locked) { - if (time(NULL) > unlocktime) + if (ServerInstance->Time() > unlocktime) { locked = false; return false; @@ -78,7 +78,7 @@ class joinfloodsettings : public classbase void lock() { locked = true; - unlocktime = time(NULL) + 60; + unlocktime = ServerInstance->Time() + 60; } }; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index cd027f089..bf5e10595 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -141,7 +141,7 @@ public: for (delaylist::iterator iter = dl->begin(); iter != dl->end(); iter++) { - if (iter->second > time(NULL)) + if (iter->second > ServerInstance->Time()) { if (iter->first == user) { @@ -180,7 +180,7 @@ public: dl = new delaylist; chan->Extend("norejoinusers", dl); } - (*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J')); + (*dl)[user] = ServerInstance->Time() + strtoint(chan->GetModeParameter('J')); } } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index c374c5346..53df408f6 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -19,6 +19,8 @@ */ class floodsettings : public classbase { + private: + InspIRCd *ServerInstance; public: bool ban; int secs; @@ -26,10 +28,10 @@ class floodsettings : public classbase time_t reset; std::map<User*,int> counters; - floodsettings() : ban(0), secs(0), lines(0) {}; - floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c) + floodsettings(InspIRCd *Instance) : ServerInstance(Instance), ban(0), secs(0), lines(0) {}; + floodsettings(InspIRCd *Instance, bool a, int b, int c) : ServerInstance(Instance), ban(a), secs(b), lines(c) { - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; }; void addmessage(User* who) @@ -43,10 +45,10 @@ class floodsettings : public classbase { counters[who] = 1; } - if (time(NULL) > reset) + if (ServerInstance->Time() > reset) { counters.clear(); - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; } } @@ -140,7 +142,7 @@ class MsgFlood : public ModeHandler if (!channel->GetExt("flood", f)) { parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs); - floodsettings *fs = new floodsettings(ban,nsecs,nlines); + floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); channel->Extend("flood",fs); channel->SetMode('f', true); channel->SetModeParam('f', parameter.c_str(), true); @@ -160,7 +162,7 @@ class MsgFlood : public ModeHandler if ((((nlines != f->lines) || (nsecs != f->secs) || (ban != f->ban))) && (((nsecs > 0) && (nlines > 0)))) { delete f; - floodsettings *fs = new floodsettings(ban,nsecs,nlines); + floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); channel->Shrink("flood"); channel->Extend("flood",fs); channel->SetModeParam('f', cur_param.c_str(), false); diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 72e2831da..4961e97a0 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -33,7 +33,7 @@ class nickfloodsettings : public classbase nickfloodsettings(int b, int c) : secs(b), nicks(c) { - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; counter = 0; locked = false; }; @@ -41,10 +41,10 @@ class nickfloodsettings : public classbase void addnick() { counter++; - if (time(NULL) > reset) + if (ServerInstance->Time() > reset) { counter = 0; - reset = time(NULL) + secs; + reset = ServerInstance->Time() + secs; } } @@ -62,7 +62,7 @@ class nickfloodsettings : public classbase { if (locked) { - if (time(NULL) > unlocktime) + if (ServerInstance->Time() > unlocktime) { locked = false; return false; @@ -78,7 +78,7 @@ class nickfloodsettings : public classbase void lock() { locked = true; - unlocktime = time(NULL) + 60; + unlocktime = ServerInstance->Time() + 60; } }; diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index c03b2777a..8092d5162 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -64,7 +64,7 @@ class ModuleRandQuote : public Module conf = new ConfigReader(ServerInstance); // Sort the Randomizer thingie.. - srand(time(NULL)); + srand(ServerInstance->Time()); q_file = conf->ReadValue("randquote","file",0); prefix = conf->ReadValue("randquote","prefix",0); diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index 44938bafa..facbf6c30 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -27,7 +27,7 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, time(NULL)), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time()), Instance(Inst), sock(s), lnk(l), Utils(u) { thefd = sock->GetFd(); } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index c3167b9b3..a286150b2 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -67,7 +67,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str bursting = false; VersionString.clear(); ServerUserCount = ServerOperCount = 0; - this->SetNextPingTime(time(NULL) + Utils->PingFreq); + this->SetNextPingTime(ServerInstance->Time() + Utils->PingFreq); this->SetPingFlag(); Warned = DupError = false; StartBurst = rtt = 0; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 48d829f6f..06851619c 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -536,7 +536,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) } - L.NextConnectTime = time(NULL) + L.AutoConnect; + L.NextConnectTime = ServerInstance->Time() + L.AutoConnect; if (L.Name.find('.') == std::string::npos) throw CoreException("The link name '"+assign(L.Name)+"' is invalid and must contain at least one '.' character"); diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index a10f90819..5e0650a3d 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -64,7 +64,7 @@ class CommandTban : public Command TimedBan T; std::string channelname = parameters[0]; long duration = ServerInstance->Duration(parameters[1]); - unsigned long expire = duration + time(NULL); + unsigned long expire = duration + ServerInstance->Time(); if (duration < 1) { user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time"); |