fixed cmd_myaccess
authorpk910 <philipp@zoelle1.de>
Mon, 22 Aug 2011 21:32:53 +0000 (23:32 +0200)
committerpk910 <philipp@zoelle1.de>
Mon, 22 Aug 2011 21:32:53 +0000 (23:32 +0200)
cmd_neonserv_myaccess.c

index ccda707e7efe048fb2e55f57c8e7504d298b64e3..16a718ba21385fd8fdcb4b27d5064403776fbc84 100644 (file)
@@ -97,7 +97,7 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli
     MYSQL_ROW user_row, chanuser_row;
     char flagBuf[5];
     int userid, cflags, caccess, flagPos;
-    int total_count, match_count = 0, owner_count = 0;
+    int i, total_count, match_count = 0, owner_count = 0;
     struct Table *table;
     printf_mysql_query("SELECT `user_id`, `user_access`, `user_god` FROM `users` WHERE `user_user` = '%s'", escape_string(auth));
     res = mysql_use();
@@ -110,33 +110,33 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli
     content[3] = get_language_string(user, "NS_MYACCESS_HEADER_INFO");
     table_add(table, content);
     if(chanmatch)
-        reply(textbot, user, "NS_MYACCESS_HEADER_MATCH", auth, chanmatch);
+        reply(textclient, user, "NS_MYACCESS_HEADER_MATCH", auth, chanmatch);
     else
-        reply(textbot, user, "NS_MYACCESS_HEADER", auth);
+        reply(textclient, user, "NS_MYACCESS_HEADER", auth);
     if ((user_row = mysql_fetch_row(res)) != NULL) {
         userid = atoi(user_row[0]);
         //check if the user is already added
         printf_mysql_query("SELECT `chanuser_access`, `chanuser_flags`, `chanuser_infoline`, `channel_name`, `channel_getop`, `channel_getvoice` FROM `chanusers` LEFT JOIN `channels` ON `chanuser_cid` = `channel_id` WHERE `chanuser_uid` = '%d' ORDER BY `chanuser_access` DESC, `channel_name` ASC", userid);
         res = mysql_use();
         while ((chanuser_row = mysql_fetch_row(res)) != NULL) {
-            if(!strcmp(row[0], "500")) owner_count++;
-            if(chanmatch && match(chanmatch, row[0])) continue;
+            if(!strcmp(chanuser_row[0], "500")) owner_count++;
+            if(chanmatch && match(chanmatch, chanuser_row[0])) continue;
             match_count++;
             flagPos = 0;
-            content[0] = row[3];
-            content[1] = row[0];
-            cflags = atoi(row[1]);
-            caccess = atoi(row[0]);
+            content[0] = chanuser_row[3];
+            content[1] = chanuser_row[0];
+            cflags = atoi(chanuser_row[1]);
+            caccess = atoi(chanuser_row[0]);
             if((cflags & DB_CHANUSER_SUSPENDED))
                 flagPos += sprintf(flagBuf + flagPos, "s");
-            if(caccess >= atoi(row[4]))
+            if(caccess >= atoi(chanuser_row[4]))
                 flagPos += sprintf(flagBuf + flagPos, "o");
-            if(caccess >= atoi(row[5]))
+            if(caccess >= atoi(chanuser_row[5]))
                 flagPos += sprintf(flagBuf + flagPos, "v");
             if((cflags & DB_CHANUSER_AUTOINVITE))
                 flagPos += sprintf(flagBuf + flagPos, "i");
             content[2] = flagBuf;
-            content[3] = row[2];
+            content[3] = chanuser_row[2];
             table_add(table, content);
         }
     }
@@ -145,11 +145,11 @@ static void neonserv_cmd_myaccess_async1(struct ClientSocket *client, struct Cli
     for(i = 0; i < table->entrys; i++) {
         reply(textclient, user, table_lines[i]);
     }
-    if(!content_count)
+    if(!match_count)
         reply(textclient, user, "NS_TABLE_NONE");
     if(chanmatch) {
-        reply(textbot, user, "NS_MYACCESS_COUNT_MATCH", auth, total_count, owner_count, match_count, chanmatch);
+        reply(textclient, user, "NS_MYACCESS_COUNT_MATCH", auth, total_count, owner_count, match_count, chanmatch);
     } else {
-        reply(textbot, user, "NS_MYACCESS_COUNT", auth, total_count, owner_count);
+        reply(textclient, user, "NS_MYACCESS_COUNT", auth, total_count, owner_count);
     }
 }