X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2Fglobal.mod%2Fcmd_global_setaccess.c;h=8753cc30ac74442275e9b83c7a6daa4dfc057de0;hb=ee39770362f69ced5b52104b622582e882af0b77;hp=f69b3c04616f363f49346f75b6130da80038622f;hpb=689da1db7e2517c187ce76c6c553e20d630a7f36;p=NeonServV5.git diff --git a/src/modules/global.mod/cmd_global_setaccess.c b/src/modules/global.mod/cmd_global_setaccess.c index f69b3c0..8753cc3 100644 --- a/src/modules/global.mod/cmd_global_setaccess.c +++ b/src/modules/global.mod/cmd_global_setaccess.c @@ -1,4 +1,4 @@ -/* cmd_global_setaccess.c - NeonServ v5.4 +/* cmd_global_setaccess.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -39,13 +39,13 @@ CMD_BIND(global_cmd_setaccess) { MYSQL_ROW row; caccess = atoi(argv[1]); if(caccess < 0 || caccess > 1000) { - reply(getTextBot(), user, "NS_INVALID_ACCESS", caccess); + reply(textclient, user, "NS_INVALID_ACCESS", caccess); return; } printf_mysql_query("SELECT `user_access` FROM `users` WHERE `user_user` = '%s'", escape_string(user->auth)); res = mysql_use(); if ((row = mysql_fetch_row(res)) == NULL || atoi(row[0]) < caccess) { - reply(getTextBot(), user, "NS_ACCESS_OUTRANKED"); + reply(textclient, user, "NS_ACCESS_OUTRANKED"); return; } if(argv[0][0] == '*') { @@ -54,17 +54,17 @@ CMD_BIND(global_cmd_setaccess) { printf_mysql_query("SELECT `user_user` FROM `users` WHERE `user_user` = '%s'", escape_string(argv[0])); res = mysql_use(); if ((row = mysql_fetch_row(res)) != NULL) { - global_cmd_setaccess_async1(client, getTextBot(), user, event, argv[0], row[0], caccess); + global_cmd_setaccess_async1(client, textclient, user, event, argv[0], row[0], caccess); } else { //we need to create a new user... //but first lookup the auth to check if it really exists struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache)); if (!cache) { - perror("malloc() failed"); + printf_log("global", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return; } cache->client = client; - cache->textclient = getTextBot(); + cache->textclient = textclient; cache->user = user; cache->event = event; cache->access = caccess; @@ -76,21 +76,21 @@ CMD_BIND(global_cmd_setaccess) { if(!cuser) { cuser = createTempUser(argv[0]); if(!cuser) { - reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]); + reply(textclient, user, "NS_USER_UNKNOWN", argv[0]); return; } cuser->flags |= USERFLAG_ISTMPUSER; } if(cuser->flags & USERFLAG_ISAUTHED) { - global_cmd_setaccess_async1(client, getTextBot(), user, event, argv[0], cuser->auth, caccess); + global_cmd_setaccess_async1(client, textclient, user, event, argv[0], cuser->auth, caccess); } else { struct global_cmd_setaccess_cache *cache = malloc(sizeof(*cache)); if (!cache) { - perror("malloc() failed"); + printf_log("global", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__); return; } cache->client = client; - cache->textclient = getTextBot(); + cache->textclient = textclient; cache->user = user; cache->event = event; cache->access = caccess;