changed Makefile; build all commands as an own file
[NeonServV5.git] / cmd_neonserv_op.c
index 0510fe8135e69906ba379d91984cedb7628e9d1d..2bf69c03c6ca350861e2329632ee197d1d55a9d2 100644 (file)
@@ -1,17 +1,20 @@
 
+#include "cmd_neonserv.h"
+
 /*
 * argv[0-*]    nicks
 */
 static USERLIST_CALLBACK(neonserv_cmd_op_userlist_lookup);
-static void neonserv_cmd_op_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nicks);
+static void neonserv_cmd_op_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, char *nicks);
 
 struct neonserv_cmd_op_cache {
     struct ClientSocket *client, *textclient;
     struct UserNode *user;
+    struct Event *event;
     char *nicks;
 };
 
-static CMD_BIND(neonserv_cmd_op) {
+CMD_BIND(neonserv_cmd_op) {
     struct neonserv_cmd_op_cache *cache = malloc(sizeof(*cache));
     if (!cache) {
         perror("malloc() failed");
@@ -20,18 +23,19 @@ static CMD_BIND(neonserv_cmd_op) {
     cache->client = client;
     cache->textclient = getTextBot();
     cache->user = user;
+    cache->event = event;
     cache->nicks = strdup(merge_argv(argv, 0, argc));
     get_userlist_with_invisible(chan, neonserv_cmd_op_userlist_lookup, cache);
 }
 
 static USERLIST_CALLBACK(neonserv_cmd_op_userlist_lookup) {
     struct neonserv_cmd_op_cache *cache = data;
-    neonserv_cmd_op_async1(cache->client, cache->textclient, cache->user, chan, cache->nicks);
+    neonserv_cmd_op_async1(cache->client, cache->textclient, cache->user, chan, cache->event, cache->nicks);
     free(cache->nicks);
     free(cache);
 }
 
-static void neonserv_cmd_op_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nicks) {
+static void neonserv_cmd_op_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, char *nicks) {
     int total_users = 0, done_users = 0;
     struct UserNode *cuser;
     struct ChanUser *chanuser;
@@ -68,4 +72,6 @@ static void neonserv_cmd_op_async1(struct ClientSocket *client, struct ClientSoc
         reply(textclient, user, "NS_OP_DONE", chan->name);
     else
         reply(textclient, user, "NS_OP_FAIL", client->user->nick);
+    if(done_users) 
+        logEvent(event);
 }