1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 10:06:37 +02:00

Fix ss_main's client introduction.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2226 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
rburchell
2009-03-31 14:43:04 +00:00
parent fdfc12f398
commit ab9c1e4651
3 changed files with 22 additions and 16 deletions
+7 -1
View File
@@ -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
};
+13 -14
View File
@@ -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;
}
}
void OnServerConnect(const std::string &sname)
{
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;
}
};
int statserv_create(int argc, char **argv)
{
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;
return MOD_CONT;
}
MODULE_INIT("ss_main", SSMain)
+2 -1
View File
@@ -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));
}
/*************************************************************************/