Commit Diff


commit - a53de63ba7fcb4144f4fcc2db221556177528900
commit + 3228f1b2677e6edd1b0cfe81ac31069914ecd61b
blob - 0297015a8758e9075b608a95e17502fe6e391540
blob + 23fcc71cc14cfe8a352138a433d6a7e1e2a7f82b
--- src/ngircd/irc-op.c
+++ src/ngircd/irc-op.c
@@ -24,6 +24,7 @@
 #include "defines.h"
 #include "conn.h"
 #include "channel.h"
+#include "irc-macros.h"
 #include "irc-write.h"
 #include "lists.h"
 #include "log.h"
@@ -69,9 +70,8 @@ IRC_KICK(CLIENT *Client, REQUEST *Req)
 	assert( Client != NULL );
 	assert( Req != NULL );
 
-	if ((Req->argc < 2) || (Req->argc > 3))
-		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
-					Client_ID(Client), Req->command);
+	_IRC_ARGC_BETWEEN_OR_RETURN_(Client, Req, 2, 3)
+	_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
 
 	while (*itemList) {
 		if (*itemList == ',') {
@@ -90,15 +90,6 @@ IRC_KICK(CLIENT *Client, REQUEST *Req)
 		itemList++;
 	}
 
-	if (Client_Type(Client) == CLIENT_SERVER)
-		from = Client_Search(Req->prefix);
-	else
-		from = Client;
-
-	if (!from)
-		return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
-					Client_ID(Client), Req->prefix);
-
 	reason = Req->argc == 3 ? Req->argv[2] : Client_ID(from);
 	currentNick = Req->argv[1];
 	currentChannel = Req->argv[0];
@@ -155,18 +146,9 @@ IRC_INVITE(CLIENT *Client, REQUEST *Req)
 	assert( Client != NULL );
 	assert( Req != NULL );
 
-	if (Req->argc != 2)
-		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
-					Client_ID(Client), Req->command);
+	_IRC_ARGC_EQ_OR_RETURN_(Client, Req, 2)
+	_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
 
-	if (Client_Type(Client) == CLIENT_SERVER)
-		from = Client_Search(Req->prefix);
-	else
-		from = Client;
-	if (!from)
-		return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
-					Client_ID(Client), Req->prefix);
-
 	/* Search user */
 	target = Client_Search(Req->argv[0]);
 	if (!target || (Client_Type(target) != CLIENT_USER))