fixed path of mysql/errmsg.h (OSX compilation fix)
[NeonServV5.git] / src / EventLogger.c
index 3bf944b10c709114668da58538a9061a34ac3d69..77956d799254e639c21a29fc3b8233d4e7713960 100644 (file)
@@ -1,3 +1,19 @@
+/* EventLogger.c - NeonServ v5.6
+ * 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 <http://www.gnu.org/licenses/>. 
+ */
 
 #include "EventLogger.h"
 #include "modcmd.h"
@@ -8,7 +24,7 @@
 
 static struct Event *first_event = NULL, *last_event = NULL;
 
-struct Event *createEvent(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char *command, char **args, int argc, int flags) {
+struct Event *createEvent(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct cmd_binding *command, char **args, int argc, int flags) {
     struct Event *event = malloc(sizeof(*event));
     if (!event)
     {
@@ -19,7 +35,7 @@ struct Event *createEvent(struct ClientSocket *client, struct UserNode *user, st
     event->user = user;
     event->chan = chan;
     event->event_time = time(0);
-    event->command = strdup(command);
+    event->command = command;
     char arguments[MAXLEN];
     int argpos = 0;
     int i;
@@ -41,7 +57,7 @@ struct Event *createEvent(struct ClientSocket *client, struct UserNode *user, st
 
 void logEvent(struct Event *event) {
     char fullcmd[MAXLEN];
-    sprintf(fullcmd, "%s %s", event->command, event->arguments);
+    sprintf(fullcmd, "%s %s", event->command->func->name, event->arguments);
     if((event->flags & CMDFLAG_LOG) && event->chan) {
         char *auth = ((event->user->flags & USERFLAG_ISAUTHED) ? event->user->auth : "*");
         loadChannelSettings(event->chan);
@@ -76,7 +92,6 @@ static void destroyEvent(struct Event *event) {
             if(last->next == NULL) break;
         last_event = last;
     }
-    free(event->command);
     free(event->arguments);
     free(event);
 }