diff options
| author | Alexander Barton <alex@barton.de> | 2012-04-27 22:47:22 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-04-27 22:47:22 +0200 |
| commit | 2327b17656b329d6210628f24c77f51533c05620 (patch) | |
| tree | aeff7b380415ec363321bbbb4d3c1e77d27056d2 /src | |
| parent | da4c1ebe81bbd1335356ef40c91741b953c9f8d8 (diff) | |
| download | ngircd-2327b17656b329d6210628f24c77f51533c05620.tar.gz ngircd-2327b17656b329d6210628f24c77f51533c05620.zip | |
"CAP REQ" starts capability negotiation and delays user registration
New helper function Set_CAP_Negotiation().
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/irc-cap.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/ngircd/irc-cap.c b/src/ngircd/irc-cap.c index 956b3599..c92a3f39 100644 --- a/src/ngircd/irc-cap.c +++ b/src/ngircd/irc-cap.c @@ -40,6 +40,9 @@ bool Handle_CAP_ACK PARAMS((CLIENT *Client, char *Arg)); bool Handle_CAP_CLEAR PARAMS((CLIENT *Client)); bool Handle_CAP_END PARAMS((CLIENT *Client)); +void Set_CAP_Negotiation PARAMS((CLIENT *Client)); + + /** * Handler for the IRCv3 "CAP" command. * @@ -96,10 +99,8 @@ Handle_CAP_LS(CLIENT *Client, UNUSED char *Arg) { assert(Client != NULL); - if (Client_Type(Client) != CLIENT_USER) - Client_CapAdd(Client, CLIENT_CAP_PENDING); + Set_CAP_Negotiation(Client); - Client_CapAdd(Client, CLIENT_CAP_SUPPORTED); return IRC_WriteStrClient(Client, "CAP %s LS :", Client_ID(Client)); } @@ -131,6 +132,8 @@ Handle_CAP_REQ(CLIENT *Client, char *Arg) assert(Client != NULL); assert(Arg != NULL); + Set_CAP_Negotiation(Client); + return IRC_WriteStrClient(Client, "CAP %s NAK :%s", Client_ID(Client), Arg); } @@ -189,4 +192,19 @@ Handle_CAP_END(CLIENT *Client) return CONNECTED; } +/** + * Set CAP negotiation status and mark client as "supports capabilities". + * + * @param Client The client to handle. + */ +void +Set_CAP_Negotiation(CLIENT *Client) +{ + assert(Client != NULL); + + if (Client_Type(Client) != CLIENT_USER) + Client_CapAdd(Client, CLIENT_CAP_PENDING); + Client_CapAdd(Client, CLIENT_CAP_SUPPORTED); +} + /* -eof- */ |