1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 09:50:29 +00:00

IRC_PART(): code and comment cleanup.

This commit is contained in:
Alexander Barton 2008-04-24 23:46:59 +02:00
parent 2f6d7a649c
commit 25f48a2a34

View File

@ -286,29 +286,36 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
} /* IRC_JOIN */ } /* IRC_JOIN */
/**
* Handler for the IRC "PART" command.
*/
GLOBAL bool GLOBAL bool
IRC_PART( CLIENT *Client, REQUEST *Req ) IRC_PART(CLIENT * Client, REQUEST * Req)
{ {
CLIENT *target; CLIENT *target;
char *chan; char *chan;
assert( Client != NULL ); assert(Client != NULL);
assert( Req != NULL ); assert(Req != NULL);
if (Req->argc < 1 || Req->argc > 2) if (Req->argc < 1 || Req->argc > 2)
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command); Client_ID(Client), Req->command);
/* Wer ist der Absender? */ /* Get the sender */
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix ); if (Client_Type(Client) == CLIENT_SERVER)
else target = Client; target = Client_Search(Req->prefix);
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); else
target = Client;
if (!target)
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->prefix);
/* Channel-Namen durchgehen */ /* Loop over all the given channel names */
chan = strtok(Req->argv[0], ","); chan = strtok(Req->argv[0], ",");
while (chan) { while (chan) {
Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target)); Channel_Part(target, Client, chan,
Req->argc > 1 ? Req->argv[1] : Client_ID(target));
chan = strtok(NULL, ","); chan = strtok(NULL, ",");
} }
return CONNECTED; return CONNECTED;