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

IRC_ISON(): Code cleanup

This commit is contained in:
Alexander Barton 2012-01-02 15:04:40 +01:00
parent f47904bf95
commit 408a74b865

View File

@ -154,6 +154,15 @@ IRC_INFO(CLIENT * Client, REQUEST * Req)
} /* IRC_INFO */ } /* 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 GLOBAL bool
IRC_ISON( CLIENT *Client, REQUEST *Req ) IRC_ISON( CLIENT *Client, REQUEST *Req )
{ {
@ -162,32 +171,32 @@ IRC_ISON( CLIENT *Client, REQUEST *Req )
char *ptr; char *ptr;
int i; int i;
assert( Client != NULL ); assert(Client != NULL);
assert( Req != NULL ); assert(Req != NULL);
/* Falsche Anzahl Parameter? */ /* Bad 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);
strlcpy( rpl, RPL_ISON_MSG, sizeof rpl ); 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
ptr = strtok( Req->argv[i], " " ); * them up; so we do the same ... */
while( ptr ) ptr = strtok(Req->argv[i], " ");
{ while (ptr) {
ngt_TrimStr( ptr ); ngt_TrimStr(ptr);
c = Client_Search( ptr ); c = Client_Search(ptr);
if( c && ( Client_Type( c ) == CLIENT_USER )) if (c && Client_Type(c) == CLIENT_USER) {
{ strlcat(rpl, ptr, sizeof(rpl));
/* Dieser Nick ist "online" */ strlcat(rpl, " ", sizeof(rpl));
strlcat( rpl, ptr, sizeof( rpl ));
strlcat( rpl, " ", sizeof( rpl ));
} }
ptr = strtok( NULL, " " ); ptr = strtok(NULL, " ");
} }
} }
ngt_TrimLastChr(rpl, ' '); ngt_TrimLastChr(rpl, ' ');
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) ); return IRC_WriteStrClient(Client, rpl, Client_ID(Client));
} /* IRC_ISON */ } /* IRC_ISON */