X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fcmd_neonserv_myaccess.c;h=c37f0f8b0452f37a870ad497b89fb551f884c66e;hb=bb5692b9cbff069abbf9573c81e86c3cd2061ceb;hp=31d792170e749895fad740330bc2cbff890c58a2;hpb=f427edf43864bf4fd823e201c0bb9fe0c5801004;p=NeonServV5.git diff --git a/src/cmd_neonserv_myaccess.c b/src/cmd_neonserv_myaccess.c index 31d7921..c37f0f8 100644 --- a/src/cmd_neonserv_myaccess.c +++ b/src/cmd_neonserv_myaccess.c @@ -1,3 +1,19 @@ +/* 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "cmd_neonserv.h" @@ -95,6 +111,10 @@ static USERAUTH_CALLBACK(neonserv_cmd_myaccess_nick_lookup) { static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nick, char *auth, char *chanmatch) { //we've got a valid auth now... + if(stricmp(user->auth, auth) && !isGodMode(user)) { + reply(textclient, user, "NS_MYACCESS_SELF_ONLY"); + return; + } MYSQL_RES *res, *default_res; MYSQL_ROW user_row, chanuser_row, default_chan = NULL; char flagBuf[5]; @@ -115,7 +135,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); @@ -142,7 +162,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); }