commit - da897a2a14ac229dbd542f2f11c970dcb005944d
commit + 88f6fc5fd8617a2d517c1e7ed689a29dce2a217f
blob - 067703a81f64db01bb1a5f30d8b60a73d3f48127
blob + 73716fe261d5d5a4942d2d24d02672fcff2f74cd
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
CLIENT *target;
char quitmsg[LINE_LEN];
- assert( Client != NULL );
- assert( Req != NULL );
+ assert(Client != NULL);
+ assert(Req != NULL);
/* Wrong number of arguments? */
- if( Req->argc > 1 )
- return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+ if (Req->argc > 1)
+ return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ Client_ID(Client), Req->command);
if (Req->argc == 1)
strlcpy(quitmsg, Req->argv[0], sizeof quitmsg);
- if ( Client_Type( Client ) == CLIENT_SERVER )
- {
+ if (Client_Type(Client) == CLIENT_SERVER) {
/* Server */
- target = Client_Search( Req->prefix );
- if( ! target )
- {
- Log( LOG_WARNING, "Got QUIT from %s for unknown client!?", Client_ID( Client ));
+ target = Client_Search(Req->prefix);
+ if (!target) {
+ Log(LOG_WARNING,
+ "Got QUIT from %s for unknown client!?",
+ Client_ID(Client));
return CONNECTED;
}
- Client_Destroy( target, "Got QUIT command.", Req->argc == 1 ? quitmsg : NULL, true);
-
- return CONNECTED;
- }
- else
- {
+ if (target != Client) {
+ Client_Destroy(target, "Got QUIT command.",
+ Req->argc == 1 ? quitmsg : NULL, true);
+ return CONNECTED;
+ } else {
+ Conn_Close(Client_Conn(Client), "Got QUIT command.",
+ Req->argc == 1 ? quitmsg : NULL, true);
+ return DISCONNECTED;
+ }
+ } else {
if (Req->argc == 1 && quitmsg[0] != '\"') {
/* " " to avoid confusion */
strlcpy(quitmsg, "\"", sizeof quitmsg);
}
/* User, Service, or not yet registered */
- Conn_Close( Client_Conn( Client ), "Got QUIT command.", Req->argc == 1 ? quitmsg : NULL, true);
+ Conn_Close(Client_Conn(Client), "Got QUIT command.",
+ Req->argc == 1 ? quitmsg : NULL, true);
return DISCONNECTED;
}