X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodcmd.c;h=fd71523edfd64869f47cb60a0913c7f0bc762656;hb=ef2f721db1b8f2d42df5483e1d9cd1769103e37c;hp=5837d33983eeab109d08289330cd6ccccd30265b;hpb=8ce78bf760720d04385821abba8f888b5de03140;p=NeonServV5.git diff --git a/src/modcmd.c b/src/modcmd.c index 5837d33..fd71523 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -27,6 +27,8 @@ #include "mysqlConn.h" #include "DBHelper.h" #include "EventLogger.h" +#include "tools.h" +#include "log.h" struct trigger_callback { int botid; @@ -112,7 +114,7 @@ static char* get_channel_trigger(int botid, int clientid, struct ChanNode *chan) triggerStr[0] = '\0'; trigger = malloc(sizeof(*trigger)); if (!trigger) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return 0; } trigger->botid = botid; @@ -379,7 +381,7 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s struct command_check_user_cache *data = malloc(sizeof(*data)); char **temp_argv = malloc(argc*sizeof(*temp_argv)); if (!data || !temp_argv) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); break; } memcpy(temp_argv, argv, argc*sizeof(*temp_argv)); @@ -629,7 +631,7 @@ int register_command(int botid, char *name, int module_id, cmd_bind_t *func, int } cmdfunc = malloc(sizeof(*cmdfunc)); if (!cmdfunc) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return 0; } cmdfunc->botid = botid; @@ -654,7 +656,7 @@ int set_trigger_callback(int botid, int module_id, trigger_callback_t *func) { if(!cb) { cb = malloc(sizeof(*cb)); if (!cb) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return 0; } cb->botid = botid; @@ -708,7 +710,7 @@ int bind_botwise_cmd_to_function(int botid, int clientid, char *cmd, struct cmd_ } cbind = malloc(sizeof(*cbind)); if (!cbind) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return 0; } cbind->botid = botid; @@ -754,7 +756,7 @@ int bind_botwise_cmd_to_command(int botid, int clientid, char *cmd, char *func) } cbind = malloc(sizeof(*cbind)); if (!cbind) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return 0; } cbind->botid = botid; @@ -1008,7 +1010,7 @@ void register_command_alias(int botid, char *alias) { } botalias = malloc(sizeof(*botalias)); if (!botalias) { - perror("malloc() failed"); + printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return; } botalias->botid = botid;