1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

*** empty log message ***

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2553 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-03-10 14:55:46 +00:00 committed by cras
parent 418678bc95
commit ca234bdf5e
7 changed files with 47 additions and 7 deletions

View File

@ -50,6 +50,9 @@
# default foreground color (%N) - -1 is the "default terminal color"
default_color = "-1";
# print timestamp/servertag at the end of line, not at beginning
info_eol = "false";
# these characters are automatically replaced with specified color
# (dark grey by default)
replaces = { "[]=" = "%K$*%n"; };

View File

@ -549,6 +549,31 @@ char *format_add_linestart(const char *text, const char *linestart)
return ret;
}
char *format_add_lineend(const char *text, const char *linestart)
{
GString *str;
char *ret;
if (linestart == NULL)
return g_strdup(text);
if (strchr(text, '\n') == NULL)
return g_strconcat(text, linestart, NULL);
str = g_string_new(NULL);
while (*text != '\0') {
if (*text == '\n')
g_string_append(str, linestart);
g_string_append_c(str, *text);
text++;
}
g_string_append(str, linestart);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
#define LINE_START_IRSSI_LEVEL \
(MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE)

View File

@ -86,9 +86,10 @@ char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
TEXT_DEST_REC *dest, int formatnum,
char **args);
/* add `linestart' to start of each line in `text'. `text' may contain
/* add `linestart' to start/end of each line in `text'. `text' may contain
multiple lines separated with \n. */
char *format_add_linestart(const char *text, const char *linestart);
char *format_add_lineend(const char *text, const char *linestart);
/* return the "-!- " text at the start of the line */
char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);

View File

@ -683,7 +683,7 @@ static void cmd_bind(const char *data)
command_id = strchr(settings_get_str("cmdchars"), *id) != NULL;
if (command_id) {
/* using shortcut to command id */
keydata = g_strconcat(id, " ", keydata, NULL);
keydata = g_strconcat(id+1, " ", keydata, NULL);
id = "command";
}

View File

@ -158,13 +158,16 @@ void printformat_module_gui(const char *module, int formatnum, ...)
static void print_line(TEXT_DEST_REC *dest, const char *text)
{
THEME_REC *theme;
char *str, *tmp, *stripped;
g_return_if_fail(dest != NULL);
g_return_if_fail(text != NULL);
tmp = format_get_level_tag(window_get_theme(dest->window), dest);
str = format_add_linestart(text, tmp);
theme = window_get_theme(dest->window);
tmp = format_get_level_tag(theme, dest);
str = !theme->info_eol ? format_add_linestart(text, tmp) :
format_add_lineend(text, tmp);
g_free_not_null(tmp);
/* send both the formatted + stripped (for logging etc.) */
@ -408,6 +411,7 @@ static void msg_beep_check(TEXT_DEST_REC *dest)
static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
{
THEME_REC *theme;
char *str, *tmp;
g_return_if_fail(dest != NULL);
@ -421,9 +425,11 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
/* add timestamp/server tag here - if it's done in print_line()
it would be written to log files too */
tmp = format_get_line_start(window_get_theme(dest->window),
dest, time(NULL));
str = format_add_linestart(text, tmp);
theme = window_get_theme(dest->window);
tmp = format_get_line_start(theme, dest, time(NULL));
str = !theme->info_eol ? format_add_linestart(text, tmp) :
format_add_lineend(text, tmp);
g_free_not_null(tmp);
format_send_to_gui(dest, str);

View File

@ -844,6 +844,8 @@ static int theme_read(THEME_REC *theme, const char *path, const char *data)
theme->default_color =
config_get_int(config, NULL, "default_color", -1);
theme->info_eol = config_get_bool(config, NULL, "info_eol", FALSE);
/* FIXME: remove after 0.7.99 */
if (theme->default_color == 0 &&
config_get_int(config, NULL, "default_real_color", -1) != -1)

View File

@ -18,6 +18,9 @@ typedef struct {
int default_color; /* default color to use with text with default
background. default is -1 which means the
default color set by terminal */
unsigned int info_eol:1; /* show the timestamp/servertag at the
end of the line, not at beginning */
GHashTable *modules;
int replace_keys[256]; /* index to replace_values for each char */