logfile should be initialised from LOGFILE_VAR if that is set.
We can also rearrange things to remove the need for the add_ext variable, hopefully also making the logic a bit more clear. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@423 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -3426,7 +3426,6 @@ Window *window_list (Window *window, char **args, char *usage)
|
|||||||
*/
|
*/
|
||||||
static Window *window_log (Window *window, char **args, char *usage)
|
static Window *window_log (Window *window, char **args, char *usage)
|
||||||
{
|
{
|
||||||
int add_ext = 1;
|
|
||||||
char logfile[MAXPATHLEN];
|
char logfile[MAXPATHLEN];
|
||||||
|
|
||||||
if (get_boolean("LOG", args, &window->log))
|
if (get_boolean("LOG", args, &window->log))
|
||||||
@@ -3434,24 +3433,24 @@ static Window *window_log (Window *window, char **args, char *usage)
|
|||||||
|
|
||||||
if (window->logfile)
|
if (window->logfile)
|
||||||
{
|
{
|
||||||
add_ext = 0;
|
|
||||||
strlcpy(logfile, window->logfile, sizeof logfile);
|
strlcpy(logfile, window->logfile, sizeof logfile);
|
||||||
}
|
}
|
||||||
else if (!get_string_var(LOGFILE_VAR))
|
|
||||||
*logfile = 0;
|
|
||||||
|
|
||||||
if (add_ext)
|
|
||||||
{
|
|
||||||
strlcat(logfile, ".", sizeof logfile);
|
|
||||||
if (window->current_channel)
|
|
||||||
strlcat(logfile, window->current_channel, sizeof logfile);
|
|
||||||
else if (window->query_nick)
|
|
||||||
strlcat(logfile, window->query_nick, sizeof logfile);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strlcat(logfile, "Window_", sizeof logfile);
|
char *logfile_base = get_string_var(LOGFILE_VAR);
|
||||||
strlcat(logfile, ltoa(window->refnum), sizeof logfile);
|
|
||||||
}
|
if (!logfile_base)
|
||||||
|
logfile_base = empty_string;
|
||||||
|
|
||||||
|
if (window->current_channel)
|
||||||
|
snprintf(logfile, sizeof logfile, "%s.%s", logfile_base,
|
||||||
|
window->current_channel);
|
||||||
|
else if (window->query_nick)
|
||||||
|
snprintf(logfile, sizeof logfile, "%s.%s", logfile_base,
|
||||||
|
window->query_nick);
|
||||||
|
else
|
||||||
|
snprintf(logfile, sizeof logfile, "%s.Window_%u", logfile_base,
|
||||||
|
window->refnum);
|
||||||
}
|
}
|
||||||
strip_chars(logfile, "|\\:", '-');
|
strip_chars(logfile, "|\\:", '-');
|
||||||
do_log(window->log, logfile, &window->log_fp);
|
do_log(window->log, logfile, &window->log_fp);
|
||||||
|
|||||||
Reference in New Issue
Block a user