X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FModeNode.c;h=f3579cd42b71654ae34d168eddec03bf6393b5c8;hp=438a51616677e44229b2bebc0b0669911bedf7f8;hb=HEAD;hpb=44436a96352a38631237978c9fd431cef3d85cfb diff --git a/src/ModeNode.c b/src/ModeNode.c index 438a516..f3579cd 100644 --- a/src/ModeNode.c +++ b/src/ModeNode.c @@ -1,5 +1,5 @@ -/* ModeNode.c - NeonServ v5.3 - * Copyright (C) 2011 Philipp Kreil (pk910) +/* ModeNode.c - NeonServ v5.6 + * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * 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 @@ -19,6 +19,7 @@ #include "ChanUser.h" #include "UserNode.h" #include "BanNode.h" +#include "log.h" static int modes_with_strarg, modes_with_intarg, modes_count; @@ -77,7 +78,7 @@ struct ModeNode *createModeNode(struct ChanNode *chan) { struct ModeNode *modes = malloc(sizeof(*modes)); if (!modes) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return NULL; } modes->chan = chan; @@ -284,7 +285,7 @@ int parseMode(struct ModeNode* modes, int add, char mode, char *param) { modes->modes &= ~modeOpt[0]; modes->allmodes |= modeOpt[0]; if(MODE_TYPE == CHANNEL_MODE_TYPE_B) { - if(!param) return 0; + if(!param && !(modeOpt[2] & CHANNEL_MODE_KEY)) return 0; if(MODE_VALUE == CHANNEL_MODE_VALUE_STRING) { free(modes->mode_str_args[MODE_VALUE_INDEX]); modes->mode_str_args[MODE_VALUE_INDEX] = NULL;