fixed cmd_bots
authorpk910 <philipp@zoelle1.de>
Thu, 10 Nov 2011 01:50:29 +0000 (02:50 +0100)
committerpk910 <philipp@zoelle1.de>
Thu, 10 Nov 2011 01:54:44 +0000 (02:54 +0100)
src/cmd_global_bots.c

index d2916c823d9c576c64519d50a8a9107bb7da44ab..93a1d1943851b375772e35c518475b0db18a3c4e 100644 (file)
@@ -28,7 +28,7 @@ CMD_BIND(global_cmd_bots) {
     printf_mysql_query("SELECT `active`, `nick`, `server`, `port`, `pass`, `botclass`, `textbot`, `queue`, `defaulttrigger`, `max_channels`, `register_priority`, `id` FROM `bots`");
     res = mysql_use();
     table = table_init(6, mysql_num_rows(res) + 1, 0);
-    char *content[5];
+    char *content[6];
     content[0] = get_language_string(user, "NS_BOTS_NICK");
     content[1] = get_language_string(user, "NS_BOTS_SERVER");
     content[2] = get_language_string(user, "NS_BOTS_CLASS");
@@ -42,26 +42,28 @@ CMD_BIND(global_cmd_bots) {
     int flagspos;
     char botchans[20];
     while ((row = mysql_fetch_row(res)) != NULL) {
-        sprintf(botnick, (strcmp(row[0], "0") ? "%s" : "\00315%s\003"), row[1]);
-        contents[0] = botnick;
+        sprintf(botnick, (strcmp(row[0], "0") ? "%s" : "!%s"), row[1]);
+        content[0] = botnick;
         sprintf(botserver, (strcmp(row[4], "") ? "%s:%s:*" : "%s:%s"), row[2], row[3]);
-        contents[1] = botserver;
-        contents[2] = resolve_botid(atoi(row[5]));
+        content[1] = botserver;
+        content[2] = (char *) resolve_botid(atoi(row[5]));
         flagspos = 0;
         if(!strcmp(row[6], "1"))
             botflags[flagspos++] = 't';
         if(!strcmp(row[7], "1"))
             botflags[flagspos++] = 'q';
         botflags[flagspos] = '\0';
-        contents[3] = botflags;
+        content[3] = botflags;
         printf_mysql_query("SELECT COUNT(*) FROM `bot_channels` WHERE `botid` = '%s'", row[11]);
         res2 = mysql_use();
         row2 = mysql_fetch_row(res2);
         sprintf(botchans, "%s/%s", row2[0], row[9]);
-        contents[4] = botchans;
-        contents[5] = row[8];
+        content[4] = botchans;
+        content[5] = row[8];
+        table_add(table, content);
     }
     char **table_lines = table_end(table);
+    int i;
     for(i = 0; i < table->entrys; i++) {
         reply(getTextBot(), user, table_lines[i]);
     }