X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/a32da4c70ca85b879f8162469ae37ffeca500b99..de9510bcaba3fc0377e09259f8b49921c421d269:/src/helpfile.c diff --git a/src/helpfile.c b/src/helpfile.c index d214fe3..978a3af 100644 --- a/src/helpfile.c +++ b/src/helpfile.c @@ -1,7 +1,7 @@ /* helpfile.c - Help file loading and display * Copyright 2000-2004 srvx Development Team * - * This file is part of srvx. + * This file is part of x3. * * srvx is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -261,11 +261,22 @@ const char *language_find_message(struct language *lang, const char *msgid) { return NULL; } +int strlen_vis(char *str) +{ + int count; + for(count=0;*str;str++) + if(!iscntrl(*str)) + count++; + return count; +} + void table_send(struct userNode *from, const char *to, unsigned int size, irc_send_func irc_send, struct helpfile_table table) { unsigned int ii, jj, len, nreps, reps, tot_width, pos, spaces, *max_width; char line[MAX_LINE_SIZE+1]; struct handle_info *hi; + char *sepstr = NULL; + int sepsize = 0; if (IsChannelName(to) || *to == '$') { message_dest = NULL; @@ -334,12 +345,14 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu for (pos=ii=0; ii<((table.flags & TABLE_REPEAT_HEADERS)?nreps:1); ii++) { for (jj=0; 1; ) { len = strlen(table.contents[0][jj]); + //line[pos++] = '\02'; /* bold header */ spaces = max_width[jj] - len; if (table.flags & TABLE_PAD_LEFT) while (spaces--) line[pos++] = ' '; memcpy(line+pos, table.contents[0][jj], len); pos += len; + //line[pos++] = '\02'; /* end bold header */ if (++jj == table.width) break; if (!(table.flags & TABLE_PAD_LEFT)) @@ -349,7 +362,13 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu } } line[pos] = 0; - irc_send(from, to, line); + sepsize = strlen_vis(line); + sepstr = malloc(sepsize + 1); + memset(sepstr, '-', sepsize); + sepstr[sepsize] = 0; + irc_send(from, to, sepstr); /* ----------------- */ + irc_send(from, to, line); /* alpha beta roe */ + irc_send(from, to, sepstr); /* ----------------- */ ii = 1; } /* Send the table. */ @@ -376,6 +395,18 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu line[pos++] = ' '; } } + if (!(table.flags & TABLE_NO_HEADERS)) { + /* Send end bar & free its memory */ + if(sepsize > 5) + { + sepstr[sepsize/2-1] = 'E'; + sepstr[sepsize/2] = 'n'; + sepstr[sepsize/2+1]= 'd'; + } + irc_send(from, to, sepstr); + free(sepstr); + } + if (!(table.flags & TABLE_NO_FREE)) { /* Deallocate table memory (but not the string memory). */ for (ii=0; ii