From 9e3d62764f856779b78483ec55c1414bbd251a48 Mon Sep 17 00:00:00 2001 From: nohar Date: Fri, 12 Jan 2007 18:49:14 +0000 Subject: [PATCH] backlog_no_timestamp option implemented --- bip.conf.1 | 3 +++ configure | 2 +- configure.in | 2 +- samples/bip.conf | 1 + src/bip.c | 4 ++++ src/conf.y | 5 ++++- src/lex.l | 1 + src/log.c | 13 ++++++++----- 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/bip.conf.1 b/bip.conf.1 index 75f419a..ca8a802 100644 --- a/bip.conf.1 +++ b/bip.conf.1 @@ -81,6 +81,9 @@ if there are more. For example if Coyote told you 12 lines and then RoadRunner 6, you'll only have a replay of the 6 RoadRunner's lines and the last 4 of Coyote's. +\fBbacklog_no_timestamp\fP (default: \fBfalse\fP) +If true, backlogged line won't include the timestamp. + .TP \fBblreset_on_talk\fP (default: \fBfalse\fP) When true, backlog will not be reset upon client disconnection but upon client diff --git a/configure b/configure index 302ffa3..8f2cc04 100755 --- a/configure +++ b/configure @@ -2028,7 +2028,7 @@ fi # Define the identity of the package. PACKAGE=bip - VERSION=0.5.1 + VERSION=0.6.0 cat >>confdefs.h <<_ACEOF diff --git a/configure.in b/configure.in index 80689db..f901e13 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ AC_INIT(src/bip.c) AM_CONFIG_HEADER(src/config.h) -AM_INIT_AUTOMAKE(bip,0.5.1) +AM_INIT_AUTOMAKE(bip,0.6.0) AC_PROG_CC AC_PROG_INSTALL AC_PROG_YACC diff --git a/samples/bip.conf b/samples/bip.conf index 99a7394..8e4ecc9 100644 --- a/samples/bip.conf +++ b/samples/bip.conf @@ -40,6 +40,7 @@ log_level = 3; #backlog = true; # enable backlog backlog_lines = 10; # number of lines in backlog, 0 means no limit always_backlog = true; # backlog even lines already backlogged +#backlog_no_timestamp = false; # Disables time stamps if you find them ugly. # If blreset_on_talk talking on an irc network has the same effect of issuing # /bip blreset, meaning that stuffed logged before the command won't be read diff --git a/src/bip.c b/src/bip.c index 093e5e3..b1ce322 100644 --- a/src/bip.c +++ b/src/bip.c @@ -51,6 +51,7 @@ int conf_memlog; int conf_log; /* number of lines in backlog */ int conf_backlog_lines = 10; +int conf_backlog_no_timestamp; /* backlog even lines already backlogged */ int conf_always_backlog; int conf_log_sync_interval; @@ -624,6 +625,9 @@ int fireup(FILE *conf) case LEX_BACKLOG_LINES: conf_backlog_lines = t->ndata; break; + case LEX_BACKLOG_NO_TIMESTAMP: + conf_backlog_no_timestamp = t->ndata; + break; case LEX_LOG_ROOT: if (conf_log_root) free(conf_log_root); diff --git a/src/conf.y b/src/conf.y index b700415..824c2c3 100644 --- a/src/conf.y +++ b/src/conf.y @@ -80,7 +80,7 @@ struct tuple *tuple_l_new(int type, void *p) %} -%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG LEX_LOG LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY +%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY %union { int number; @@ -111,6 +111,9 @@ command: | LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); } | LEX_BACKLOG_LINES LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_BACKLOG_LINES, $3); } + | LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL { + $$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3); + } | LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); } | LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL { diff --git a/src/lex.l b/src/lex.l index 9888ca8..f61a9e7 100644 --- a/src/lex.l +++ b/src/lex.l @@ -81,6 +81,7 @@ list_t *parse_conf(FILE *file) "log_root" { return LEX_LOG_ROOT; } "log_format" { return LEX_LOG_FORMAT; } "backlog_lines" { return LEX_BACKLOG_LINES; } +"backlog_no_timestamp" { return LEX_BACKLOG_NO_TIMESTAMP; } "backlog" { return LEX_BACKLOG; } "bl_msg_only" { return LEX_BL_MSG_ONLY; } "log" { return LEX_LOG; } diff --git a/src/log.c b/src/log.c index abb2432..c33b3d6 100644 --- a/src/log.c +++ b/src/log.c @@ -29,6 +29,7 @@ extern int conf_backlog; extern int conf_backlog_lines; extern int conf_always_backlog; extern int conf_bl_msg_only; +extern int conf_backlog_no_timestamp; int log_set_backlog_offset(log_t *logdata, char *dest); static int _log_write(log_t *logdata, logfilegroup_t *lf, char *d, char *str); @@ -813,7 +814,7 @@ char *log_beautify(char *buf, char *dest) return _log_wrap(dest, buf); p = ret = (char *)malloc( - 1 + lon + strlen(LAMESTRING) + lod + 2 + lots + 1 + lom + 3 + 1 + lon + strlen(LAMESTRING) + lod + 2 + lots + 2 + lom + 3 + action * (2 + strlen("ACTION ")) + out * strlen(" -> ")); if (!p) fatal("out of memory"); @@ -841,10 +842,12 @@ char *log_beautify(char *buf, char *dest) strcpy(p, " -> "); p += strlen(" -> "); } - memcpy(p, sots, lots); - p += lots; - - *p++ = ' '; + if (conf_backlog_no_timestamp == 0) { + memcpy(p, sots, lots); + p += lots; + *p++ = '>'; + *p++ = ' '; + } memcpy(p, som, lom); p += lom;