mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-13 18:30:27 +00:00
return PING argument in PONG reply if STRICT_RFC is not defined.
This commit is contained in:
parent
d5c5d2a37f
commit
6434d0b23e
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-login.c,v 1.46 2005/07/31 20:13:08 alex Exp $";
|
static char UNUSED id[] = "$Id: irc-login.c,v 1.47 2005/08/27 18:39:56 fw Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -434,29 +434,39 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* wrong number of arguments? */
|
||||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
||||||
#ifdef STRICT_RFC
|
#ifdef STRICT_RFC
|
||||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( Req->argc > 1 )
|
if( Req->argc > 1 ) {
|
||||||
{
|
/* a target client was specified */
|
||||||
/* es wurde ein Ziel-Client angegeben */
|
|
||||||
target = Client_Search( Req->argv[1] );
|
target = Client_Search( Req->argv[1] );
|
||||||
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER ))
|
||||||
if( target != Client_ThisServer( ))
|
return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
||||||
{
|
if( target != Client_ThisServer( )) {
|
||||||
/* ok, forwarden */
|
/* ok, forward */
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
else from = Client;
|
from = Client_Search( Req->prefix );
|
||||||
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
|
else
|
||||||
return IRC_WriteStrClientPrefix( target, from, "PING %s :%s", Client_ID( from ), Req->argv[1] );
|
from = Client;
|
||||||
|
if (!from)
|
||||||
|
return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG,
|
||||||
|
Client_ID( Client ), Req->prefix );
|
||||||
|
return IRC_WriteStrClientPrefix(target, from,
|
||||||
|
"PING %s :%s", Client_ID( from ), Req->argv[1] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log( LOG_DEBUG, "Connection %d: got PING, sending PONG ...", Client_Conn( Client ));
|
Log( LOG_DEBUG, "Connection %d: got PING, sending PONG ...", Client_Conn( Client ));
|
||||||
return IRC_WriteStrClient( Client, "PONG %s :%s", Client_ID( Client_ThisServer( )), Client_ID( Client ));
|
#ifdef STRICT_RFC
|
||||||
|
return IRC_WriteStrClient( Client, "PONG %s :%s", Client_ID( Client_ThisServer( )),
|
||||||
|
Client_ID( Client ));
|
||||||
|
#else
|
||||||
|
/* some clients depend on argument being returned in PONG reply (not mentioned in any RFC, though) */
|
||||||
|
return IRC_WriteStrClient( Client, "PONG %s :%s", Client_ID( Client_ThisServer( )), Req->argv[0]);
|
||||||
|
#endif
|
||||||
} /* IRC_PING */
|
} /* IRC_PING */
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user