added "nowho" parameter to debug userlist and fixed memory leak in DBHelper.c
[NeonServV5.git] / src / cmd_neonserv_nicklist.c
index 268621dfcc613442628e0741cd630ec2fa1096d4..181923c45e611760fefbfc60c5bc28260e0824b3 100644 (file)
@@ -1,5 +1,5 @@
-/* cmd_neonserv_nicklist.c - NeonServ v5.2
- * Copyright (C) 2011  Philipp Kreil (pk910)
+/* cmd_neonserv_nicklist.c - NeonServ v5.3
+ * 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
@@ -49,6 +49,12 @@ CMD_BIND(neonserv_cmd_nicklist) {
         syncusers = 1;
         event->flags |= CMDFLAG_LOG;
     }
+    if(argc && !stricmp(argv[0], "nowho") && isGodMode(user)) {
+        argv++;
+        argc--;
+        neonserv_cmd_nicklist_async1(client, getTextBot(), user, chan, event, (argc ? argv[0] : NULL), syncusers);
+        return;
+    }
     struct neonserv_cmd_nicklist_cache *cache = malloc(sizeof(*cache));
     if (!cache) {
         perror("malloc() failed");
@@ -212,7 +218,7 @@ static void neonserv_cmd_nicklist_async1(struct ClientSocket *client, struct Cli
     table_free(table);
     if(synced_user) {
         if(!syncusers)
-            reply(textclient, user, "NS_NICKLIST_SYNC");
+            reply(textclient, user, "NS_NICKLIST_SYNC", db_enfops, db_enfvoice);
         else
             logEvent(event);
     }
@@ -229,7 +235,7 @@ static void neonserv_cmd_nicklist_synchronize_user(struct ChanNode *chan, struct
         userid = atoi(row[0]);
     } else {
         printf_mysql_query("INSERT INTO `users` (`user_user`) VALUES ('%s')", escape_string(user->auth));
-        userid = (int) mysql_insert_id(mysql_conn);
+        userid = (int) mysql_insert_id(get_mysql_conn());
     }
     //check if already added
     printf_mysql_query("SELECT `chanuser_access`, `chanuser_id`, `chanuser_seen` FROM `chanusers` WHERE `chanuser_cid` = '%d' AND `chanuser_uid` = '%d'", chan->channel_id, userid);