rewrote IRC cache parser to be (hopefully) more stable
[NeonServV5.git] / src / tools.c
index 2cb1065fa8458b33b2235200e3269f79a1e48558..093ed80b03618803c579b327e829e9767d32ecce 100644 (file)
@@ -1,4 +1,4 @@
-/* tools.c - NeonServ v5.3
+/* tools.c - NeonServ v5.4
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -212,7 +212,8 @@ char **table_end(struct Table *table) {
                         }
                     }
                 }
-            }
+            } else if(table->col_flags[col] & TABLE_FLAG_COL_SKIP_NULL)
+                continue;
             i -= j;
             if(col < table->width-1) {
                 for(;i < table->maxwidth[col]; i++) {
@@ -416,6 +417,8 @@ void flushModeBuffer(struct ModeBuffer *modeBuf) {
             modeStr[modePos++] = modeBuf->addModes[i];
             if(modeBuf->addModesParams[i]) {
                 paramPos += sprintf(paramStr + paramPos, " %s", modeBuf->addModesParams[i]);
+                free(modeBuf->addModesParams[i]);
+                modeBuf->addModesParams[i] = NULL;
             }
         }
         modeBuf->addCount = 0;
@@ -426,6 +429,8 @@ void flushModeBuffer(struct ModeBuffer *modeBuf) {
             modeStr[modePos++] = modeBuf->delModes[i];
             if(modeBuf->delModesParams[i]) {
                 paramPos += sprintf(paramStr + paramPos, " %s", modeBuf->delModesParams[i]);
+                free(modeBuf->delModesParams[i]);
+                modeBuf->delModesParams[i] = NULL;
             }
         }
         modeBuf->delCount = 0;
@@ -517,7 +522,7 @@ int isFakeHost(char *host) {
     char *p1, *p2 = host;
     
     //find the last dot to identify if the hostmask is a fake host
-    while((p1 = strstr(p2, "."))) {
+    while((p1 = strchr(p2, '.'))) {
         p2 = p1 + 1;
     }
     //TLD database: http://www.iana.org/domains/root/db/