]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-cap.c
Rework check for number of parameters
[ngircd-alex.git] / src / ngircd / irc-cap.c
index 39d1b3c2bc881d0acdc09e2d6a278cba1a91222a..42b0e4da9aa112b464d9754bb2f2632a5f41fedf 100644 (file)
@@ -24,6 +24,7 @@
 #include "conn.h"
 #include "channel.h"
 #include "client-cap.h"
+#include "irc-macros.h"
 #include "irc-write.h"
 #include "log.h"
 #include "login.h"
@@ -111,11 +112,11 @@ Get_CAP_String(int Capabilities)
 }
 
 /**
- * Handler for the "CAP LS" command.
+ * Handler for the IRCv3 sub-command "CAP LS".
  *
  * @param Client The client from which this command has been received.
  * @param Arg Command argument or NULL.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_LS(CLIENT *Client, UNUSED char *Arg)
@@ -130,11 +131,11 @@ Handle_CAP_LS(CLIENT *Client, UNUSED char *Arg)
 }
 
 /**
- * Handler for the "CAP LIST" command.
+ * Handler for the IRCv3 sub-command "CAP LIST".
  *
  * @param Client The client from which this command has been received.
  * @param Arg Command argument or NULL.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_LIST(CLIENT *Client, UNUSED char *Arg)
@@ -146,11 +147,11 @@ Handle_CAP_LIST(CLIENT *Client, UNUSED char *Arg)
 }
 
 /**
- * Handler for the "CAP REQ" command.
+ * Handler for the IRCv3 sub-command "CAP REQ".
  *
  * @param Client The client from which this command has been received.
  * @param Arg Command argument.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_REQ(CLIENT *Client, char *Arg)
@@ -174,11 +175,11 @@ Handle_CAP_REQ(CLIENT *Client, char *Arg)
 }
 
 /**
- * Handler for the "CAP ACK" command.
+ * Handler for the IRCv3 sub-command "CAP ACK".
  *
  * @param Client The client from which this command has been received.
  * @param Arg Command argument.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_ACK(UNUSED CLIENT *Client, UNUSED char *Arg)
@@ -190,10 +191,10 @@ Handle_CAP_ACK(UNUSED CLIENT *Client, UNUSED char *Arg)
 }
 
 /**
- * Handler for the "CAP CLEAR" command.
+ * Handler for the IRCv3 sub-command "CAP CLEAR".
  *
  * @param Client The client from which this command has been received.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_CLEAR(CLIENT *Client)
@@ -211,10 +212,10 @@ Handle_CAP_CLEAR(CLIENT *Client)
 }
 
 /**
- * Handler for the "CAP END" command.
+ * Handler for the IRCv3 sub-command "CAP END".
  *
  * @param Client The client from which this command has been received.
- * @returns CONNECTED or DISCONNECTED.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Handle_CAP_END(CLIENT *Client)
@@ -249,11 +250,6 @@ IRC_CAP(CLIENT *Client, REQUEST *Req)
        assert(Client != NULL);
        assert(Req != NULL);
 
-       /* Bad number of prameters? */
-       if (Req->argc < 1 || Req->argc > 2)
-               return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
-                                         Client_ID(Client), Req->command);
-
        LogDebug("Got \"%s %s\" command from \"%s\" ...",
                 Req->command, Req->argv[0], Client_ID(Client));
 
@@ -276,7 +272,7 @@ IRC_CAP(CLIENT *Client, REQUEST *Req)
                        return Handle_CAP_ACK(Client, Req->argv[1]);
        }
 
-       return IRC_WriteStrClient(Client, ERR_INVALIDCAP_MSG,
+       return IRC_WriteErrClient(Client, ERR_INVALIDCAP_MSG,
                                  Client_ID(Client), Req->argv[0]);
 }