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 88192c68aa
commit f8283571ad
1 changed files with 8 additions and 26 deletions

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
* 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]))
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))
{
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(!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))
return HUNTED_ISME;