1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/SET log_theme - you can now write to log files with different theme

than to screen.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@795 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-28 03:01:11 +00:00 committed by cras
parent 80dd793c60
commit 8653c6ea36
5 changed files with 172 additions and 72 deletions

View File

@ -234,7 +234,7 @@ LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
return NULL; return NULL;
} }
static void log_file_write(SERVER_REC *server, const char *item, int level, void log_file_write(SERVER_REC *server, const char *item, int level,
const char *str, int no_fallbacks) const char *str, int no_fallbacks)
{ {
GSList *tmp, *fallbacks; GSList *tmp, *fallbacks;
@ -418,30 +418,6 @@ void log_close(LOG_REC *log)
log_destroy(log); log_destroy(log);
} }
static void sig_printtext_stripped(void *window, SERVER_REC *server,
const char *item, gpointer levelp,
const char *str)
{
char **items, **tmp;
int level;
g_return_if_fail(str != NULL);
level = GPOINTER_TO_INT(levelp);
if (logs == NULL || level == MSGLEVEL_NEVER)
return;
if (item == NULL)
log_file_write(server, NULL, level, str, FALSE);
else {
/* there can be multiple items separated with comma */
items = g_strsplit(item, ",", -1);
for (tmp = items; *tmp != NULL; tmp++)
log_file_write(server, *tmp, level, str, FALSE);
g_strfreev(items);
}
}
static int sig_rotate_check(void) static int sig_rotate_check(void)
{ {
static int last_hour = -1; static int last_hour = -1;
@ -559,7 +535,6 @@ void log_init(void)
log_read_config(); log_read_config();
signal_add("setup changed", (SIGNAL_FUNC) read_settings); signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("setup reread", (SIGNAL_FUNC) log_read_config); signal_add("setup reread", (SIGNAL_FUNC) log_read_config);
signal_add("print text stripped", (SIGNAL_FUNC) sig_printtext_stripped);
} }
void log_deinit(void) void log_deinit(void)
@ -571,5 +546,4 @@ void log_deinit(void)
signal_remove("setup changed", (SIGNAL_FUNC) read_settings); signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
signal_remove("setup reread", (SIGNAL_FUNC) log_read_config); signal_remove("setup reread", (SIGNAL_FUNC) log_read_config);
signal_remove("print text stripped", (SIGNAL_FUNC) sig_printtext_stripped);
} }

View File

@ -45,6 +45,8 @@ void log_item_destroy(LOG_REC *log, LOG_ITEM_REC *item);
LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item, LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
SERVER_REC *server); SERVER_REC *server);
void log_file_write(SERVER_REC *server, const char *item, int level,
const char *str, int no_fallbacks);
void log_write_rec(LOG_REC *log, const char *str); void log_write_rec(LOG_REC *log, const char *str);
int log_start_logging(LOG_REC *log); int log_start_logging(LOG_REC *log);

View File

@ -31,6 +31,7 @@
#include "windows.h" #include "windows.h"
#include "window-items.h" #include "window-items.h"
#include "themes.h"
/* close autologs after 5 minutes of inactivity */ /* close autologs after 5 minutes of inactivity */
#define AUTOLOG_INACTIVITY_CLOSE (60*5) #define AUTOLOG_INACTIVITY_CLOSE (60*5)
@ -41,6 +42,10 @@ static int autolog_level;
static int autoremove_tag; static int autoremove_tag;
static const char *autolog_path; static const char *autolog_path;
static THEME_REC *log_theme;
static int skip_next_printtext;
static const char *log_theme_name;
static void log_add_targets(LOG_REC *log, const char *targets) static void log_add_targets(LOG_REC *log, const char *targets)
{ {
char **tmp, **items; char **tmp, **items;
@ -362,16 +367,13 @@ static void autolog_log(void *server, const char *target)
g_free(fname); g_free(fname);
} }
static void sig_printtext_stripped(WINDOW_REC *window, void *server, static void log_line(WINDOW_REC *window, void *server, const char *target,
const char *target, gpointer levelp, int level, const char *text)
const char *text)
{ {
char windownum[MAX_INT_STRLEN]; char windownum[MAX_INT_STRLEN];
char **targets, **tmp; char **targets, **tmp;
LOG_REC *log; LOG_REC *log;
int level;
level = GPOINTER_TO_INT(levelp);
if (level == MSGLEVEL_NEVER) return; if (level == MSGLEVEL_NEVER) return;
/* let autolog create the log records */ /* let autolog create the log records */
@ -388,6 +390,84 @@ static void sig_printtext_stripped(WINDOW_REC *window, void *server,
ltoa(windownum, window->refnum); ltoa(windownum, window->refnum);
log = logs_find_item(LOG_ITEM_WINDOW_REFNUM, windownum, NULL, NULL); log = logs_find_item(LOG_ITEM_WINDOW_REFNUM, windownum, NULL, NULL);
if (log != NULL) log_write_rec(log, text); if (log != NULL) log_write_rec(log, text);
/* save line to log files */
if (logs == NULL)
return;
if (target == NULL)
log_file_write(server, NULL, level, text, FALSE);
else {
/* there can be multiple items separated with comma */
targets = g_strsplit(target, ",", -1);
for (tmp = targets; *tmp != NULL; tmp++)
log_file_write(server, *tmp, level, text, FALSE);
g_strfreev(targets);
}
}
static void sig_printtext_stripped(WINDOW_REC *window, void *server,
const char *target, gpointer levelp,
const char *text)
{
if (skip_next_printtext) {
skip_next_printtext = FALSE;
return;
}
log_line(window, server, target, GPOINTER_TO_INT(levelp), text);
}
static void sig_print_format(THEME_REC *theme, const char *module,
TEXT_DEST_REC *dest, gpointer formatnump,
va_list va)
{
MODULE_THEME_REC *module_theme;
FORMAT_REC *formats;
int formatnum;
char *str, *str2, *stripped, *tmp;
if (log_theme == NULL) {
/* theme isn't loaded for some reason (/reload destroys it),
reload it. */
log_theme = theme_load(log_theme_name);
if (log_theme == NULL) return;
}
if (theme == log_theme)
return;
/* log uses a different theme .. very ugly kludge follows.. : */
formatnum = GPOINTER_TO_INT(formatnump);
module_theme = g_hash_table_lookup(log_theme->modules, module);
formats = g_hash_table_lookup(default_formats, module);
str = output_format_text_args(dest, &formats[formatnum],
module_theme->expanded_formats[formatnum], va);
if (*str != '\0') {
/* get_line_start_text() gets the line start with
current theme. */
THEME_REC *old_theme = current_theme;
current_theme = log_theme;
tmp = get_line_start_text(dest);
current_theme = old_theme;
/* line start + text */
str2 = tmp == NULL ? str :
g_strconcat(tmp, str, NULL);
if (str2 != str) g_free(str);
str = str2;
g_free_not_null(tmp);
/* strip colors from text, log it. */
stripped = strip_codes(str);
skip_next_printtext = TRUE;
log_line(dest->window, dest->server, dest->target,
dest->level, stripped);
g_free(stripped);
}
g_free(str);
} }
static int sig_autoremove(void) static int sig_autoremove(void)
@ -458,8 +538,15 @@ static void sig_awaylog_show(LOG_REC *log, gpointer pmsgs, gpointer pfilepos)
} }
} }
static void sig_theme_destroyed(THEME_REC *theme)
{
if (theme == log_theme)
log_theme = NULL;
}
static void read_settings(void) static void read_settings(void)
{ {
const char *old_log_theme = log_theme_name;
int old_autolog = autolog_level; int old_autolog = autolog_level;
autolog_path = settings_get_str("autolog_path"); autolog_path = settings_get_str("autolog_path");
@ -468,15 +555,30 @@ static void read_settings(void)
if (old_autolog && !autolog_level) if (old_autolog && !autolog_level)
autologs_close_all(); autologs_close_all();
/* write to log files with different theme? */
log_theme_name = settings_get_str("log_theme");
if (old_log_theme == NULL && *log_theme_name != '\0') {
/* theme set */
signal_add("print format", (SIGNAL_FUNC) sig_print_format);
} else if (old_log_theme != NULL && *log_theme_name == '\0') {
/* theme unset */
signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
}
log_theme = *log_theme_name == '\0' ? NULL :
theme_load(log_theme_name);
} }
void fe_log_init(void) void fe_log_init(void)
{ {
autoremove_tag = g_timeout_add(60000, (GSourceFunc) sig_autoremove, NULL); autoremove_tag = g_timeout_add(60000, (GSourceFunc) sig_autoremove, NULL);
skip_next_printtext = FALSE;
settings_add_str("log", "autolog_path", "~/irclogs/$tag/$0.log"); settings_add_str("log", "autolog_path", "~/irclogs/$tag/$0.log");
settings_add_str("log", "autolog_level", "all -crap -clientcrap"); settings_add_str("log", "autolog_level", "all -crap -clientcrap");
settings_add_bool("log", "autolog", FALSE); settings_add_bool("log", "autolog", FALSE);
settings_add_str("log", "log_theme", "");
autolog_level = 0; autolog_level = 0;
read_settings(); read_settings();
@ -494,6 +596,7 @@ void fe_log_init(void)
signal_add("log locked", (SIGNAL_FUNC) sig_log_locked); signal_add("log locked", (SIGNAL_FUNC) sig_log_locked);
signal_add("log create failed", (SIGNAL_FUNC) sig_log_create_failed); signal_add("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
signal_add("awaylog show", (SIGNAL_FUNC) sig_awaylog_show); signal_add("awaylog show", (SIGNAL_FUNC) sig_awaylog_show);
signal_add("theme destroyed", (SIGNAL_FUNC) sig_theme_destroyed);
signal_add("setup changed", (SIGNAL_FUNC) read_settings); signal_add("setup changed", (SIGNAL_FUNC) read_settings);
command_set_options("log open", "noopen autoopen -targets window"); command_set_options("log open", "noopen autoopen -targets window");
@ -502,6 +605,8 @@ void fe_log_init(void)
void fe_log_deinit(void) void fe_log_deinit(void)
{ {
g_source_remove(autoremove_tag); g_source_remove(autoremove_tag);
if (log_theme_name != NULL && *log_theme_name != '\0')
signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
command_unbind("log", (SIGNAL_FUNC) cmd_log); command_unbind("log", (SIGNAL_FUNC) cmd_log);
command_unbind("log open", (SIGNAL_FUNC) cmd_log_open); command_unbind("log open", (SIGNAL_FUNC) cmd_log_open);
@ -516,5 +621,6 @@ void fe_log_deinit(void)
signal_remove("log locked", (SIGNAL_FUNC) sig_log_locked); signal_remove("log locked", (SIGNAL_FUNC) sig_log_locked);
signal_remove("log create failed", (SIGNAL_FUNC) sig_log_create_failed); signal_remove("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
signal_remove("awaylog show", (SIGNAL_FUNC) sig_awaylog_show); signal_remove("awaylog show", (SIGNAL_FUNC) sig_awaylog_show);
signal_remove("theme destroyed", (SIGNAL_FUNC) sig_theme_destroyed);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings); signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
} }

View File

@ -33,13 +33,6 @@
#include "themes.h" #include "themes.h"
#include "windows.h" #include "windows.h"
typedef struct {
WINDOW_REC *window;
void *server;
const char *channel;
int level;
} TEXT_DEST_REC;
static int beep_msg_level, beep_when_away; static int beep_msg_level, beep_when_away;
static int timestamps, msgs_timestamps, hide_text_style; static int timestamps, msgs_timestamps, hide_text_style;
static int timestamp_timeout; static int timestamp_timeout;
@ -48,6 +41,7 @@ static int signal_gui_print_text;
static int signal_print_text_stripped; static int signal_print_text_stripped;
static int signal_print_text; static int signal_print_text;
static int signal_print_text_finished; static int signal_print_text_finished;
static int signal_print_format;
static void print_string(TEXT_DEST_REC *dest, const char *text); static void print_string(TEXT_DEST_REC *dest, const char *text);
@ -338,17 +332,17 @@ static void read_arglist(va_list va, FORMAT_REC *format,
} }
static void create_dest_rec(TEXT_DEST_REC *dest, static void create_dest_rec(TEXT_DEST_REC *dest,
void *server, const char *channel, void *server, const char *target,
int level, WINDOW_REC *window) int level, WINDOW_REC *window)
{ {
dest->server = server; dest->server = server;
dest->channel = channel; dest->target = target;
dest->level = level; dest->level = level;
dest->window = window != NULL ? window : dest->window = window != NULL ? window :
window_find_closest(server, channel, level); window_find_closest(server, target, level);
} }
static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format, char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
const char *text, va_list va) const char *text, va_list va)
{ {
GString *out; GString *out;
@ -413,7 +407,7 @@ static char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
} }
char *output_format_get_text(const char *module, WINDOW_REC *window, char *output_format_get_text(const char *module, WINDOW_REC *window,
void *server, const char *channel, void *server, const char *target,
int formatnum, ...) int formatnum, ...)
{ {
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
@ -423,7 +417,7 @@ char *output_format_get_text(const char *module, WINDOW_REC *window,
va_list va; va_list va;
char *ret; char *ret;
create_dest_rec(&dest, server, channel, 0, window); create_dest_rec(&dest, server, target, 0, window);
theme = dest.window->theme == NULL ? current_theme : theme = dest.window->theme == NULL ? current_theme :
dest.window->theme; dest.window->theme;
@ -458,7 +452,7 @@ static char *output_format_text(TEXT_DEST_REC *dest, int formatnum, ...)
} }
void printformat_module_args(const char *module, void *server, void printformat_module_args(const char *module, void *server,
const char *channel, int level, const char *target, int level,
int formatnum, va_list va) int formatnum, va_list va)
{ {
THEME_REC *theme; THEME_REC *theme;
@ -467,10 +461,13 @@ void printformat_module_args(const char *module, void *server,
FORMAT_REC *formats; FORMAT_REC *formats;
char *str; char *str;
create_dest_rec(&dest, server, channel, level, NULL); create_dest_rec(&dest, server, target, level, NULL);
theme = dest.window->theme == NULL ? current_theme : theme = dest.window->theme == NULL ? current_theme :
dest.window->theme; dest.window->theme;
signal_emit_id(signal_print_format, 5, theme, module,
&dest, GINT_TO_POINTER(formatnum), va);
module_theme = g_hash_table_lookup(theme->modules, module); module_theme = g_hash_table_lookup(theme->modules, module);
formats = g_hash_table_lookup(default_formats, module); formats = g_hash_table_lookup(default_formats, module);
@ -480,16 +477,17 @@ void printformat_module_args(const char *module, void *server,
g_free(str); g_free(str);
} }
void printformat_module(const char *module, void *server, const char *channel, int level, int formatnum, ...) void printformat_module(const char *module, void *server, const char *target, int level, int formatnum, ...)
{ {
va_list va; va_list va;
va_start(va, formatnum); va_start(va, formatnum);
printformat_module_args(module, server, channel, level, formatnum, va); printformat_module_args(module, server, target, level, formatnum, va);
va_end(va); va_end(va);
} }
void printformat_module_window_args(const char *module, WINDOW_REC *window, int level, int formatnum, va_list va) void printformat_module_window_args(const char *module, WINDOW_REC *window,
int level, int formatnum, va_list va)
{ {
THEME_REC *theme; THEME_REC *theme;
MODULE_THEME_REC *module_theme; MODULE_THEME_REC *module_theme;
@ -500,16 +498,21 @@ void printformat_module_window_args(const char *module, WINDOW_REC *window, int
create_dest_rec(&dest, NULL, NULL, level, window); create_dest_rec(&dest, NULL, NULL, level, window);
theme = window->theme == NULL ? current_theme : theme = window->theme == NULL ? current_theme :
window->theme; window->theme;
module_theme = g_hash_table_lookup(theme->modules, module);
signal_emit_id(signal_print_format, 5, theme, module,
&dest, GINT_TO_POINTER(formatnum), va);
module_theme = g_hash_table_lookup(theme->modules, module);
formats = g_hash_table_lookup(default_formats, module); formats = g_hash_table_lookup(default_formats, module);
str = output_format_text_args(&dest, &formats[formatnum], str = output_format_text_args(&dest, &formats[formatnum],
module_theme->expanded_formats[formatnum], va); module_theme->expanded_formats[formatnum], va);
if (*str != '\0') print_string(&dest, str); if (*str != '\0') print_string(&dest, str);
g_free(str); g_free(str);
} }
void printformat_module_window(const char *module, WINDOW_REC *window, int level, int formatnum, ...) void printformat_module_window(const char *module, WINDOW_REC *window,
int level, int formatnum, ...)
{ {
va_list va; va_list va;
@ -527,7 +530,7 @@ void printformat_module_window(const char *module, WINDOW_REC *window, int level
MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS) MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS)
/* return the "-!- " text at the start of the line */ /* return the "-!- " text at the start of the line */
static char *get_line_start_text(TEXT_DEST_REC *dest) char *get_line_start_text(TEXT_DEST_REC *dest)
{ {
if (dest->level & LINE_START_IRSSI_LEVEL) if (dest->level & LINE_START_IRSSI_LEVEL)
return output_format_text(dest, IRCTXT_LINE_START_IRSSI); return output_format_text(dest, IRCTXT_LINE_START_IRSSI);
@ -555,10 +558,10 @@ static void print_string(TEXT_DEST_REC *dest, const char *text)
/* send the plain text version for logging etc.. */ /* send the plain text version for logging etc.. */
tmp = strip_codes(str); tmp = strip_codes(str);
signal_emit_id(signal_print_text_stripped, 5, dest->window, dest->server, dest->channel, levelp, tmp); signal_emit_id(signal_print_text_stripped, 5, dest->window, dest->server, dest->target, levelp, tmp);
g_free(tmp); g_free(tmp);
signal_emit_id(signal_print_text, 5, dest->window, dest->server, dest->channel, levelp, str); signal_emit_id(signal_print_text, 5, dest->window, dest->server, dest->target, levelp, str);
if (str != text) g_free(str); if (str != text) g_free(str);
} }
@ -641,8 +644,8 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str, va_list va
return ret; return ret;
} }
/* Write text to channel - convert color codes */ /* Write text to target - convert color codes */
void printtext(void *server, const char *channel, int level, const char *text, ...) void printtext(void *server, const char *target, int level, const char *text, ...)
{ {
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
char *str; char *str;
@ -650,7 +653,7 @@ void printtext(void *server, const char *channel, int level, const char *text, .
g_return_if_fail(text != NULL); g_return_if_fail(text != NULL);
create_dest_rec(&dest, server, channel, level, NULL); create_dest_rec(&dest, server, target, level, NULL);
va_start(va, text); va_start(va, text);
str = printtext_get_args(&dest, text, va); str = printtext_get_args(&dest, text, va);
@ -929,7 +932,7 @@ static void sig_print_text(WINDOW_REC *window, SERVER_REC *server,
signal_emit_id(signal_print_text_finished, 1, window); signal_emit_id(signal_print_text_finished, 1, window);
} }
void printtext_multiline(void *server, const char *channel, int level, const char *format, const char *text) void printtext_multiline(void *server, const char *target, int level, const char *format, const char *text)
{ {
char **lines, **tmp; char **lines, **tmp;
@ -974,6 +977,7 @@ void printtext_init(void)
signal_print_text_stripped = signal_get_uniq_id("print text stripped"); signal_print_text_stripped = signal_get_uniq_id("print text stripped");
signal_print_text = signal_get_uniq_id("print text"); signal_print_text = signal_get_uniq_id("print text");
signal_print_text_finished = signal_get_uniq_id("print text finished"); signal_print_text_finished = signal_get_uniq_id("print text finished");
signal_print_format = signal_get_uniq_id("print format");
read_settings(); read_settings();
signal_add("print text", (SIGNAL_FUNC) sig_print_text); signal_add("print text", (SIGNAL_FUNC) sig_print_text);

View File

@ -27,18 +27,18 @@ typedef struct {
#define PRINTFLAG_INDENT 0x40 #define PRINTFLAG_INDENT 0x40
char *output_format_get_text(const char *module, WINDOW_REC *window, char *output_format_get_text(const char *module, WINDOW_REC *window,
void *server, const char *channel, void *server, const char *target,
int formatnum, ...); int formatnum, ...);
void printformat_module(const char *module, void *server, const char *channel, int level, int formatnum, ...); void printformat_module(const char *module, void *server, const char *target, int level, int formatnum, ...);
void printformat_module_window(const char *module, WINDOW_REC *window, int level, int formatnum, ...); void printformat_module_window(const char *module, WINDOW_REC *window, int level, int formatnum, ...);
void printformat_module_args(const char *module, void *server, const char *channel, int level, int formatnum, va_list va); void printformat_module_args(const char *module, void *server, const char *target, int level, int formatnum, va_list va);
void printformat_module_window_args(const char *module, WINDOW_REC *window, int level, int formatnum, va_list va); void printformat_module_window_args(const char *module, WINDOW_REC *window, int level, int formatnum, va_list va);
void printtext(void *server, const char *channel, int level, const char *text, ...); void printtext(void *server, const char *target, int level, const char *text, ...);
void printtext_window(WINDOW_REC *window, int level, const char *text, ...); void printtext_window(WINDOW_REC *window, int level, const char *text, ...);
void printtext_multiline(void *server, const char *channel, int level, const char *format, const char *text); void printtext_multiline(void *server, const char *target, int level, const char *format, const char *text);
void printbeep(void); void printbeep(void);
/* strip all color (etc.) codes from `input'. returns newly allocated string. */ /* strip all color (etc.) codes from `input'. returns newly allocated string. */
@ -55,14 +55,14 @@ void printtext_deinit(void);
*/ */
#if defined (__GNUC__) && !defined (__STRICT_ANSI__) #if defined (__GNUC__) && !defined (__STRICT_ANSI__)
/* GCC */ /* GCC */
# define printformat(server, channel, level, formatnum...) \ # define printformat(server, target, level, formatnum...) \
printformat_module(MODULE_NAME, server, channel, level, ##formatnum) printformat_module(MODULE_NAME, server, target, level, ##formatnum)
# define printformat_window(window, level, formatnum...) \ # define printformat_window(window, level, formatnum...) \
printformat_module_window(MODULE_NAME, window, level, ##formatnum) printformat_module_window(MODULE_NAME, window, level, ##formatnum)
#elif defined (_ISOC99_SOURCE) #elif defined (_ISOC99_SOURCE)
/* C99 */ /* C99 */
# define printformat(server, channel, level, formatnum, ...) \ # define printformat(server, target, level, formatnum, ...) \
printformat_module(MODULE_NAME, server, channel, level, formatnum, __VA_ARGS__) printformat_module(MODULE_NAME, server, target, level, formatnum, __VA_ARGS__)
# define printformat_window(window, level, formatnum, ...) \ # define printformat_window(window, level, formatnum, ...) \
printformat_module_window(MODULE_NAME, window, level, formatnum, __VA_ARGS__) printformat_module_window(MODULE_NAME, window, level, formatnum, __VA_ARGS__)
#else #else
@ -71,12 +71,12 @@ static
#ifdef G_CAN_INLINE #ifdef G_CAN_INLINE
inline inline
#endif #endif
void printformat(void *server, const char *channel, int level, int formatnum, ...) void printformat(void *server, const char *target, int level, int formatnum, ...)
{ {
va_list va; va_list va;
va_start(va, formatnum); va_start(va, formatnum);
printformat_module_args(MODULE_NAME, server, channel, level, formatnum, va); printformat_module_args(MODULE_NAME, server, target, level, formatnum, va);
va_end(va); va_end(va);
} }
@ -94,4 +94,18 @@ void printformat_window(WINDOW_REC *window, int level, int formatnum, ...)
} }
#endif #endif
/* semi-private functions.. */
typedef struct {
WINDOW_REC *window;
void *server;
const char *target;
int level;
} TEXT_DEST_REC;
char *output_format_text_args(TEXT_DEST_REC *dest, FORMAT_REC *format,
const char *text, va_list va);
/* return the "-!- " text at the start of the line */
char *get_line_start_text(TEXT_DEST_REC *dest);
#endif #endif