X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/e1443247659571abb0df8836d770a0bcf7272a75..ff3b058ac51e9caf5cf1fd310b8a401a97a85582:/src/helpfile.c?ds=sidebyside diff --git a/src/helpfile.c b/src/helpfile.c index 907449c..144a7bc 100644 --- a/src/helpfile.c +++ b/src/helpfile.c @@ -5,7 +5,7 @@ * * x3 is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -206,7 +206,7 @@ static struct language *language_read(const char *name) /* Read all the translations from the directory. */ while ((dirent = readdir(dir))) { snprintf(filename, sizeof(filename), "languages/%s/%s", name, dirent->d_name); - if (!strcmp(dirent->d_name,"parent")) { + if (!strcmp(dirent->d_name, "parent")) { continue; } else if (!strcmp(dirent->d_name, "strings.db")) { dict = parse_database(filename); @@ -236,6 +236,9 @@ static void language_read_list(void) if (dirent->d_name[0] == '.') continue; snprintf(namebuf, sizeof(namebuf), "languages/%s", dirent->d_name); + if (!strcmp(dirent->d_name, "strings.db")) { + continue; + } if (stat(namebuf, &sbuf) < 0) { log_module(MAIN_LOG, LOG_INFO, "Skipping language entry '%s' (unable to stat).", dirent->d_name); continue; @@ -244,6 +247,7 @@ static void language_read_list(void) log_module(MAIN_LOG, LOG_INFO, "Skipping language entry '%s' (not directory).", dirent->d_name); continue; } + if (!dict_find(languages, dirent->d_name, NULL)) language_alloc(dirent->d_name); } closedir(dir); @@ -276,7 +280,7 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu char line[MAX_LINE_SIZE+1]; struct handle_info *hi; char *sepstr = NULL; - int sepsize = 0; + unsigned int sepsize = 0; if (IsChannelName(to) || *to == '$') { message_dest = NULL; @@ -308,10 +312,18 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu if (irc_send) {} /* use that function */ - else if (hi) + else if(IsChannelName(to)) { + irc_send = irc_privmsg; + } + else if (message_dest->no_notice) { + irc_send = irc_privmsg; + } + else if (hi) { irc_send = HANDLE_FLAGGED(hi, USE_PRIVMSG) ? irc_privmsg : irc_notice; - else - irc_send = IsChannelName(to) ? irc_privmsg : irc_notice; + } + else { + irc_send = irc_notice; + } /* Limit size to how much we can show at once */ if (size > sizeof(line)) @@ -363,23 +375,31 @@ table_send(struct userNode *from, const char *to, unsigned int size, irc_send_fu line[pos++] = ' '; } line[pos] = 0; - sepsize = strlen_vis(line); - sepstr = malloc(sepsize + 1); - memset(sepstr, '-', sepsize); - sepstr[sepsize] = 0; - if(hi && hi->userlist_style != HI_STYLE_CLEAN) + + /* Dont show ---- bars in 'clean' style. */ + if(!(hi && hi->userlist_style == HI_STYLE_CLEAN)) { + //sepsize = strlen_vis(line); + sepsize = tot_width * nreps; + sepstr = malloc(sepsize + 1); + memset(sepstr, '-', sepsize); + sepstr[sepsize] = 0; irc_send(from, to, sepstr); /* ----------------- */ - irc_send(from, to, line); /* alpha beta roe */ - if(hi && hi->userlist_style != HI_STYLE_CLEAN) + } + irc_send(from, to, line); /* alpha beta roe */ + if(!(hi && hi->userlist_style == HI_STYLE_CLEAN)) irc_send(from, to, sepstr); /* ----------------- */ ii = 1; } /* Send the table. */ for (jj=0, pos=0, reps=0; ii