diff options
| author | Alexander Barton <alex@barton.de> | 2008-04-24 23:46:59 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2008-04-24 23:46:59 +0200 |
| commit | 25f48a2a342caf962920ee316b258812526f7a9d (patch) | |
| tree | 21c4d37578086e15599ce4c41e4950a194f6b2db | |
| parent | 2f6d7a649cf2428991cba3b9d2250b95a5904675 (diff) | |
| download | ngircd-25f48a2a342caf962920ee316b258812526f7a9d.tar.gz ngircd-25f48a2a342caf962920ee316b258812526f7a9d.zip | |
IRC_PART(): code and comment cleanup.
| -rw-r--r-- | src/ngircd/irc-channel.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c index 55770571..c678ceeb 100644 --- a/src/ngircd/irc-channel.c +++ b/src/ngircd/irc-channel.c @@ -286,29 +286,36 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) } /* IRC_JOIN */ +/** + * Handler for the IRC "PART" command. + */ GLOBAL bool -IRC_PART( CLIENT *Client, REQUEST *Req ) +IRC_PART(CLIENT * Client, REQUEST * Req) { CLIENT *target; char *chan; - assert( Client != NULL ); - assert( Req != NULL ); + assert(Client != NULL); + assert(Req != NULL); if (Req->argc < 1 || Req->argc > 2) return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, - Client_ID(Client), Req->command); + Client_ID(Client), Req->command); - /* Wer ist der Absender? */ - if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix ); - else target = Client; - if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); + /* Get the sender */ + if (Client_Type(Client) == CLIENT_SERVER) + target = Client_Search(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], ","); 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, ","); } return CONNECTED; |