summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bbcccee27..33cd9b23f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,12 +1,20 @@
-/* Services -- main source file.
+/*
+ * Anope IRC Services
*
- * (C) 2003-2016 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2003-2016 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * This file is part of Anope. Anope is free software; you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software
+ * Foundation, version 2.
*
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see see <http://www.gnu.org/licenses/>.
*/
#include "services.h"
@@ -15,6 +23,8 @@
#include "bots.h"
#include "socketengine.h"
#include "uplink.h"
+#include "event.h"
+#include "modules.h"
#ifndef _WIN32
#include <limits.h>
@@ -46,7 +56,7 @@ class UpdateTimer : public Timer
public:
UpdateTimer(time_t timeout) : Timer(timeout, Anope::CurTime, true) { }
- void Tick(time_t) anope_override
+ void Tick(time_t) override
{
Anope::SaveDatabases();
}
@@ -57,9 +67,9 @@ class ExpireTimer : public Timer
public:
ExpireTimer(time_t timeout) : Timer(timeout, Anope::CurTime, true) { }
- void Tick(time_t) anope_override
+ void Tick(time_t) override
{
- FOREACH_MOD(OnExpireTick, ());
+ EventManager::Get()->Dispatch(&Event::ExpireTick::OnExpireTick);
}
};
@@ -69,7 +79,7 @@ void Anope::SaveDatabases()
return;
Log(LOG_DEBUG) << "Saving databases";
- FOREACH_MOD(OnSaveDatabase, ());
+ EventManager::Get()->Dispatch(&Event::SaveDatabase::OnSaveDatabase);
}
/** The following comes from InspIRCd to get the full path of the Anope executable
@@ -113,9 +123,6 @@ static Anope::string GetFullProgDir(const Anope::string &argv0)
int main(int ac, char **av, char **envp)
{
- /* String comparisons won't work until we build the case map cache, so do it first */
- Anope::CaseMapRebuild();
-
BinaryDir = GetFullProgDir(av[0]);
if (BinaryDir[BinaryDir.length() - 1] == '.')
BinaryDir = BinaryDir.substr(0, BinaryDir.length() - 2);
@@ -180,11 +187,11 @@ int main(int ac, char **av, char **envp)
if (Anope::Restarting)
{
- FOREACH_MOD(OnRestart, ());
+ EventManager::Get()->Dispatch(&Event::Restart::OnRestart);
}
else
{
- FOREACH_MOD(OnShutdown, ());
+ EventManager::Get()->Dispatch(&Event::Shutdown::OnShutdown);
}
if (Anope::QuitReason.empty())