added new multi log system
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_nicklist.c
index 1287ad6c993ba8714738c64dc3b6b2d4b73e30d2..0fad5a84b522ab4ebec2e70f346f60d375828243 100644 (file)
@@ -1,4 +1,4 @@
-/* cmd_neonserv_nicklist.c - NeonServ v5.5
+/* cmd_neonserv_nicklist.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -66,7 +66,7 @@ CMD_BIND(neonserv_cmd_nicklist) {
     }
     struct neonserv_cmd_nicklist_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;
@@ -129,7 +129,7 @@ static void neonserv_cmd_nicklist_async1(struct ClientSocket *client, struct Cli
     int chanuser_count;
     char statebuf[5];
     char accessbuf[50];
-    char viscountbuf[5];
+    char viscountbuf[50];
     int uaccess;
     
     i = 3;
@@ -241,7 +241,10 @@ static void neonserv_cmd_nicklist_async1(struct ClientSocket *client, struct Cli
                 }
             } else {
                 synced_user = 1;
-                accessbufpos = sprintf(accessbuf, "\003040\003");
+                if(((chanuser->flags & CHANUSERFLAG_OPPED) && db_enfops > uaccess) || ((chanuser->flags & CHANUSERFLAG_VOICED) && db_enfvoice > uaccess))
+                    accessbufpos = sprintf(accessbuf, "\003040\003");
+                else
+                    accessbufpos = sprintf(accessbuf, "0");
             }
         } else if(!uaccess)
             accessbufpos = sprintf(accessbuf, "0");
@@ -275,7 +278,10 @@ static void neonserv_cmd_nicklist_async1(struct ClientSocket *client, struct Cli
             accessbufpos += sprintf(accessbuf+accessbufpos, ")");
         content[2] = accessbuf;
         if(flags & NEONSERV_CMD_NICKLIST_FLAG_VISCOUNT) {
-            sprintf(viscountbuf, "%d", chanuser->visCount);
+            if(chanuser->flags & CHANUSERFLAG_PARTING)
+                sprintf(viscountbuf, "%d (\003P\003 %d)", chanuser->visCount, chanuser->old_visCount);
+            else
+                sprintf(viscountbuf, "%d", chanuser->visCount);
             content[3] = viscountbuf;
         }
         table_add(table, content);