diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-03 22:30:33 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-03 22:30:33 +0000 |
commit | 16a90d28f61707b2f053b163e33c6678bd861971 (patch) | |
tree | a67784e553135ab1a519ff5ee685a07702f4573a | |
parent | dc44944c713d5d19a7d6e7fa443dde03fe4d9832 (diff) |
Undo me smoking a nice pipe of craq on UID support (no wonder this wasn't working), and fix findbot() to do what we want.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1524 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/extern.h | 6 | ||||
-rw-r--r-- | include/services.h | 2 | ||||
-rw-r--r-- | src/botserv.c | 21 | ||||
-rw-r--r-- | src/core/bs_bot.c | 4 | ||||
-rw-r--r-- | src/init.c | 2 | ||||
-rw-r--r-- | src/nickserv.c | 4 |
6 files changed, 26 insertions, 13 deletions
diff --git a/include/extern.h b/include/extern.h index 56c1c4b35..b4e975004 100644 --- a/include/extern.h +++ b/include/extern.h @@ -71,6 +71,12 @@ E void botchanmsgs(User *u, ChannelInfo *ci, char *buf); E void load_bs_dbase(void); E void save_bs_dbase(void); E BotInfo *findbot(const char *nick); + +/** Finds a pseudoclient, given a UID. Useful for TS6 protocol modules. + * @param uid The UID to search for + * @return The pseudoclient structure, or NULL if one could not be found + */ +E BotInfo *findbot_byuid(const char *uid); E void bot_join(ChannelInfo *ci); E char *normalizeBuffer(const char *); E void insert_bot(BotInfo * bi); diff --git a/include/services.h b/include/services.h index bfcb014d6..ae3d4b6dd 100644 --- a/include/services.h +++ b/include/services.h @@ -1223,7 +1223,7 @@ class IRCDProto { va_end(args); SendModeInternal(bi, dest, buf); } - virtual void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *, const char *uid = ts6_uid_retrieve()) = 0; + virtual void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *, const char *uid) = 0; virtual void SendKick(BotInfo *bi, const char *chan, const char *user, const char *fmt, ...) { va_list args; diff --git a/src/botserv.c b/src/botserv.c index 2aeca8249..14d8249e2 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -558,20 +558,27 @@ BotInfo *findbot(const char *nick) BotInfo *bi; if (!nick || !*nick) - return NULL; + return NULL; - for (bi = botlists[tolower(*nick)]; bi; bi = bi->next) + /* + * XXX Less than efficient, but we need to do this for good TS6 support currently. This *will* improve. -- w00t + */ + for (int i = 0; i < 256; i++) { - if (!stricmp(nick, bi->nick)) - return bi; - - if (nick == bi->uid) - return bi; + for (bi = botlists[i]; bi; bi = bi->next) + { + if (!stricmp(nick, bi->nick)) + return bi; + + if (nick == bi->uid) + return bi; + } } return NULL; } + /*************************************************************************/ /* Returns ban data associated with an user if it exists, allocates it diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index d56f93539..e518315f5 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -165,7 +165,7 @@ int do_bot(User * u) /* We make the bot online, ready to serve */ ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, - ircd->botserv_bot_mode); + ircd->botserv_bot_mode, bi->uid.c_str()); notice_lang(s_BotServ, u, BOT_BOT_ADDED, bi->nick, bi->user, bi->host, bi->real); @@ -300,7 +300,7 @@ int do_bot(User * u) ircdproto->SendQuit(bi, "Quit: Be right back"); ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, - ircd->botserv_bot_mode); + ircd->botserv_bot_mode, bi->uid.c_str()); bi->RejoinAll(); } diff --git a/src/init.c b/src/init.c index 6ba89f052..4d31551bb 100644 --- a/src/init.c +++ b/src/init.c @@ -42,7 +42,7 @@ void introduce_user(const char *user) for (bi = botlists[i]; bi; bi = bi->next) { if (!user || !stricmp(user, bi->nick)) - ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->botserv_bot_mode); + ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->botserv_bot_mode, bi->uid.c_str()); } } } diff --git a/src/nickserv.c b/src/nickserv.c index deefa6112..2ee174c73 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -848,7 +848,7 @@ void cancel_user(User * u) if (ircd->svsnick) { ircdproto->SendClientIntroduction(u->nick, NSEnforcerUser, NSEnforcerHost, - "Services Enforcer", "+"); + "Services Enforcer", "+", ts6_uid_retrieve()); add_ns_timeout(na, TO_RELEASE, NSReleaseTimeout); } else { ircdproto->SendSVSKill(s_NickServ, u->nick, @@ -859,7 +859,7 @@ void cancel_user(User * u) if (ircd->svsnick) { ircdproto->SendClientIntroduction(u->nick, NSEnforcerUser, NSEnforcerHost, - "Services Enforcer", "+"); + "Services Enforcer", "+", ts6_uid_retrieve()); add_ns_timeout(na, TO_RELEASE, NSReleaseTimeout); } else { ircdproto->SendSVSKill(s_NickServ, u->nick, |