IRCu fix for bot nicks

This commit is contained in:
Mark 2004-02-06 20:07:07 +00:00
parent 2d7d2ec156
commit c38a0c3d8c
2 changed files with 17 additions and 6 deletions

17
dl.c
View file

@ -847,6 +847,7 @@ void
bot_message (char *origin, char **av, int ac) bot_message (char *origin, char **av, int ac)
{ {
User *u; User *u;
User *bot_user;
ModUser *mod_usr; ModUser *mod_usr;
/* Check command length */ /* Check command length */
@ -866,10 +867,15 @@ bot_message (char *origin, char **av, int ac)
return; return;
} }
mod_usr = findbot (av[0]); bot_user = finduser(av[0]);
if (!bot_user) {
nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s not found", av[0]);
return;
}
mod_usr = findbot (bot_user->nick);
/* Check to see if any of the Modules have this nick Registered */ /* Check to see if any of the Modules have this nick Registered */
if (!mod_usr) { if (!mod_usr) {
nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s not found", av[0]); nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s not found", bot_user->nick);
return; return;
} }
nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s", mod_usr->nick); nlog (LOG_DEBUG1, LOG_CORE, "bot_message: %s", mod_usr->nick);
@ -1033,10 +1039,15 @@ findbot (char *bot_name)
SET_SEGV_LOCATION(); SET_SEGV_LOCATION();
bn = hash_lookup (bh, bot_name); u = finduser(bot_name);
if(u) {
bn = hash_lookup (bh, u->nick);
if (bn) { if (bn) {
return (ModUser *) hnode_get (bn); return (ModUser *) hnode_get (bn);
} }
} else {
nlog (LOG_WARNING, LOG_CORE, "findbot: unable to find user %s", bot_name);
}
return NULL; return NULL;
} }

View file

@ -101,7 +101,7 @@ init_services(void)
/* Add command list to services bot */ /* Add command list to services bot */
bot_ptr = add_neostats_mod_user (s_Services); bot_ptr = add_neostats_mod_user (s_Services);
bot_ptr->flags = me.onlyopers ? BOT_FLAG_ONLY_OPERS : 0; bot_ptr->flags = me.onlyopers ? BOT_FLAG_ONLY_OPERS : 0;
add_services_cmd_list(ns_commands); add_bot_cmd_list(bot_ptr, ns_commands);
return NS_SUCCESS; return NS_SUCCESS;
} }