changed Makefile; build all commands as an own file
[NeonServV5.git] / cmd_neonserv_voiceall.c
index 7cb01deea78b4d81a59a6de20ea4578c0262f0f4..e4de009e458edc3df0f95931c5b6e60e430ccdc9 100644 (file)
@@ -1,17 +1,20 @@
 
+#include "cmd_neonserv.h"
+
 /*
 * argv[0]    (optional) nick mask
 */
 static USERLIST_CALLBACK(neonserv_cmd_voiceall_userlist_lookup);
-static void neonserv_cmd_voiceall_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nickmask);
+static void neonserv_cmd_voiceall_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, char *nickmask);
 
 struct neonserv_cmd_voiceall_cache {
     struct ClientSocket *client, *textclient;
     struct UserNode *user;
+    struct Event *event;
     char *nickmask;
 };
 
-static CMD_BIND(neonserv_cmd_voiceall) {
+CMD_BIND(neonserv_cmd_voiceall) {
     struct neonserv_cmd_voiceall_cache *cache = malloc(sizeof(*cache));
     if (!cache) {
         perror("malloc() failed");
@@ -20,6 +23,7 @@ static CMD_BIND(neonserv_cmd_voiceall) {
     cache->client = client;
     cache->textclient = getTextBot();
     cache->user = user;
+    cache->event = event;
     if(argc > 0) {
         cache->nickmask = strdup(argv[0]);
     } else
@@ -29,13 +33,13 @@ static CMD_BIND(neonserv_cmd_voiceall) {
 
 static USERLIST_CALLBACK(neonserv_cmd_voiceall_userlist_lookup) {
     struct neonserv_cmd_voiceall_cache *cache = data;
-    neonserv_cmd_voiceall_async1(cache->client, cache->textclient, cache->user, chan, cache->nickmask);
+    neonserv_cmd_voiceall_async1(cache->client, cache->textclient, cache->user, chan, cache->event, cache->nickmask);
     if(cache->nickmask)
         free(cache->nickmask);
     free(cache);
 }
 
-static void neonserv_cmd_voiceall_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *nickmask) {
+static void neonserv_cmd_voiceall_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, char *nickmask) {
     int done_users = 0;
     struct ChanUser *chanuser;
     struct ModeBuffer *modeBuf;
@@ -48,4 +52,6 @@ static void neonserv_cmd_voiceall_async1(struct ClientSocket *client, struct Cli
     }
     freeModeBuffer(modeBuf);
     reply(textclient, user, "NS_VOICEALL_DONE", done_users, chan->name);
+    if(done_users)
+        logEvent(event);
 }