1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-28 04:46:17 +00:00

IRC_WHOIS_SendReply(): Code cleanup

This commit is contained in:
Alexander Barton 2012-01-16 02:15:41 +01:00
parent 2f7d0c0839
commit 12c60a670e

View File

@ -1025,10 +1025,10 @@ IRC_WHO(CLIENT *Client, REQUEST *Req)
/** /**
* Generate WHOIS reply of one actual client. * Generate WHOIS reply of one actual client.
* *
* @param Client The client from which this command has been received. * @param Client The client from which this command has been received.
* @param from The client requesting the information ("originator"). * @param from The client requesting the information ("originator").
* @param c The client of which information should be returned. * @param c The client of which information should be returned.
* @returns CONNECTED or DISCONNECTED. * @return CONNECTED or DISCONNECTED.
*/ */
static bool static bool
IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c) IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
@ -1037,6 +1037,10 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
CHANNEL *chan; CHANNEL *chan;
assert(Client != NULL);
assert(from != NULL);
assert(c != NULL);
/* Nick, user, hostname and client info */ /* Nick, user, hostname and client info */
if (!IRC_WriteStrClient(from, RPL_WHOISUSER_MSG, Client_ID(from), if (!IRC_WriteStrClient(from, RPL_WHOISUSER_MSG, Client_ID(from),
Client_ID(c), Client_User(c), Client_ID(c), Client_User(c),
@ -1094,30 +1098,29 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
/* IRC-Operator? */ /* IRC-Operator? */
if (Client_HasMode(c, 'o') && if (Client_HasMode(c, 'o') &&
!IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG, !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG,
Client_ID(from), Client_ID(c))) Client_ID(from), Client_ID(c)))
return DISCONNECTED; return DISCONNECTED;
/* Connected using SSL? */ /* Connected using SSL? */
if (Conn_UsesSSL(Client_Conn(c)) && if (Conn_UsesSSL(Client_Conn(c)) &&
!IRC_WriteStrClient(from, RPL_WHOISSSL_MSG, !IRC_WriteStrClient(from, RPL_WHOISSSL_MSG, Client_ID(from),
Client_ID(from), Client_ID(c))) Client_ID(c)))
return DISCONNECTED; return DISCONNECTED;
/* Idle and signon time (local clients only!) */ /* Idle and signon time (local clients only!) */
if (!Conf_MorePrivacy && Client_Conn(c) > NONE && if (!Conf_MorePrivacy && Client_Conn(c) > NONE &&
!IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG, !IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG,
Client_ID(from), Client_ID(c), Client_ID(from), Client_ID(c),
(unsigned long)Conn_GetIdle(Client_Conn(c)), (unsigned long)Conn_GetIdle(Client_Conn(c)),
(unsigned long)Conn_GetSignon(Client_Conn(c)))) (unsigned long)Conn_GetSignon(Client_Conn(c))))
return DISCONNECTED; return DISCONNECTED;
/* Away? */ /* Away? */
if (Client_HasMode(c, 'a') && if (Client_HasMode(c, 'a') &&
!IRC_WriteStrClient(from, RPL_AWAY_MSG, !IRC_WriteStrClient(from, RPL_AWAY_MSG,
Client_ID(from), Client_ID(c), Client_ID(from), Client_ID(c), Client_Away(c)))
Client_Away(c))) return DISCONNECTED;
return DISCONNECTED;
return CONNECTED; return CONNECTED;
} /* IRC_WHOIS_SendReply */ } /* IRC_WHOIS_SendReply */