diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-23 21:39:00 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-23 21:39:00 +0000 |
commit | 1200d6285b1d64699c6fa2c8241e2ee40f52d2a3 (patch) | |
tree | 997983815c2f0ab3a1d434ebc5851a3b8568f843 /src | |
parent | b928aff22f8f9a458df9aa73a0c6b22b979101bc (diff) |
Revert earlier time() -> SI->Time() diff for now, this causes problems with dns.cpp in mysterious ways.. seemingly a bad pointer there somehow..?
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10695 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/bancache.cpp | 4 | ||||
-rw-r--r-- | src/commands/cmd_invite.cpp | 2 | ||||
-rw-r--r-- | src/dns.cpp | 2 | ||||
-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_permchannels.cpp | 3 | ||||
-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 | ||||
-rw-r--r-- | src/socketengine.cpp | 6 | ||||
-rw-r--r-- | src/users.cpp | 6 |
20 files changed, 41 insertions, 49 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp index 9fe70cb41..826244b55 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -50,7 +50,7 @@ BanCacheHit *BanCacheManager::GetHit(const std::string &ip) return NULL; // free and safe else { - if (ServerInstance->Time() > i->second->Expiry) + if (time(NULL) > i->second->Expiry) { ServerInstance->Logs->Log("BANCACHE", DEBUG, "Hit on " + ip + " is out of date, removing!"); RemoveHit(i->second); @@ -137,7 +137,7 @@ void BanCacheManager::RehashCache() /* Safe to delete items here through iterator 'n' */ BanCacheHit *b = n->second; - if (ServerInstance->Time() > b->Expiry) + if (time(NULL) > b->Expiry) { /* we need to remove this one. */ delete b; diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 1a70fbe0e..ac9ad08f9 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -33,7 +33,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use if (parameters.size() == 3) { if (IS_LOCAL(user)) - timeout = ServerInstance->Time() + ServerInstance->Duration(parameters[2]); + timeout = time(NULL) + ServerInstance->Duration(parameters[2]); else timeout = ConvToInt(parameters[2]); } diff --git a/src/dns.cpp b/src/dns.cpp index 85d620982..63b523bfd 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -126,7 +126,7 @@ class RequestTimeout : public Timer DNSRequest* watch; int watchid; public: - RequestTimeout(unsigned long n, InspIRCd* SI, DNSRequest* watching, int id) : Timer(n, SI->Time()), ServerInstance(SI), watch(watching), watchid(id) + RequestTimeout(unsigned long n, InspIRCd* SI, DNSRequest* watching, int id) : Timer(n, time(NULL)), ServerInstance(SI), watch(watching), watchid(id) { } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index a3f995355..e57e40354 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -28,8 +28,6 @@ std::map<unsigned long,QueryInfo*> active_queries; class QueryInfo { -private: - InspIRCd* ServerInstance; public: QueryState qs; unsigned long id; @@ -43,9 +41,8 @@ public: time_t date; bool insert; - QueryInfo(InspIRCd* Instance, const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) + QueryInfo(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; @@ -53,7 +50,7 @@ public: id = i; category = cat; sourceid = nickid = hostid = -1; - date = ServerInstance->Time(); + date = time(NULL); insert = false; } @@ -253,7 +250,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(ServerInstance, nick, source, host, req.id, category); + QueryInfo* i = new QueryInfo(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 1b2a1de96..aaf19f925 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) < ServerInstance->Time()) || (gnutls_x509_crt_get_activation_time(cert) > ServerInstance->Time())) + if ((gnutls_x509_crt_get_expiration_time(cert) < time(0)) || (gnutls_x509_crt_get_activation_time(cert) > time(0))) { 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 796db66d7..389fffb85 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), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), ServerInstance->Time()) == 0)) + 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)) { 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 d80070939..c5c07efc0 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") % ServerInstance->Time()); + SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % time(NULL)); if(foo.Send()) { diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index d8e50b280..0204ee77f 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 = ServerInstance->Time(); + time_t now = time(NULL); /* +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 40a007c2c..33ba98aa4 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 = ServerInstance->Time() + secs; + reset = time(NULL) + secs; counter = 0; locked = false; }; @@ -41,10 +41,10 @@ class joinfloodsettings : public classbase void addjoin() { counter++; - if (ServerInstance->Time() > reset) + if (time(NULL) > reset) { counter = 0; - reset = ServerInstance->Time() + secs; + reset = time(NULL) + secs; } } @@ -62,7 +62,7 @@ class joinfloodsettings : public classbase { if (locked) { - if (ServerInstance->Time() > unlocktime) + if (time(NULL) > unlocktime) { locked = false; return false; @@ -78,7 +78,7 @@ class joinfloodsettings : public classbase void lock() { locked = true; - unlocktime = ServerInstance->Time() + 60; + unlocktime = time(NULL) + 60; } }; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index bf5e10595..cd027f089 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 > ServerInstance->Time()) + if (iter->second > time(NULL)) { if (iter->first == user) { @@ -180,7 +180,7 @@ public: dl = new delaylist; chan->Extend("norejoinusers", dl); } - (*dl)[user] = ServerInstance->Time() + strtoint(chan->GetModeParameter('J')); + (*dl)[user] = time(NULL) + strtoint(chan->GetModeParameter('J')); } } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 53df408f6..c374c5346 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -19,8 +19,6 @@ */ class floodsettings : public classbase { - private: - InspIRCd *ServerInstance; public: bool ban; int secs; @@ -28,10 +26,10 @@ class floodsettings : public classbase time_t reset; std::map<User*,int> counters; - 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) + floodsettings() : ban(0), secs(0), lines(0) {}; + floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c) { - reset = ServerInstance->Time() + secs; + reset = time(NULL) + secs; }; void addmessage(User* who) @@ -45,10 +43,10 @@ class floodsettings : public classbase { counters[who] = 1; } - if (ServerInstance->Time() > reset) + if (time(NULL) > reset) { counters.clear(); - reset = ServerInstance->Time() + secs; + reset = time(NULL) + secs; } } @@ -142,7 +140,7 @@ class MsgFlood : public ModeHandler if (!channel->GetExt("flood", f)) { parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs); - floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); + floodsettings *fs = new floodsettings(ban,nsecs,nlines); channel->Extend("flood",fs); channel->SetMode('f', true); channel->SetModeParam('f', parameter.c_str(), true); @@ -162,7 +160,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(ServerInstance,ban,nsecs,nlines); + floodsettings *fs = new floodsettings(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 4961e97a0..72e2831da 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 = ServerInstance->Time() + secs; + reset = time(NULL) + secs; counter = 0; locked = false; }; @@ -41,10 +41,10 @@ class nickfloodsettings : public classbase void addnick() { counter++; - if (ServerInstance->Time() > reset) + if (time(NULL) > reset) { counter = 0; - reset = ServerInstance->Time() + secs; + reset = time(NULL) + secs; } } @@ -62,7 +62,7 @@ class nickfloodsettings : public classbase { if (locked) { - if (ServerInstance->Time() > unlocktime) + if (time(NULL) > unlocktime) { locked = false; return false; @@ -78,7 +78,7 @@ class nickfloodsettings : public classbase void lock() { locked = true; - unlocktime = ServerInstance->Time() + 60; + unlocktime = time(NULL) + 60; } }; diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 207093e0e..3b3df4d26 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -27,9 +27,6 @@ class PermChannel : public ModeHandler { if (adding) { - if (!source->HasPrivPermission("channels/set-permanent")) - return MODEACTION_DENY; - if (!channel->IsModeSet('P')) { channel->SetMode('P',true); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 8092d5162..c03b2777a 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(ServerInstance->Time()); + srand(time(NULL)); 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 facbf6c30..44938bafa 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, Inst->Time()), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, time(NULL)), 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 a286150b2..c3167b9b3 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(ServerInstance->Time() + Utils->PingFreq); + this->SetNextPingTime(time(NULL) + 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 23df8da4c..c6c9ae700 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 = ServerInstance->Time() + L.AutoConnect; + L.NextConnectTime = time(NULL) + 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 5e0650a3d..a10f90819 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 + ServerInstance->Time(); + unsigned long expire = duration + time(NULL); if (duration < 1) { user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time"); diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 300a08bcc..0a0717964 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -96,7 +96,7 @@ void SocketEngine::WantWrite(EventHandler* eh) SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance) { TotalEvents = WriteEvents = ReadEvents = ErrorEvents = 0; - lastempty = ServerInstance->Time(); + lastempty = time(NULL); indata = outdata = 0; } @@ -263,9 +263,9 @@ void SocketEngine::RecoverFromFork() void SocketEngine::UpdateStats(size_t len_in, size_t len_out) { - if (lastempty != ServerInstance->Time()) + if (lastempty != time(NULL)) { - lastempty = ServerInstance->Time(); + lastempty = time(NULL); indata = outdata = 0; } indata += len_in; diff --git a/src/users.cpp b/src/users.cpp index 39922104e..2b6e00e0e 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -399,7 +399,7 @@ const std::string& User::GetFullRealHost() bool User::IsInvited(const irc::string &channel) { - time_t now = ServerInstance->Time(); + time_t now = time(NULL); InvitedList::iterator safei; for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i) { @@ -421,7 +421,7 @@ bool User::IsInvited(const irc::string &channel) InvitedList* User::GetInviteList() { - time_t now = ServerInstance->Time(); + time_t now = time(NULL); /* Weed out expired invites here. */ InvitedList::iterator safei; for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i) @@ -439,7 +439,7 @@ InvitedList* User::GetInviteList() void User::InviteTo(const irc::string &channel, time_t invtimeout) { - time_t now = ServerInstance->Time(); + time_t now = time(NULL); if (invtimeout != 0 && now > invtimeout) return; /* Don't add invites that are expired from the get-go. */ for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i) { |