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,20 +156,8 @@ 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)
{
if(MyClient(source_p) || !IsDigit(parv[server][0]))
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) RB_DLINK_FOREACH(ptr, global_client_list.head)
{ {
if(match(new, ((struct Client *) (ptr->data))->name)) if(match(new, ((struct Client *) (ptr->data))->name))
@ -179,18 +167,12 @@ hunt_server(struct Client *client_p, struct Client *source_p,
} }
} }
} }
}
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;