mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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:
parent
4faf4d1303
commit
5da58d5849
@ -30,7 +30,8 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||||||
{ "line_start", "%B-%W!%B-%n ", 0 },
|
{ "line_start", "%B-%W!%B-%n ", 0 },
|
||||||
{ "line_start_irssi", "%B-%W!%B- %WIrssi:%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 } },
|
{ "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 } },
|
{ "talking_with", "You are now talking with %_$0%_", 1, { 0 } },
|
||||||
{ "refnum_too_low", "Window number must be greater than 1", 0 },
|
{ "refnum_too_low", "Window number must be greater than 1", 0 },
|
||||||
{ "windowlist_header", "Ref Name Active item Server Level", 0 },
|
{ "windowlist_header", "Ref Name Active item Server Level", 0 },
|
||||||
|
@ -8,6 +8,7 @@ enum {
|
|||||||
IRCTXT_LINE_START,
|
IRCTXT_LINE_START,
|
||||||
IRCTXT_LINE_START_IRSSI,
|
IRCTXT_LINE_START_IRSSI,
|
||||||
IRCTXT_TIMESTAMP,
|
IRCTXT_TIMESTAMP,
|
||||||
|
IRCTXT_SERVERTAG,
|
||||||
IRCTXT_DAYCHANGE,
|
IRCTXT_DAYCHANGE,
|
||||||
IRCTXT_TALKING_WITH,
|
IRCTXT_TALKING_WITH,
|
||||||
IRCTXT_REFNUM_TOO_LOW,
|
IRCTXT_REFNUM_TOO_LOW,
|
||||||
|
@ -645,6 +645,7 @@ static void newline(WINDOW_REC *window)
|
|||||||
static char *get_timestamp(TEXT_DEST_REC *dest)
|
static char *get_timestamp(TEXT_DEST_REC *dest)
|
||||||
{
|
{
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
|
char month[10];
|
||||||
time_t t;
|
time_t t;
|
||||||
int diff;
|
int diff;
|
||||||
|
|
||||||
@ -661,18 +662,23 @@ static char *get_timestamp(TEXT_DEST_REC *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
|
strftime(month, sizeof(month)-1, "%b", tm);
|
||||||
return output_format_text(dest, IRCTXT_TIMESTAMP,
|
return output_format_text(dest, IRCTXT_TIMESTAMP,
|
||||||
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
|
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 ||
|
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 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)
|
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);
|
newline(window);
|
||||||
|
|
||||||
timestamp = get_timestamp(&dest);
|
timestamp = get_timestamp(&dest);
|
||||||
servertag = get_server_tag(window, server);
|
servertag = get_server_tag(&dest);
|
||||||
str = g_strconcat(timestamp != NULL ? timestamp : "",
|
str = g_strconcat(timestamp != NULL ? timestamp : "",
|
||||||
servertag != NULL ? servertag : "",
|
servertag != NULL ? servertag : "",
|
||||||
text, NULL);
|
text, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user