commit - adc8d4f6c89a11e08f5214e4ceb1323376a42ec5
commit + 78c8212280127b421d4a8bb1094560441ffb7eef
blob - 29953a110606090d7abf9799543e5e6ba21e1a27
blob + 80b9f9a4d1ff9ab1d346a22a497d5f2647ee1357
--- src/ngircd/irc-oper.c
+++ src/ngircd/irc-oper.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "conf.h"
#include "channel.h"
#include "class.h"
+#include "irc-macros.h"
#include "irc-write.h"
#include "log.h"
#include "match.h"
/**
* Handler for the IRC "OPER" command.
*
- * See RFC 2812, 3.1.4 "Oper message".
- *
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
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)
len = array_length(&Conf_Opers, sizeof(*op));
op = array_start(&Conf_Opers);
/**
* Handler for the IRC "DIE" command.
*
- * See RFC 2812, 4.3 "Die message".
- *
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
if (!Op_Check(Client, Req))
return Op_NoPrivileges(Client, Req);
- /* Bad number of parameters? */
#ifdef STRICT_RFC
- if (Req->argc != 0)
+ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 0)
#else
- if (Req->argc > 1)
+ _IRC_ARGC_LE_OR_RETURN_(Client, Req, 1)
#endif
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
- Client_ID(Client), Req->command);
/* Is a message given? */
if (Req->argc > 0) {
/**
* Handler for the IRC "REHASH" command.
*
- * See RFC 2812, 4.2 "Rehash message".
- *
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
if (!Op_Check(Client, Req))
return Op_NoPrivileges(Client, Req);
- /* Bad number of parameters? */
- if (Req->argc != 0)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
- Client_ID(Client), Req->command );
+ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 0)
Log(LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\" ...",
Client_Mask(Client));
/**
* Handler for the IRC "RESTART" command.
*
- * See RFC 2812, 4.4 "Restart message".
- *
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
/**
* Handler for the IRC "CONNECT" command.
*
- * See RFC 2812, 3.4.7 "Connect message".
- *
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
* @return CONNECTED or DISCONNECTED.
/**
* Handler for the IRC "WALLOPS" command.
- *
- * See RFC 2812, 4.7 "Operwall message".
*
* @param Client The client from which this command has been received.
* @param Req Request structure with prefix and all parameters.
assert( Client != NULL );
assert( Req != NULL );
- if (Req->argc != 1)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
- Client_ID(Client), Req->command);
+ _IRC_ARGC_EQ_OR_RETURN_(Client, Req, 1)
switch (Client_Type(Client)) {
case CLIENT_USER: