From: pk910 Date: Thu, 27 Sep 2012 23:10:57 +0000 (+0200) Subject: added cmd_myaccess override message and blocked iohandler log through irc completely X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=b073db1a07d123fd422a43970e4f7caa008ff4c9 added cmd_myaccess override message and blocked iohandler log through irc completely --- diff --git a/src/log.c b/src/log.c index 6e1ba87..9907f2b 100644 --- a/src/log.c +++ b/src/log.c @@ -138,7 +138,7 @@ static void write_log(const char *module, const int section, const char *line, i if(!(target->section & section)) continue; if(target->type == LOG_TARGET_TYPE_IRC) { - if(section == LOG_IRCRAW || (!stricmp(module, "iohandler") && section == LOG_DEBUG)) + if(section == LOG_IRCRAW || !stricmp(module, "iohandler")) continue; //endless loop ;) struct ChanNode *channel = getChanByName(target->target.channel); struct ClientSocket *client; diff --git a/src/modules/NeonServ.mod/cmd_neonserv_myaccess.c b/src/modules/NeonServ.mod/cmd_neonserv_myaccess.c index 6fa063b..29f8cfd 100644 --- a/src/modules/NeonServ.mod/cmd_neonserv_myaccess.c +++ b/src/modules/NeonServ.mod/cmd_neonserv_myaccess.c @@ -21,12 +21,13 @@ * argv[0] - nick / *auth */ 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); +static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, char *nick, char *auth, char *chanmatch); struct neonserv_cmd_myaccess_cache { struct ClientSocket *client, *textclient; struct UserNode *user; struct ChanNode *chan; + struct Event *event; char *nick; char *chanmatch; }; @@ -51,7 +52,7 @@ CMD_BIND(neonserv_cmd_myaccess) { cache->chanmatch = (chanmatch ? strdup(chanmatch) : NULL); get_userauth(user, module_id, neonserv_cmd_myaccess_nick_lookup, cache); } else - neonserv_cmd_myaccess_async1(client, textclient, user, chan, user->nick, user->auth, chanmatch); + neonserv_cmd_myaccess_async1(client, textclient, user, chan, event, user->nick, user->auth, chanmatch); } else if(argv[0][0] == '*') { //we've got an auth @@ -59,7 +60,7 @@ CMD_BIND(neonserv_cmd_myaccess) { chanmatch = argv[1]; } argv[0]++; - neonserv_cmd_myaccess_async1(client, textclient, user, chan, NULL, argv[0], chanmatch); + neonserv_cmd_myaccess_async1(client, textclient, user, chan, event, NULL, argv[0], chanmatch); } else { if(argc > 1 && argv[1][0] == '#') { chanmatch = argv[1]; @@ -74,7 +75,7 @@ CMD_BIND(neonserv_cmd_myaccess) { cuser->flags |= USERFLAG_ISTMPUSER; } if(cuser->flags & USERFLAG_ISAUTHED) { - neonserv_cmd_myaccess_async1(client, textclient, user, chan, argv[0], cuser->auth, chanmatch); + neonserv_cmd_myaccess_async1(client, textclient, user, chan, event, argv[0], cuser->auth, chanmatch); } else { struct neonserv_cmd_myaccess_cache *cache = malloc(sizeof(*cache)); if (!cache) { @@ -85,6 +86,7 @@ CMD_BIND(neonserv_cmd_myaccess) { cache->textclient = textclient; cache->user = user; cache->chan = chan; + cache->event = event; cache->nick = strdup(argv[0]); cache->chanmatch = (chanmatch ? strdup(chanmatch) : NULL); get_userauth(cuser, module_id, neonserv_cmd_myaccess_nick_lookup, cache); @@ -106,18 +108,21 @@ static USERAUTH_CALLBACK(neonserv_cmd_myaccess_nick_lookup) { reply(cache->textclient, cache->user, "NS_USER_NEED_AUTH", cache->nick); } else - neonserv_cmd_myaccess_async1(cache->client, cache->textclient, cache->user, cache->chan, user->nick, user->auth, cache->chanmatch); + neonserv_cmd_myaccess_async1(cache->client, cache->textclient, cache->user, cache->chan, cache->event, user->nick, user->auth, cache->chanmatch); if(cache->chanmatch) free(cache->chanmatch); free(cache->nick); free(cache); } -static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nick, char *auth, char *chanmatch) { +static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, 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; + if(stricmp(user->auth, auth)) { + if(!isGodMode(user)) { + reply(textclient, user, "NS_MYACCESS_SELF_ONLY"); + return; + } else + event->flags |= CMDFLAG_OPLOG; } MYSQL_RES *res, *default_res; MYSQL_ROW user_row, chanuser_row, default_chan = NULL; @@ -187,4 +192,6 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli reply(textclient, user, "NS_MYACCESS_COUNT", auth, total_count, owner_count); } table_free(table); + if(event->flags & CMDFLAG_OPLOG) + logEvent(event); }