IRC_ISON(): Code cleanup

This commit is contained in:
Alexander Barton 2012-01-02 15:04:40 +01:00
parent f47904bf95
commit 408a74b865
1 changed files with 28 additions and 19 deletions

View File

@ -154,6 +154,15 @@ IRC_INFO(CLIENT * Client, REQUEST * Req)
} /* IRC_INFO */
/**
* Handler for the IRC "ISON" command.
*
* See RFC 2812, 4.9 "Ison message".
*
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
*/
GLOBAL bool
IRC_ISON( CLIENT *Client, REQUEST *Req )
{
@ -165,20 +174,20 @@ IRC_ISON( CLIENT *Client, REQUEST *Req )
assert(Client != NULL);
assert(Req != NULL);
/* Falsche Anzahl Parameter? */
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
/* Bad number of arguments? */
if (Req->argc < 1)
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
strlcpy(rpl, RPL_ISON_MSG, sizeof rpl);
for( i = 0; i < Req->argc; i++ )
{
for (i = 0; i < Req->argc; i++) {
/* "All" ircd even parse ":<x> <y> ..." arguments and split
* them up; so we do the same ... */
ptr = strtok(Req->argv[i], " ");
while( ptr )
{
while (ptr) {
ngt_TrimStr(ptr);
c = Client_Search(ptr);
if( c && ( Client_Type( c ) == CLIENT_USER ))
{
/* Dieser Nick ist "online" */
if (c && Client_Type(c) == CLIENT_USER) {
strlcat(rpl, ptr, sizeof(rpl));
strlcat(rpl, " ", sizeof(rpl));
}