X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2FNeonServ.mod%2Fcmd_neonserv_myaccess.c;h=29f8cfdf2c289cd307568936728c497aad610b42;hb=b073db1a07d123fd422a43970e4f7caa008ff4c9;hp=6fa063b2508736ce087f704068445dd6fe6d05f4;hpb=ee39770362f69ced5b52104b622582e882af0b77;p=NeonServV5.git 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); }