summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_alltime.cpp9
-rw-r--r--src/modules/m_banredirect.cpp2
-rw-r--r--src/modules/m_conn_join.cpp2
-rw-r--r--src/modules/m_cycle.cpp2
-rw-r--r--src/modules/m_denychans.cpp2
-rw-r--r--src/modules/m_operjoin.cpp2
-rw-r--r--src/modules/m_redirect.cpp2
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp25
-rw-r--r--src/modules/m_spanningtree/main.h9
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/modules/m_spanningtree/time.cpp28
-rw-r--r--src/modules/m_spanningtree/timesynctimer.cpp9
-rw-r--r--src/modules/m_spanningtree/timesynctimer.h10
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp14
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.h10
-rw-r--r--src/modules/m_spanningtree/whois.cpp2
19 files changed, 19 insertions, 117 deletions
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index 83dbe53b8..75ed4f355 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -28,16 +28,11 @@ class CommandAlltime : public Command
CmdResult Handle(const char* const* parameters, int pcnt, User *user)
{
char fmtdate[64];
- char fmtdate2[64];
- time_t now = ServerInstance->Time(false);
+ time_t now = ServerInstance->Time();
strftime(fmtdate, sizeof(fmtdate), "%F %T", gmtime(&now));
- now = ServerInstance->Time(true);
- strftime(fmtdate2, sizeof(fmtdate2), "%F %T", gmtime(&now));
-
- int delta = ServerInstance->GetTimeDelta();
std::string msg = ":" + std::string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :System time for " +
- ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds): Time with delta: "+ fmtdate2;
+ ServerInstance->Config->ServerName + " is: " + fmtdate;
if (IS_LOCAL(user))
{
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index eaa25c1be..e5fbc9abd 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -307,7 +307,7 @@ class ModuleBanRedirect : public Module
user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name);
user->WriteServ("470 %s :You are being automatically redirected to %s", user->nick, redir->targetchan.c_str());
nofollow = true;
- Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time());
nofollow = false;
return 1;
}
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index b3be3932b..21314a6ee 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -82,7 +82,7 @@ class ModuleConnJoin : public Module
for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time());
}
};
diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp
index 882d4232e..8d1c46fb3 100644
--- a/src/modules/m_cycle.cpp
+++ b/src/modules/m_cycle.cpp
@@ -62,7 +62,7 @@ class CommandCycle : public Command
if (!channel->PartUser(user, reason.c_str()))
delete channel;
- Channel::JoinUser(ServerInstance, user, parameters[0], true, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, parameters[0], true, "", false, ServerInstance->Time());
}
return CMD_LOCALONLY;
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 3a5ea7462..78e6cfea3 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -117,7 +117,7 @@ class ModuleDenyChannels : public Module
if ((!newchan) || (!(newchan->IsModeSet('L'))))
{
user->WriteServ("926 %s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick,cname,cname,redirect.c_str(), reason.c_str());
- Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time());
return 1;
}
}
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 60796fd3f..d764c76d7 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -77,7 +77,7 @@ class ModuleOperjoin : public Module
for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time());
}
};
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index e944d6229..9dc8aa5b7 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -132,7 +132,7 @@ class ModuleRedirect : public Module
}
user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
- Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time());
return 1;
}
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 4bc5d31a2..6e2243f08 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -50,7 +50,7 @@ class CommandSajoin : public Command
*/
if (IS_LOCAL(dest))
{
- Channel::JoinUser(ServerInstance, dest, parameters[1], true, "", false, ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, dest, parameters[1], true, "", false, ServerInstance->Time());
/* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */
Channel* n = ServerInstance->FindChan(parameters[1]);
if (n)
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index dd288b821..0b6c4430a 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -68,7 +68,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
irc::tokenstream users((params.size() > 2) ? params[2] : ""); /* users from the user list */
bool apply_other_sides_modes = true; /* True if we are accepting the other side's modes */
Channel* chan = this->Instance->FindChan(channel); /* The channel we're sending joins to */
- time_t ourTS = chan ? chan->age : Instance->Time(true)+600; /* The TS of our side of the link */
+ time_t ourTS = chan ? chan->age : Instance->Time()+600; /* The TS of our side of the link */
bool created = !chan; /* True if the channel doesnt exist here yet */
std::string item; /* One item in the list of nicks */
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 119e98220..f72974381 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -42,14 +42,6 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
ServerInstance->AddCommand(command_rconnect);
command_rsquit = new cmd_rsquit(ServerInstance, this, Utils);
ServerInstance->AddCommand(command_rsquit);
- if (Utils->EnableTimeSync)
- {
- SyncTimer = new TimeSyncTimer(ServerInstance, this);
- ServerInstance->Timers->AddTimer(SyncTimer);
- }
- else
- SyncTimer = NULL;
-
RefreshTimer = new CacheRefreshTimer(ServerInstance, Utils);
ServerInstance->Timers->AddTimer(RefreshTimer);
@@ -416,17 +408,6 @@ int ModuleSpanningTree::HandleConnect(const char* const* parameters, int pcnt, U
return 1;
}
-void ModuleSpanningTree::BroadcastTimeSync()
-{
- if (Utils->MasterTime)
- {
- std::deque<std::string> params;
- params.push_back(ConvToStr(ServerInstance->Time(false)));
- params.push_back("FORCE");
- Utils->DoOneToMany(ServerInstance->Config->GetSID(), "TIMESET", params);
- }
-}
-
void ModuleSpanningTree::OnGetServerDescription(const std::string &servername,std::string &description)
{
TreeServer* s = Utils->FindServer(servername);
@@ -691,7 +672,7 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick)
/** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick!
*/
if (irc::string(user->nick) != assign(oldnick))
- user->age = ServerInstance->Time(true);
+ user->age = ServerInstance->Time();
params.push_back(ConvToStr(user->age));
Utils->DoOneToMany(user->uuid,"NICK",params);
@@ -916,7 +897,7 @@ void ModuleSpanningTree::OnEvent(Event* event)
return;
(*params)[1] = ":" + (*params)[1];
params->insert(params->begin() + 1,ServerInstance->Config->ServerName);
- params->insert(params->begin() + 1,ConvToStr(ServerInstance->Time(true)));
+ params->insert(params->begin() + 1,ConvToStr(ServerInstance->Time()));
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC",*params);
}
else if (event->GetEventID() == "send_mode")
@@ -1002,8 +983,6 @@ ModuleSpanningTree::~ModuleSpanningTree()
{
/* This will also free the listeners */
delete Utils;
- if (SyncTimer)
- ServerInstance->Timers->DelTimer(SyncTimer);
ServerInstance->Timers->DelTimer(RefreshTimer);
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index e8c83221e..4002ad61e 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -33,7 +33,6 @@ const long ProtocolVersion = 1200;
class cmd_rconnect;
class cmd_rsquit;
class SpanningTreeUtilities;
-class TimeSyncTimer;
class CacheRefreshTimer;
class TreeServer;
class Link;
@@ -51,10 +50,6 @@ class ModuleSpanningTree : public Module
SpanningTreeUtilities* Utils;
public:
- /** Timer for clock syncs
- */
- TimeSyncTimer *SyncTimer;
-
CacheRefreshTimer *RefreshTimer;
/** Constructor
@@ -137,10 +132,6 @@ class ModuleSpanningTree : public Module
*/
int HandleConnect(const char* const* parameters, int pcnt, User* user);
- /** Send out time sync to all servers
- */
- void BroadcastTimeSync();
-
/** Attempt to send a message to a user
*/
void RemoteMessage(User* user, const char* format, ...);
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 86d13e96f..062aed855 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -29,7 +29,7 @@
void TreeSocket::DoBurst(TreeServer* s)
{
std::string name = s->GetName();
- std::string burst = ":" + this->Instance->Config->GetSID() + " BURST " +ConvToStr(Instance->Time(true));
+ std::string burst = ":" + this->Instance->Config->GetSID() + " BURST " +ConvToStr(Instance->Time());
std::string endburst = ":" + this->Instance->Config->GetSID() + " ENDBURST";
this->Instance->SNO->WriteToSnoMask('l',"Bursting to \2%s\2 (Authentication: %s).", name.c_str(), this->GetTheirChallenge().empty() ? "plaintext password" : "SHA256-HMAC challenge-response");
this->WriteLine(burst);
diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp
index 415ccbbad..3bf1e67b1 100644
--- a/src/modules/m_spanningtree/time.cpp
+++ b/src/modules/m_spanningtree/time.cpp
@@ -30,32 +30,6 @@
/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
-bool TreeSocket::HandleSetTime(const std::string &prefix, std::deque<std::string> &params)
-{
- if (!params.size() || !Utils->EnableTimeSync)
- return true;
-
- bool force = false;
-
- if ((params.size() == 2) && (params[1] == "FORCE"))
- force = true;
-
- time_t them = atoi(params[0].c_str());
- time_t us = Instance->Time(false);
-
- time_t diff = them - us;
-
- Utils->DoOneToAllButSender(prefix, "TIMESET", params, prefix);
-
- if (force || (them != us))
- {
- time_t old = Instance->SetTimeDelta(diff);
- Instance->Log(DEBUG, "TS (diff %d) from %s applied (old delta was %d)", diff, prefix.c_str(), old);
- }
-
- return true;
-}
-
bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> &params)
{
// :source.server TIME remote.server sendernick
@@ -68,7 +42,7 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> &params
User* u = this->Instance->FindNick(params[1]);
if (u)
{
- params.push_back(ConvToStr(Instance->Time(false)));
+ params.push_back(ConvToStr(Instance->Time()));
params[0] = prefix;
Utils->DoOneToOne(this->Instance->Config->GetSID(),"TIME",params,params[0]);
}
diff --git a/src/modules/m_spanningtree/timesynctimer.cpp b/src/modules/m_spanningtree/timesynctimer.cpp
index 0f0021ddf..bea28f1e4 100644
--- a/src/modules/m_spanningtree/timesynctimer.cpp
+++ b/src/modules/m_spanningtree/timesynctimer.cpp
@@ -28,15 +28,6 @@
/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
-TimeSyncTimer::TimeSyncTimer(InspIRCd *Inst, ModuleSpanningTree *Mod) : Timer(600, Inst->Time(), true), Instance(Inst), Module(Mod)
-{
-}
-
-void TimeSyncTimer::Tick(time_t TIME)
-{
- Module->BroadcastTimeSync();
-}
-
CacheRefreshTimer::CacheRefreshTimer(InspIRCd *Inst, SpanningTreeUtilities *Util) : Timer(3600, Inst->Time(), true), Instance(Inst), Utils(Util)
{
}
diff --git a/src/modules/m_spanningtree/timesynctimer.h b/src/modules/m_spanningtree/timesynctimer.h
index 7964c98d9..3f97255b3 100644
--- a/src/modules/m_spanningtree/timesynctimer.h
+++ b/src/modules/m_spanningtree/timesynctimer.h
@@ -24,16 +24,6 @@ class InspIRCd;
* Timer is only one-shot however, so at the end of each Tick() we simply
* insert another of ourselves into the pending queue :)
*/
-class TimeSyncTimer : public Timer
-{
- private:
- InspIRCd *Instance;
- ModuleSpanningTree *Module;
- public:
- TimeSyncTimer(InspIRCd *Instance, ModuleSpanningTree *Mod);
- virtual void Tick(time_t TIME);
-};
-
class CacheRefreshTimer : public Timer
{
private:
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 2fc847b0c..76920d6e6 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -160,11 +160,10 @@ bool TreeSocket::ProcessLine(std::string &line)
}
else if (command == "BURST")
{
- if (params.size() && Utils->EnableTimeSync)
+ if (params.size())
{
- bool we_have_delta = (Instance->Time(false) != Instance->Time(true));
time_t them = atoi(params[0].c_str());
- time_t delta = them - Instance->Time(false);
+ time_t delta = them - Instance->Time();
if ((delta < -600) || (delta > 600))
{
Instance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs(delta));
@@ -175,13 +174,6 @@ bool TreeSocket::ProcessLine(std::string &line)
{
Instance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs(delta));
}
-
- if (!Utils->MasterTime && !we_have_delta)
- {
- this->Instance->SetTimeDelta(delta);
- // Send this new timestamp to any other servers
- Utils->DoOneToMany(Instance->Config->GetSID(), "TIMESET", params);
- }
}
this->LinkState = CONNECTED;
Link* lnk = Utils->FindLink(InboundServerName);
@@ -283,7 +275,7 @@ bool TreeSocket::ProcessLine(std::string &line)
* When there is activity on the socket, reset the ping counter so
* that we're not wasting bandwidth pinging an active server.
*/
- route_back_again->SetNextPingTime(time(NULL) + Utils->PingFreq);
+ route_back_again->SetNextPingTime(Instance->Time() + Utils->PingFreq);
route_back_again->SetPingFlag();
}
else
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 3c7ee2cf0..fb4a81ba1 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -448,8 +448,6 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
FlatLinks = Conf->ReadFlag("options","flatlinks",0);
HideULines = Conf->ReadFlag("options","hideulines",0);
AnnounceTSChange = Conf->ReadFlag("options","announcets",0);
- EnableTimeSync = Conf->ReadFlag("timesync","enable",0);
- MasterTime = Conf->ReadFlag("timesync", "master", 0);
ChallengeResponse = !Conf->ReadFlag("options", "disablehmac", 0);
quiet_bursts = Conf->ReadFlag("options", "quietbursts", 0);
PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true);
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 3bbff7ea6..c824b75ed 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -61,9 +61,7 @@ class SpanningTreeUtilities
/** Announce TS changes to channels on merge
*/
bool AnnounceTSChange;
- /** Synchronize timestamps between servers
- */
- bool EnableTimeSync;
+
/** Make snomasks +CQ quiet during bursts and splits
*/
bool quiet_bursts;
@@ -93,12 +91,6 @@ class SpanningTreeUtilities
*/
std::vector<Link> LinkBlocks;
- /** If this is true, this server is the master sync server for time
- * synching - e.g. it is the server with its clock correct. It will
- * send out the correct time at intervals.
- */
- bool MasterTime;
-
/** List of module pointers which can provide I/O abstraction
*/
hookmodules hooks;
diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp
index 155b0e838..4ee485503 100644
--- a/src/modules/m_spanningtree/whois.cpp
+++ b/src/modules/m_spanningtree/whois.cpp
@@ -46,7 +46,7 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &param
char signon[MAXBUF];
char idle[MAXBUF];
snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon);
- snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time(true)));
+ snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time()));
std::deque<std::string> par;
par.push_back(prefix);
par.push_back(signon);