added cmd_nicklist
[NeonServV5.git] / src / tools.c
index 71cd40d756b6858f272bb5d123cc60a8c8d4d821..2c047adaeaa0170d17c9f8ced0bcf23006e42342 100644 (file)
@@ -180,7 +180,7 @@ int table_set_bold(struct Table *table, int collum, int bold) {
 }
 
 char **table_end(struct Table *table) {
-    int row, col, tablewidth = 0, pos,i;
+    int row, col, tablewidth = 0, pos,i,j,k;
     if(!table->entrys) return NULL;
     for(col = 0; col < table->width; col++) {
         tablewidth += table->maxwidth[col]+1;
@@ -196,11 +196,23 @@ char **table_end(struct Table *table) {
             if(table->col_flags[col] & TABLE_FLAG_COL_BOLD)
                 table->table_lines[row][pos++] = '\002';
             i = 0;
+            j = 0;
             if(table->contents[row][col]) {
                 for(; i < strlen(table->contents[row][col]); i++) {
                     table->table_lines[row][pos++] = table->contents[row][col][i];
+                    if(table->contents[row][col][i] == '\002') j++;
+                    else if(table->contents[row][col][i] == '\003') {
+                        j++;
+                        for(k = 1; k < 2; k++) {
+                            if(isdigit(table->contents[row][col][i+k]))
+                                j++;
+                            else 
+                                break;
+                        }
+                    }
                 }
             }
+            i -= j;
             if(col < table->width-1) {
                 for(;i < table->maxwidth[col]; i++) {
                     table->table_lines[row][pos++] = ' ';