#include "main.h"
#include "ClientSocket.h"
-#define MAXNUMPARAMS 200 /* maximum number of parameters in one line */
-
#define IRC_CMD(NAME) int NAME(struct ClientSocket *client, UNUSED_ARG(const char *from), UNUSED_ARG(char **argv), UNUSED_ARG(unsigned int argc))
typedef IRC_CMD(irc_cmd_t);
#define CHANNELLEN 200
#define MAXLEN 512
#define TRIGGERLEN 50
+#define MAXNUMPARAMS 200 /* maximum number of parameters in one line */
//valid nick chars
#define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^_`"
static void handle_command(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char *message) {
if(message[0] == '#') {
char *chanName = message;
- message = strstr(message, ' ');
+ message = strstr(message, " ");
if(!message) return;
*message = '\0';
message++;
if(cbind->botid == client->botid && strcmp(cbind->cmd, message) == 0) {
struct cmd_function *cmdfunc = cbind->func;
//parse the arguments...
- char *argv[MAXNUMPARAMS];
+ char *arga[MAXNUMPARAMS];
+ char **argv;
int argc = 0;
while(*args) {
//skip leading spaces
while (*args == ' ')
*args++ = 0;
- argv[argc++] = args;
+ arga[argc++] = args;
if (argc >= MAXNUMPARAMS)
break;
while (*args != ' ' && *args)
args++;
}
- if(argc != 0 && args[0][0] == '#') {
- struct ChanNode *chan2 = getChanByName(args[0]);
+ argv = arga;
+ if(argc != 0 && argv[0][0] == '#') {
+ struct ChanNode *chan2 = getChanByName(argv[0]);
if(chan2) {
argv += 1;
argc -= 1;