X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fcmd_neonserv_myaccess.c;h=b9f65811f197282e5a07f855a98ae057972f39fe;hb=b53d0c5f88063f075a48a0426f9d5d6b3490b9fc;hp=0ab6418a10f95a854917bae6e029ff0e856a7ef8;hpb=3a909b1c8c0cd7198cbc6b13438b28a2c9b47e64;p=NeonServV5.git diff --git a/src/cmd_neonserv_myaccess.c b/src/cmd_neonserv_myaccess.c index 0ab6418..b9f6581 100644 --- a/src/cmd_neonserv_myaccess.c +++ b/src/cmd_neonserv_myaccess.c @@ -1,5 +1,5 @@ -/* cmd_neonserv_myaccess.c - NeonServ v5.2 - * Copyright (C) 2011 Philipp Kreil (pk910) +/* cmd_neonserv_myaccess.c - NeonServ v5.3 + * 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 @@ -67,6 +67,10 @@ CMD_BIND(neonserv_cmd_myaccess) { struct UserNode *cuser = getUserByNick(argv[0]); if(!cuser) { cuser = createTempUser(argv[0]); + if(!cuser) { + reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[0]); + return; + } cuser->flags |= USERFLAG_ISTMPUSER; } if(cuser->flags & USERFLAG_ISAUTHED) { @@ -135,7 +139,7 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli if ((user_row = mysql_fetch_row(res)) != NULL) { userid = atoi(user_row[0]); //check if the user is already added - printf_mysql_query("SELECT `chanuser_access`, `chanuser_flags`, `chanuser_infoline`, `channel_name`, `channel_getop`, `channel_getvoice`, `botid` FROM `chanusers` LEFT JOIN `channels` ON `chanuser_cid` = `channel_id` LEFT JOIN `bot_channels` ON `chanuser_cid` = `chanid` LEFT JOIN `bots` ON `bots`.`id` = `botid` WHERE `chanuser_uid` = '%d' AND `botclass` = '%d' ORDER BY `chanuser_access` DESC, `channel_name` ASC", userid, client->botid); + printf_mysql_query("SELECT `chanuser_access`, `chanuser_flags`, `chanuser_infoline`, `channel_name`, `channel_getop`, `channel_getvoice`, `botid` FROM `chanusers` LEFT JOIN `channels` ON `chanuser_cid` = `channel_id` LEFT JOIN `bot_channels` ON `chanuser_cid` = `chanid` LEFT JOIN `bots` ON `bots`.`id` = `botid` WHERE `chanuser_uid` = '%d' AND `botclass` = '%d' AND `active` = '1' ORDER BY `chanuser_access` DESC, `channel_name` ASC", userid, client->botid); res = mysql_use(); total_count = mysql_num_rows(res); table = table_init(4, total_count + 1, 0); @@ -162,7 +166,7 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli flagPos += sprintf(flagBuf + flagPos, "v"); if((cflags & DB_CHANUSER_AUTOINVITE)) flagPos += sprintf(flagBuf + flagPos, "i"); - content[2] = flagBuf; + content[2] = (flagPos ? flagBuf : ""); content[3] = chanuser_row[2]; table_add(table, content); } @@ -182,4 +186,5 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli } else { reply(textclient, user, "NS_MYACCESS_COUNT", auth, total_count, owner_count); } + table_free(table); }