summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:13 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:13 +0000
commit0aad26dd768e9a9aa38f0981b268f09d78f4bb61 (patch)
tree73fc4906a21ee0901507c8131d9ddcedd72bdf19 /src
parent82dcf8a39876553f6b7f5e0b4119e409b3f566aa (diff)
Store UID for services pseudoclients inside BotInfo. This will be used instead of struct Uid in the future. Remove seperate introduction of Service, make a BotInfo for all of them. XXX: no idea at all if this will work.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1270 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp16
-rw-r--r--src/init.c82
2 files changed, 44 insertions, 54 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index 2cd4a10fd..f58858d48 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -15,10 +15,26 @@ BotInfo::BotInfo(const char *nnick)
{
this->nick = sstrdup(nnick);
this->lastmsg = time(NULL);
+ this->uid = ts6_uid_retrieve(); // XXX is this safe? has ts6 been setup yet?
+ new_uid(nnick, (char *)this->uid.c_str()); // XXX: this is required because we still pass nick prefix to protocol modules, DO AWAY WITH IT.
insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL.
nbots++;
}
+BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const char *nreal)
+{
+ this->nick = sstrdup(nnick);
+ this->user = sstrdup(nuser);
+ this->host = sstrdup(nhost);
+ this->real = sstrdup(nreal);
+ this->lastmsg = time(NULL);
+ this->uid = ts6_uid_retrieve(); // XXX is this safe? has ts6 been setup yet?
+ new_uid(nnick, (char *)this->uid.c_str()); // XXX: this is required because we still pass nick prefix to protocol modules, DO AWAY WITH IT.
+ insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL.
+ nbots++;
+}
+
+
void BotInfo::ChangeNick(const char *newnick)
{
if (this->next)
diff --git a/src/init.c b/src/init.c
index 973acb13f..da46d296b 100644
--- a/src/init.c
+++ b/src/init.c
@@ -33,48 +33,6 @@ void introduce_user(const char *user)
lasttimes[LTSIZE - 1] = time(NULL);
#undef LTSIZE
- /* Introduce OperServ first because on some IRCd's send
- * we send data from OperServ before introduction completes.
- * Patch fixing ratbox RESV support provided by Jobe. */
- if (!user || stricmp(user, s_OperServ) == 0) {
- anope_cmd_nick(s_OperServ, desc_OperServ, ircd->operservmode);
- }
-
- /* NickServ */
- if (!user || stricmp(user, s_NickServ) == 0) {
- anope_cmd_nick(s_NickServ, desc_NickServ, ircd->nickservmode);
- }
-
- /* ChanServ */
- if (!user || stricmp(user, s_ChanServ) == 0) {
- anope_cmd_nick(s_ChanServ, desc_ChanServ, ircd->chanservmode);
- }
- if (s_HostServ && ircd->vhost
- && (!user || stricmp(user, s_HostServ) == 0)) {
- anope_cmd_nick(s_HostServ, desc_HostServ, ircd->hostservmode);
- }
-
- if (!user || stricmp(user, s_MemoServ) == 0) {
- anope_cmd_nick(s_MemoServ, desc_MemoServ, ircd->memoservmode);
- }
-
- if (s_BotServ && (!user || stricmp(user, s_BotServ) == 0)) {
- anope_cmd_nick(s_BotServ, desc_BotServ, ircd->botservmode);
- }
-
- if (!user || stricmp(user, s_HelpServ) == 0) {
- anope_cmd_nick(s_HelpServ, desc_HelpServ, ircd->helpservmode);
- }
-
- if (s_DevNull && (!user || stricmp(user, s_DevNull) == 0)) {
- anope_cmd_nick(s_DevNull, desc_DevNull, ircd->devnullmode);
- }
-
- if (!user || stricmp(user, s_GlobalNoticer) == 0) {
- anope_cmd_nick(s_GlobalNoticer, desc_GlobalNoticer,
- ircd->globalmode);
- }
-
/* We make aliases go online */
if (s_NickServAlias && (!user || stricmp(user, s_NickServAlias) == 0)) {
anope_cmd_nick(s_NickServAlias, desc_NickServAlias,
@@ -122,18 +80,18 @@ void introduce_user(const char *user)
}
/* We make the bots go online */
- if (s_BotServ) {
- BotInfo *bi;
- int i;
-
- for (i = 0; i < 256; i++)
- for (bi = botlists[i]; bi; bi = bi->next) {
-
- if (!user || !stricmp(user, bi->nick))
- anope_cmd_bot_nick(bi->nick, bi->user, bi->host,
- bi->real, ircd->botserv_bot_mode);
- }
- }
+ BotInfo *bi;
+ int i;
+
+ /* XXX: it might be nice to have this inside BotInfo's constructor, or something? */
+ for (i = 0; i < 256; i++)
+ {
+ for (bi = botlists[i]; bi; bi = bi->next)
+ {
+ if (!user || !stricmp(user, bi->nick))
+ anope_cmd_bot_nick(bi->nick, bi->user, bi->host, bi->real, ircd->botserv_bot_mode);
+ }
+ }
}
/*************************************************************************/
@@ -692,6 +650,22 @@ int init_secondary(int ac, char **av)
#endif
alog("Databases loaded");
+
+ /* this is only used on the first run of Anope. */
+ BotInfo *bi = findbot("NickServ");
+ if (!bi)
+ {
+ bi = new BotInfo(s_OperServ, ServiceUser, ServiceHost, desc_OperServ);
+ bi = new BotInfo(s_NickServ, ServiceUser, ServiceHost, desc_NickServ);
+ bi = new BotInfo(s_ChanServ, ServiceUser, ServiceHost, desc_ChanServ);
+ bi = new BotInfo(s_HostServ, ServiceUser, ServiceHost, desc_HostServ);
+ bi = new BotInfo(s_MemoServ, ServiceUser, ServiceHost, desc_MemoServ);
+ bi = new BotInfo(s_BotServ, ServiceUser, ServiceHost, desc_BotServ);
+ bi = new BotInfo(s_HelpServ, ServiceUser, ServiceHost, desc_HelpServ);
+ bi = new BotInfo(s_DevNull, ServiceUser, ServiceHost, desc_DevNull);
+ bi = new BotInfo(s_GlobalNoticer, ServiceUser, ServiceHost, desc_GlobalNoticer);
+ }
+
/* Save the databases back to file/mysql to reflect any changes */
#ifdef USE_RDB
if (!UseRDB) { /* Only save if we are not using remote databases