1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Added "servertag" format - it's displayed before the message if it

comes from a server different than the one active in window, or in all
empty windows if you're connected to multiple servers.

In "daychange" format you can use $3 to print the current month name.
Changed the default to "dd mon yyyy" style.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@397 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-30 19:49:12 +00:00 committed by cras
parent 4faf4d1303
commit 5da58d5849
3 changed files with 14 additions and 6 deletions

View File

@ -30,7 +30,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "line_start", "%B-%W!%B-%n ", 0 },
{ "line_start_irssi", "%B-%W!%B- %WIrssi:%n ", 0 },
{ "timestamp", "[$[-2.0]3:$[-2.0]4] ", 6, { 1, 1, 1, 1, 1, 1 } },
{ "daychange", "Day changed to $[-2.0]{0}-$[-2.0]1 $2", 3, { 1, 1, 1 } },
{ "servertag", "[$0] ", 1, { 0 } },
{ "daychange", "Day changed to $[-2.0]{0} $3 $2", 4, { 1, 1, 1, 0 } },
{ "talking_with", "You are now talking with %_$0%_", 1, { 0 } },
{ "refnum_too_low", "Window number must be greater than 1", 0 },
{ "windowlist_header", "Ref Name Active item Server Level", 0 },

View File

@ -8,6 +8,7 @@ enum {
IRCTXT_LINE_START,
IRCTXT_LINE_START_IRSSI,
IRCTXT_TIMESTAMP,
IRCTXT_SERVERTAG,
IRCTXT_DAYCHANGE,
IRCTXT_TALKING_WITH,
IRCTXT_REFNUM_TOO_LOW,

View File

@ -645,6 +645,7 @@ static void newline(WINDOW_REC *window)
static char *get_timestamp(TEXT_DEST_REC *dest)
{
struct tm *tm;
char month[10];
time_t t;
int diff;
@ -661,18 +662,23 @@ static char *get_timestamp(TEXT_DEST_REC *dest)
}
tm = localtime(&t);
strftime(month, sizeof(month)-1, "%b", tm);
return output_format_text(dest, IRCTXT_TIMESTAMP,
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
tm->tm_hour, tm->tm_min, tm->tm_sec, month);
}
static char *get_server_tag(WINDOW_REC *window, SERVER_REC *server)
static char *get_server_tag(TEXT_DEST_REC *dest)
{
SERVER_REC *server;
server = dest->server;
if (server == NULL || servers == NULL || servers->next == NULL ||
(window->active != NULL && window->active->server == server))
(dest->window->active != NULL && dest->window->active->server == server))
return NULL;
return g_strdup_printf("[%s] ", server->tag);
return output_format_text(dest, IRCTXT_SERVERTAG, server->tag);
}
static void sig_print_text(WINDOW_REC *window, SERVER_REC *server, const char *target, gpointer level, const char *text)
@ -695,7 +701,7 @@ static void sig_print_text(WINDOW_REC *window, SERVER_REC *server, const char *t
newline(window);
timestamp = get_timestamp(&dest);
servertag = get_server_tag(window, server);
servertag = get_server_tag(&dest);
str = g_strconcat(timestamp != NULL ? timestamp : "",
servertag != NULL ? servertag : "",
text, NULL);