Simplify hunt_server(), send ERR_NOSUCHSERVER from only one place.

This commit is contained in:
Jilles Tjoelker 2009-01-21 20:15:07 +01:00
parent e5d0a2ce72
commit cd300c1b82

View file

@ -156,41 +156,23 @@ hunt_server(struct Client *client_p, struct Client *source_p,
* Again, if there are no wild cards involved in the server * Again, if there are no wild cards involved in the server
* name, use the hash lookup * name, use the hash lookup
*/ */
if(!target_p) if(!target_p && wilds)
{ {
if(!wilds) RB_DLINK_FOREACH(ptr, global_client_list.head)
{ {
if(MyClient(source_p) || !IsDigit(parv[server][0])) if(match(new, ((struct Client *) (ptr->data))->name))
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER),
parv[server]);
return (HUNTED_NOSUCH);
}
else
{
target_p = NULL;
RB_DLINK_FOREACH(ptr, global_client_list.head)
{ {
if(match(new, ((struct Client *) (ptr->data))->name)) target_p = ptr->data;
{ break;
target_p = ptr->data;
break;
}
} }
} }
} }
if(target_p && !IsRegistered(target_p))
target_p = NULL;
if(target_p) if(target_p)
{ {
if(!IsRegistered(target_p))
{
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER),
parv[server]);
return HUNTED_NOSUCH;
}
if(IsMe(target_p) || MyClient(target_p)) if(IsMe(target_p) || MyClient(target_p))
return HUNTED_ISME; return HUNTED_ISME;