mirror of
https://github.com/osmarks/ngircd.git
synced 2025-02-22 20:20:03 +00:00
Code cleanup of IRC_DISCONNECT().
This commit is contained in:
parent
bce16c2864
commit
9a7499af8b
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -256,34 +256,43 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req)
|
|||||||
} /* IRC_CONNECT */
|
} /* IRC_CONNECT */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect (and disable) configured server.
|
||||||
|
*/
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
IRC_DISCONNECT(CLIENT *Client, REQUEST *Req )
|
IRC_DISCONNECT(CLIENT * Client, REQUEST * Req)
|
||||||
{
|
{
|
||||||
/* Disconnect and disable configured server */
|
|
||||||
|
|
||||||
CONN_ID my_conn;
|
CONN_ID my_conn;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert(Client != NULL);
|
||||||
assert( Req != NULL );
|
assert(Req != NULL);
|
||||||
|
|
||||||
if (!Check_Oper(Client))
|
if (!Check_Oper(Client))
|
||||||
return No_Privileges(Client, Req);
|
return No_Privileges(Client, Req);
|
||||||
|
|
||||||
/* Bad number of parameters? */
|
/* Bad number of parameters? */
|
||||||
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);
|
||||||
|
|
||||||
Log( LOG_NOTICE|LOG_snotice, "Got DISCONNECT command from \"%s\" for0 \"%s\".", Client_Mask( Client ), Req->argv[0]);
|
Log(LOG_NOTICE | LOG_snotice,
|
||||||
|
"Got DISCONNECT command from \"%s\" for \"%s\".",
|
||||||
|
Client_Mask(Client), Req->argv[0]);
|
||||||
|
|
||||||
/* Save ID of this connection */
|
/* Save ID of this connection */
|
||||||
my_conn = Client_Conn( Client );
|
my_conn = Client_Conn(Client);
|
||||||
|
|
||||||
/* Connect configured server */
|
/* Disconnect configured server */
|
||||||
if( ! Conf_DisableServer( Req->argv[0] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
if (!Conf_DisableServer(Req->argv[0]))
|
||||||
|
return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
|
||||||
|
Client_ID(Client), Req->argv[0]);
|
||||||
|
|
||||||
/* Are we still connected or were we killed, too? */
|
/* Are we still connected or were we killed, too? */
|
||||||
if( Conn_GetClient( my_conn )) return CONNECTED;
|
if (Conn_GetClient(my_conn))
|
||||||
else return DISCONNECTED;
|
return CONNECTED;
|
||||||
} /* IRC_CONNECT */
|
else
|
||||||
|
return DISCONNECTED;
|
||||||
|
} /* IRC_DISCONNECT */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user