added new multi log system
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_trim.c
index 1e382d67c8f5ee4cac2c7cdb4d87c260154271c5..52478a99ff80c950aa72a1830c8011b1a9e9c392 100644 (file)
@@ -1,4 +1,4 @@
-/* cmd_neonserv_trim.c - NeonServ v5.4
+/* cmd_neonserv_trim.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -38,14 +38,14 @@ CMD_BIND(neonserv_cmd_trim) {
         if(isGodMode(user)) {
             event->flags |= CMDFLAG_OPLOG;
         } else {
-            reply(getTextBot(), user, "NS_ACCESS_DENIED");
+            reply(textclient, user, "NS_ACCESS_DENIED");
             return;
         }
     }
     int min_access, max_access;
     int duration = strToTime(user, argv[1]);
     if(duration < 30) {
-        reply(getTextBot(), user, "NS_TRIM_DURATION_TOO_SHORT", 30);
+        reply(textclient, user, "NS_TRIM_DURATION_TOO_SHORT", 30);
         return;
     }
     if(!stricmp(argv[0], "users")) {
@@ -56,7 +56,7 @@ CMD_BIND(neonserv_cmd_trim) {
             if(isGodMode(user)) {
                 event->flags |= CMDFLAG_OPLOG;
             } else {
-                reply(getTextBot(), user, "NS_ACCESS_DENIED");
+                reply(textclient, user, "NS_ACCESS_DENIED");
                 return;
             }
         }
@@ -77,7 +77,7 @@ CMD_BIND(neonserv_cmd_trim) {
         }
         freeModeBuffer(modenode);
         char timeBuf[MAXLEN];
-        reply(getTextBot(), user, "NS_TRIM_BAN_DONE", bancount, chan->name, timeToStr(user, duration, 3, timeBuf));
+        reply(textclient, user, "NS_TRIM_BAN_DONE", bancount, chan->name, timeToStr(user, duration, 3, timeBuf));
         if(bancount)
             logEvent(event);
         return;
@@ -89,7 +89,7 @@ CMD_BIND(neonserv_cmd_trim) {
             min_access = atoi(argv[0]);
             max_access = atoi(seperator);
             if(max_access < min_access) {
-                reply(getTextBot(), user, "NS_INVALID_ACCESS_RANGE", min_access, max_access);
+                reply(textclient, user, "NS_INVALID_ACCESS_RANGE", min_access, max_access);
                 return;
             }
         } else {
@@ -100,18 +100,18 @@ CMD_BIND(neonserv_cmd_trim) {
             if(isGodMode(user)) {
                 event->flags |= CMDFLAG_OPLOG;
             } else {
-                reply(getTextBot(), user, "NS_NO_ACCESS");
+                reply(textclient, user, "NS_NO_ACCESS");
                 return;
             }
         }
     }
     struct neonserv_cmd_trim_cache *cache = malloc(sizeof(*cache));
     if (!cache) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return;
     }
     cache->client = client;
-    cache->textclient = getTextBot();
+    cache->textclient = textclient;
     cache->user = user;
     cache->event = event;
     cache->min_access = min_access;
@@ -152,7 +152,7 @@ static void neonserv_cmd_trim_async1(struct ClientSocket *client, struct ClientS
         }
     }
     char timeBuf[MAXLEN];
-    reply(getTextBot(), user, "NS_TRIM_DONE", trim_count, min_access, max_access, chan->name, timeToStr(user, duration, 3, timeBuf));
+    reply(textclient, user, "NS_TRIM_DONE", trim_count, min_access, max_access, chan->name, timeToStr(user, duration, 3, timeBuf));
     if(trim_count)
         logEvent(event);
 }