diff options
author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-31 14:43:04 +0000 |
---|---|---|
committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-31 14:43:04 +0000 |
commit | ab9c1e46513ffd2b44fb30fbc0845e7474d1c5fa (patch) | |
tree | fc2f0ce02311159a7a6ba566780b9fc0acd35c7b | |
parent | fdfc12f398d2524cbc2ce0038e0da8502233070b (diff) |
Fix ss_main's client introduction.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2226 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/modules.h | 8 | ||||
-rw-r--r-- | src/core/ss_main.c | 23 | ||||
-rw-r--r-- | src/servers.c | 3 |
3 files changed, 20 insertions, 14 deletions
diff --git a/include/modules.h b/include/modules.h index 15cdfc39c..f0da30255 100644 --- a/include/modules.h +++ b/include/modules.h @@ -505,6 +505,11 @@ class CoreExport Module */ virtual void OnUserConnect(User *u) { } + /** Called when a new server connects to the network. + * @param sname The server name that is connecting + */ + virtual void OnServerConnect(const std::string &sname) { } + /** Called when anope saves databases. * NOTE: This event is deprecated pending new database handling. * XXX. @@ -523,7 +528,8 @@ class CoreExport Module enum Implementation { I_BEGIN, - I_OnUserKicked, I_OnReload, I_OnBotAssign, I_OnBotUnAssign, I_OnSaveDatabase, I_OnUserConnect, I_OnBackupDatabase, + I_OnUserKicked, I_OnReload, I_OnBotAssign, I_OnBotUnAssign, I_OnUserConnect, I_OnServerConnect, + I_OnSaveDatabase, I_OnBackupDatabase, I_END }; diff --git a/src/core/ss_main.c b/src/core/ss_main.c index a0a855dd8..c92ce5211 100644 --- a/src/core/ss_main.c +++ b/src/core/ss_main.c @@ -47,12 +47,12 @@ class SSMain : public Module if (servsock == -1) { -// EvtHook *hook = createEventHook(EVENT_SERVER_CONNECT, statserv_create); -// this->AddEventHook(hook); + ModuleManager::Attach(I_OnServerConnect, this); } else statserv_create(0, NULL); } + ~SSMain() { CommandHash *current; @@ -71,18 +71,17 @@ class SSMain : public Module delete statserv; } } -}; -int statserv_create(int argc, char **argv) -{ - statserv = findbot("StatServ"); - if (!statserv) + void OnServerConnect(const std::string &sname) { - statserv = new BotInfo("StatServ", ServiceUser, ServiceHost, "Stats Service"); - ircdproto->SendClientIntroduction("StatServ", ServiceUser, ServiceHost, "Stats Service", ircd->pseudoclient_mode, statserv->uid.c_str()); + statserv = findbot("StatServ"); + if (!statserv) + { + statserv = new BotInfo("StatServ", ServiceUser, ServiceHost, "Stats Service"); + ircdproto->SendClientIntroduction("StatServ", ServiceUser, ServiceHost, "Stats Service", ircd->pseudoclient_mode, statserv->uid.c_str()); + } + statserv->cmdTable = cmdTable; } - statserv->cmdTable = cmdTable; - return MOD_CONT; -} +}; MODULE_INIT("ss_main", SSMain) diff --git a/src/servers.c b/src/servers.c index b6f16eaa7..e66c5be98 100644 --- a/src/servers.c +++ b/src/servers.c @@ -13,6 +13,7 @@ */ #include "services.h" +#include "modules.h" Server *servlist = NULL; Server *me_server = NULL; /* This are we */ @@ -402,7 +403,7 @@ void do_server(const char *source, const char *servername, const char *hops, throw CoreException("Recieved a server from a nonexistant uplink?"); new_server(s, servername, descript, 0, numeric); - send_event(EVENT_SERVER_CONNECT, 1, servername); + FOREACH_MOD(I_OnServerConnect, OnServerConnect(servername)); } /*************************************************************************/ |