better log file format, log options, with backlog with memory based backlog
This commit is contained in:
parent
5e939ecd4d
commit
3a46247bd4
35
src/bip.c
35
src/bip.c
@ -46,7 +46,9 @@ hash_t adm_users;
|
|||||||
|
|
||||||
/* log options, for sure the trickiest :) */
|
/* log options, for sure the trickiest :) */
|
||||||
/* no backlog at all */
|
/* no backlog at all */
|
||||||
int conf_no_backlog;
|
int conf_backlog;
|
||||||
|
int conf_memlog;
|
||||||
|
int conf_log;
|
||||||
/* number of lines in backlog */
|
/* number of lines in backlog */
|
||||||
int conf_backlog_lines = 10;
|
int conf_backlog_lines = 10;
|
||||||
/* backlog even lines already backlogged */
|
/* backlog even lines already backlogged */
|
||||||
@ -576,8 +578,11 @@ int fireup(FILE *conf)
|
|||||||
case LEX_ALWAYS_BACKLOG:
|
case LEX_ALWAYS_BACKLOG:
|
||||||
conf_always_backlog = t->ndata;
|
conf_always_backlog = t->ndata;
|
||||||
break;
|
break;
|
||||||
case LEX_NO_BACKLOG:
|
case LEX_BACKLOG:
|
||||||
conf_no_backlog = t->ndata;
|
conf_backlog = t->ndata;
|
||||||
|
break;
|
||||||
|
case LEX_LOG:
|
||||||
|
conf_log = t->ndata;
|
||||||
break;
|
break;
|
||||||
case LEX_BACKLOG_LINES:
|
case LEX_BACKLOG_LINES:
|
||||||
conf_backlog_lines = t->ndata;
|
conf_backlog_lines = t->ndata;
|
||||||
@ -623,6 +628,25 @@ int fireup(FILE *conf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conf_backlog && !conf_log) {
|
||||||
|
if (conf_backlog_lines == 0) {
|
||||||
|
fatal("you must set conf_backlog_lines if conf_log = "
|
||||||
|
"false and conf_backlog = true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conf_always_backlog) {
|
||||||
|
if (conf_backlog_lines == 0) {
|
||||||
|
fatal("you must have not nul conf_backlog_lines if "
|
||||||
|
"conf_always_backlog is enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conf_log)
|
||||||
|
conf_memlog = 1;
|
||||||
|
else
|
||||||
|
conf_memlog = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
check_networks(networkl);
|
check_networks(networkl);
|
||||||
check_clients(userl);
|
check_clients(userl);
|
||||||
@ -667,6 +691,8 @@ int fireup(FILE *conf)
|
|||||||
#endif
|
#endif
|
||||||
if (!conf_log_format)
|
if (!conf_log_format)
|
||||||
conf_log_format = "%u/%n/%Y-%m/%c.%d.log";
|
conf_log_format = "%u/%n/%Y-%m/%c.%d.log";
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -851,7 +877,8 @@ int main(int argc, char **argv)
|
|||||||
conf_log_root = NULL;
|
conf_log_root = NULL;
|
||||||
conf_log_format = NULL;
|
conf_log_format = NULL;
|
||||||
conf_log_level = LOG_ERROR;
|
conf_log_level = LOG_ERROR;
|
||||||
conf_no_backlog = 0;
|
conf_backlog = 1;
|
||||||
|
conf_log = 1;
|
||||||
conf_backlog_lines = 100;
|
conf_backlog_lines = 100;
|
||||||
conf_log_sync_interval = 5;
|
conf_log_sync_interval = 5;
|
||||||
conf_daemonize = 1;
|
conf_daemonize = 1;
|
||||||
|
631
src/conf.c
631
src/conf.c
File diff suppressed because it is too large
Load Diff
56
src/conf.h
56
src/conf.h
@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 1.875d. */
|
/* A Bison parser, made by GNU Bison 2.0. */
|
||||||
|
|
||||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||||
@ -59,18 +59,19 @@
|
|||||||
LEX_LOG_FORMAT = 285,
|
LEX_LOG_FORMAT = 285,
|
||||||
LEX_LOG_LEVEL = 286,
|
LEX_LOG_LEVEL = 286,
|
||||||
LEX_BACKLOG_LINES = 287,
|
LEX_BACKLOG_LINES = 287,
|
||||||
LEX_NO_BACKLOG = 288,
|
LEX_BACKLOG = 288,
|
||||||
LEX_LOG_SYNC_INTERVAL = 289,
|
LEX_LOG = 289,
|
||||||
LEX_FOLLOW_NICK = 290,
|
LEX_LOG_SYNC_INTERVAL = 290,
|
||||||
LEX_ON_CONNECT_SEND = 291,
|
LEX_FOLLOW_NICK = 291,
|
||||||
LEX_AWAY_NICK = 292,
|
LEX_ON_CONNECT_SEND = 292,
|
||||||
LEX_PID_FILE = 293,
|
LEX_AWAY_NICK = 293,
|
||||||
LEX_IGN_FIRST_NICK = 294,
|
LEX_PID_FILE = 294,
|
||||||
LEX_ALWAYS_BACKLOG = 295,
|
LEX_IGN_FIRST_NICK = 295,
|
||||||
LEX_LOGIN = 296,
|
LEX_ALWAYS_BACKLOG = 296,
|
||||||
LEX_BOOL = 297,
|
LEX_LOGIN = 297,
|
||||||
LEX_INT = 298,
|
LEX_BOOL = 298,
|
||||||
LEX_STRING = 299
|
LEX_INT = 299,
|
||||||
|
LEX_STRING = 300
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#define LEX_IP 258
|
#define LEX_IP 258
|
||||||
@ -103,18 +104,19 @@
|
|||||||
#define LEX_LOG_FORMAT 285
|
#define LEX_LOG_FORMAT 285
|
||||||
#define LEX_LOG_LEVEL 286
|
#define LEX_LOG_LEVEL 286
|
||||||
#define LEX_BACKLOG_LINES 287
|
#define LEX_BACKLOG_LINES 287
|
||||||
#define LEX_NO_BACKLOG 288
|
#define LEX_BACKLOG 288
|
||||||
#define LEX_LOG_SYNC_INTERVAL 289
|
#define LEX_LOG 289
|
||||||
#define LEX_FOLLOW_NICK 290
|
#define LEX_LOG_SYNC_INTERVAL 290
|
||||||
#define LEX_ON_CONNECT_SEND 291
|
#define LEX_FOLLOW_NICK 291
|
||||||
#define LEX_AWAY_NICK 292
|
#define LEX_ON_CONNECT_SEND 292
|
||||||
#define LEX_PID_FILE 293
|
#define LEX_AWAY_NICK 293
|
||||||
#define LEX_IGN_FIRST_NICK 294
|
#define LEX_PID_FILE 294
|
||||||
#define LEX_ALWAYS_BACKLOG 295
|
#define LEX_IGN_FIRST_NICK 295
|
||||||
#define LEX_LOGIN 296
|
#define LEX_ALWAYS_BACKLOG 296
|
||||||
#define LEX_BOOL 297
|
#define LEX_LOGIN 297
|
||||||
#define LEX_INT 298
|
#define LEX_BOOL 298
|
||||||
#define LEX_STRING 299
|
#define LEX_INT 299
|
||||||
|
#define LEX_STRING 300
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -127,8 +129,8 @@ typedef union YYSTYPE {
|
|||||||
void *list;
|
void *list;
|
||||||
struct tuple *tuple;
|
struct tuple *tuple;
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
/* Line 1285 of yacc.c. */
|
/* Line 1318 of yacc.c. */
|
||||||
#line 132 "y.tab.h"
|
#line 134 "y.tab.h"
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
|
@ -79,7 +79,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_USERNAME 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_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_NO_BACKLOG 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_LOGIN
|
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_USERNAME 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_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_LOGIN
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
int number;
|
int number;
|
||||||
@ -110,8 +110,9 @@ command:
|
|||||||
| LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); }
|
| 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,
|
| LEX_BACKLOG_LINES LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_BACKLOG_LINES,
|
||||||
$3); }
|
$3); }
|
||||||
| LEX_NO_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_NO_BACKLOG,
|
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG,
|
||||||
$3); }
|
$3); }
|
||||||
|
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
||||||
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||||
LEX_ALWAYS_BACKLOG, $3); }
|
LEX_ALWAYS_BACKLOG, $3); }
|
||||||
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
||||||
|
24
src/irc.c
24
src/irc.c
@ -41,7 +41,7 @@ void irc_server_shutdown(struct link_server *s);
|
|||||||
|
|
||||||
void irc_client_free(struct link_client *cli);
|
void irc_client_free(struct link_client *cli);
|
||||||
static char *make_irc_mask(char *nick, char *oldim);
|
static char *make_irc_mask(char *nick, char *oldim);
|
||||||
extern int conf_no_backlog;
|
extern int conf_backlog;
|
||||||
extern int conf_log_sync_interval;
|
extern int conf_log_sync_interval;
|
||||||
extern int conf_error;
|
extern int conf_error;
|
||||||
extern char conf_errstr[];
|
extern char conf_errstr[];
|
||||||
@ -457,16 +457,10 @@ static void irc_send_join(struct link_client *ic, struct channel *chan)
|
|||||||
chan->name, chan->creator, chan->create_ts);
|
chan->name, chan->creator, chan->create_ts);
|
||||||
|
|
||||||
/* XXX: could be more efficient */
|
/* XXX: could be more efficient */
|
||||||
if (!conf_no_backlog && log_has_backlog(LINK(ic)->log, chan->name)) {
|
if (conf_backlog && log_has_backlog(LINK(ic)->log, chan->name)) {
|
||||||
char *line;
|
char *line;
|
||||||
int raw;
|
while ((line = log_backread(LINK(ic)->log, chan->name))) {
|
||||||
while ((line = log_backread(LINK(ic)->log, chan->name, &raw))) {
|
|
||||||
mylog(LOG_DEBUG, "backread:%s\n", line);
|
|
||||||
if (raw)
|
|
||||||
write_line(CONN(ic), line);
|
write_line(CONN(ic), line);
|
||||||
else
|
|
||||||
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG",
|
|
||||||
chan->name, line);
|
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG", chan->name,
|
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG", chan->name,
|
||||||
@ -633,14 +627,8 @@ static int irc_cli_startup(struct link_client *ic, struct line *line,
|
|||||||
|
|
||||||
/* backlog privates */
|
/* backlog privates */
|
||||||
char *str;
|
char *str;
|
||||||
int raw;
|
while ((str = log_backread(LINK(ic)->log, S_PRIVATES))) {
|
||||||
while ((str = log_backread(LINK(ic)->log, S_PRIVATES, &raw))) {
|
|
||||||
mylog(LOG_DEBUG, "backread:%s\n", line);
|
|
||||||
if (raw)
|
|
||||||
write_line(CONN(ic), str);
|
write_line(CONN(ic), str);
|
||||||
else
|
|
||||||
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG",
|
|
||||||
LINK(ic)->l_server->nick, str);
|
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,14 +705,14 @@ static int irc_cli_quit(struct link_client *ic, struct line *line)
|
|||||||
|
|
||||||
static int irc_cli_privmsg(struct link_client *ic, struct line *line)
|
static int irc_cli_privmsg(struct link_client *ic, struct line *line)
|
||||||
{
|
{
|
||||||
log_privmsg(LINK(ic)->log, LINK(ic)->l_server->nick,
|
log_cli_privmsg(LINK(ic)->log, LINK(ic)->l_server->nick,
|
||||||
line->elemv[1], line->elemv[2]);
|
line->elemv[1], line->elemv[2]);
|
||||||
return OK_COPY_CLI;
|
return OK_COPY_CLI;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int irc_cli_notice(struct link_client *ic, struct line *line)
|
static int irc_cli_notice(struct link_client *ic, struct line *line)
|
||||||
{
|
{
|
||||||
log_notice(LINK(ic)->log, LINK(ic)->l_server->nick,
|
log_cli_notice(LINK(ic)->log, LINK(ic)->l_server->nick,
|
||||||
line->elemv[1], line->elemv[2]);
|
line->elemv[1], line->elemv[2]);
|
||||||
return OK_COPY_CLI;
|
return OK_COPY_CLI;
|
||||||
}
|
}
|
||||||
|
300
src/lex.c
300
src/lex.c
@ -351,8 +351,8 @@ static void yy_fatal_error (yyconst char msg[] );
|
|||||||
*yy_cp = '\0'; \
|
*yy_cp = '\0'; \
|
||||||
(yy_c_buf_p) = yy_cp;
|
(yy_c_buf_p) = yy_cp;
|
||||||
|
|
||||||
#define YY_NUM_RULES 43
|
#define YY_NUM_RULES 44
|
||||||
#define YY_END_OF_BUFFER 44
|
#define YY_END_OF_BUFFER 45
|
||||||
/* This struct is not used in this scanner,
|
/* This struct is not used in this scanner,
|
||||||
but its presence is necessary. */
|
but its presence is necessary. */
|
||||||
struct yy_trans_info
|
struct yy_trans_info
|
||||||
@ -360,36 +360,35 @@ struct yy_trans_info
|
|||||||
flex_int32_t yy_verify;
|
flex_int32_t yy_verify;
|
||||||
flex_int32_t yy_nxt;
|
flex_int32_t yy_nxt;
|
||||||
};
|
};
|
||||||
static yyconst flex_int16_t yy_accept[257] =
|
static yyconst flex_int16_t yy_accept[248] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 44, 42, 1, 2, 42, 42, 4, 41,
|
0, 0, 45, 43, 1, 2, 43, 43, 4, 42,
|
||||||
38, 42, 42, 42, 42, 42, 42, 42, 42, 42,
|
39, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
42, 42, 42, 42, 42, 42, 42, 39, 40, 1,
|
43, 43, 43, 43, 43, 43, 43, 40, 41, 1,
|
||||||
0, 37, 0, 3, 4, 0, 0, 0, 0, 0,
|
0, 38, 0, 3, 4, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 23, 0, 0, 0, 0, 0, 0,
|
0, 0, 23, 30, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 22, 0, 0, 0,
|
0, 0, 0, 0, 22, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 11, 0,
|
0, 0, 0, 0, 0, 0, 11, 0, 0, 0,
|
||||||
|
|
||||||
0, 0, 12, 0, 17, 0, 0, 0, 0, 7,
|
12, 0, 17, 0, 0, 0, 7, 0, 0, 0,
|
||||||
0, 0, 0, 5, 14, 0, 0, 0, 0, 0,
|
5, 14, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 15, 0,
|
0, 0, 0, 0, 0, 15, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 20, 0,
|
0, 0, 0, 0, 20, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 9, 0, 0,
|
0, 0, 9, 0, 0, 0, 0, 29, 24, 0,
|
||||||
0, 0, 0, 24, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
|
||||||
0, 0, 10, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 26,
|
0, 0, 0, 26, 0, 0, 21, 37, 18, 0,
|
||||||
0, 0, 0, 21, 36, 18, 0, 13, 0, 34,
|
13, 0, 35, 0, 0, 0, 0, 0, 0, 25,
|
||||||
|
|
||||||
0, 0, 0, 0, 0, 0, 25, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 16, 0, 0, 27,
|
||||||
0, 0, 0, 0, 16, 0, 0, 27, 0, 29,
|
0, 0, 0, 0, 0, 0, 33, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 32, 0, 0, 0, 19,
|
19, 0, 0, 0, 0, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 28, 0, 0,
|
0, 0, 0, 31, 0, 0, 0, 0, 8, 0,
|
||||||
0, 0, 30, 0, 0, 0, 0, 8, 0, 0,
|
0, 36, 0, 0, 34, 32, 0
|
||||||
35, 0, 0, 33, 31, 0
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int32_t yy_ec[256] =
|
static yyconst flex_int32_t yy_ec[256] =
|
||||||
@ -432,84 +431,81 @@ static yyconst flex_int32_t yy_meta[35] =
|
|||||||
1, 1, 1, 1
|
1, 1, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_base[259] =
|
static yyconst flex_int16_t yy_base[250] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 268, 269, 33, 269, 262, 263, 258, 269,
|
0, 0, 259, 260, 33, 260, 253, 254, 249, 260,
|
||||||
269, 15, 253, 20, 28, 239, 23, 247, 237, 32,
|
260, 15, 244, 20, 28, 230, 23, 238, 228, 32,
|
||||||
237, 31, 244, 30, 232, 230, 238, 269, 269, 56,
|
228, 31, 235, 30, 223, 221, 229, 260, 260, 54,
|
||||||
250, 269, 251, 269, 246, 221, 240, 237, 238, 229,
|
241, 260, 242, 260, 237, 212, 231, 228, 229, 220,
|
||||||
224, 225, 224, 217, 220, 269, 210, 224, 218, 211,
|
215, 216, 215, 208, 211, 260, 201, 215, 209, 202,
|
||||||
225, 227, 226, 208, 220, 207, 221, 205, 201, 208,
|
216, 218, 200, 212, 199, 213, 197, 193, 200, 191,
|
||||||
199, 212, 202, 214, 192, 203, 199, 206, 197, 192,
|
204, 194, 206, 184, 195, 191, 198, 189, 184, 189,
|
||||||
197, 189, 192, 269, 43, 200, 183, 193, 200, 198,
|
181, 184, 260, 43, 192, 175, 185, 191, 176, 192,
|
||||||
183, 199, 180, 186, 176, 179, 269, 189, 177, 175,
|
173, 179, 169, 172, 260, 182, 170, 168, 162, 183,
|
||||||
169, 190, 178, 175, 174, 181, 180, 170, 269, 167,
|
171, 168, 167, 174, 173, 163, 260, 160, 43, 162,
|
||||||
|
|
||||||
43, 169, 269, 167, 269, 179, 165, 157, 171, 269,
|
260, 160, 260, 159, 151, 165, 260, 157, 164, 165,
|
||||||
163, 170, 171, 269, 160, 154, 154, 157, 155, 163,
|
260, 154, 148, 148, 151, 149, 157, 143, 157, 138,
|
||||||
149, 163, 144, 159, 149, 157, 147, 138, 269, 143,
|
153, 143, 151, 141, 132, 260, 137, 139, 137, 141,
|
||||||
155, 144, 142, 146, 153, 137, 147, 150, 269, 150,
|
148, 132, 142, 145, 260, 145, 135, 136, 131, 141,
|
||||||
140, 141, 136, 146, 127, 144, 143, 126, 121, 126,
|
122, 139, 138, 121, 116, 121, 121, 123, 119, 115,
|
||||||
126, 128, 127, 123, 119, 123, 121, 269, 132, 119,
|
119, 117, 260, 128, 115, 124, 122, 124, 260, 106,
|
||||||
128, 126, 128, 269, 110, 117, 112, 118, 111, 117,
|
113, 108, 114, 107, 113, 99, 113, 260, 110, 110,
|
||||||
103, 117, 269, 108, 113, 113, 111, 110, 99, 108,
|
108, 107, 96, 105, 108, 98, 96, 97, 91, 95,
|
||||||
111, 101, 99, 100, 94, 98, 97, 104, 93, 269,
|
94, 101, 90, 260, 100, 96, 260, 260, 260, 84,
|
||||||
103, 88, 98, 269, 269, 269, 86, 269, 96, 269,
|
260, 94, 260, 87, 91, 81, 90, 76, 73, 260,
|
||||||
|
|
||||||
89, 93, 83, 92, 78, 75, 269, 83, 84, 72,
|
81, 71, 72, 77, 73, 80, 260, 74, 66, 260,
|
||||||
73, 78, 74, 81, 269, 75, 67, 269, 70, 269,
|
69, 81, 62, 68, 73, 77, 260, 58, 57, 57,
|
||||||
82, 63, 69, 74, 78, 269, 59, 58, 58, 269,
|
260, 59, 55, 54, 70, 64, 63, 60, 260, 49,
|
||||||
60, 56, 55, 71, 65, 64, 61, 269, 50, 53,
|
52, 48, 50, 260, 51, 52, 38, 53, 260, 53,
|
||||||
49, 51, 269, 52, 53, 41, 54, 269, 54, 55,
|
54, 260, 43, 40, 260, 260, 260, 59, 48
|
||||||
269, 45, 42, 269, 269, 269, 60, 48
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_def[259] =
|
static yyconst flex_int16_t yy_def[250] =
|
||||||
{ 0,
|
{ 0,
|
||||||
256, 1, 256, 256, 256, 256, 257, 258, 256, 256,
|
247, 1, 247, 247, 247, 247, 248, 249, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
257, 256, 258, 256, 256, 256, 256, 256, 256, 256,
|
248, 247, 249, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
|
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
|
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 0, 247, 247
|
||||||
256, 256, 256, 256, 256, 0, 256, 256
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_nxt[304] =
|
static yyconst flex_int16_t yy_nxt[295] =
|
||||||
{ 0,
|
{ 0,
|
||||||
4, 5, 6, 5, 7, 8, 9, 10, 11, 4,
|
4, 5, 6, 5, 7, 8, 9, 10, 11, 4,
|
||||||
12, 13, 14, 4, 4, 15, 4, 16, 17, 18,
|
12, 13, 14, 4, 4, 15, 4, 16, 17, 18,
|
||||||
19, 4, 20, 21, 22, 23, 24, 25, 26, 27,
|
19, 4, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||||
4, 4, 28, 29, 30, 36, 30, 39, 42, 45,
|
4, 4, 28, 29, 30, 36, 30, 39, 42, 45,
|
||||||
40, 54, 49, 41, 58, 37, 50, 46, 33, 55,
|
40, 53, 49, 41, 57, 37, 50, 46, 33, 54,
|
||||||
51, 43, 101, 59, 56, 52, 60, 30, 125, 30,
|
51, 43, 99, 58, 55, 30, 59, 30, 122, 31,
|
||||||
31, 102, 255, 126, 254, 253, 252, 251, 127, 128,
|
246, 100, 245, 123, 244, 243, 242, 241, 124, 125,
|
||||||
250, 249, 248, 247, 246, 245, 244, 243, 242, 241,
|
|
||||||
240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
|
240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
|
||||||
230, 229, 228, 227, 226, 225, 224, 223, 222, 221,
|
230, 229, 228, 227, 226, 225, 224, 223, 222, 221,
|
||||||
|
|
||||||
220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
|
220, 219, 218, 217, 216, 215, 214, 213, 212, 211,
|
||||||
|
|
||||||
210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
|
210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
|
||||||
200, 199, 198, 197, 196, 195, 194, 193, 192, 191,
|
200, 199, 198, 197, 196, 195, 194, 193, 192, 191,
|
||||||
190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
|
190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
|
||||||
@ -518,58 +514,57 @@ static yyconst flex_int16_t yy_nxt[304] =
|
|||||||
160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
|
160, 159, 158, 157, 156, 155, 154, 153, 152, 151,
|
||||||
150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
|
150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
|
||||||
140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
|
140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
|
||||||
130, 129, 124, 123, 114, 122, 121, 120, 119, 118,
|
130, 129, 128, 127, 126, 121, 120, 111, 119, 118,
|
||||||
|
|
||||||
117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
|
117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
|
||||||
107, 106, 105, 104, 103, 100, 99, 98, 97, 96,
|
|
||||||
|
107, 106, 105, 104, 103, 102, 101, 98, 97, 96,
|
||||||
95, 94, 93, 92, 91, 90, 89, 88, 87, 86,
|
95, 94, 93, 92, 91, 90, 89, 88, 87, 86,
|
||||||
85, 84, 83, 82, 81, 80, 79, 78, 77, 76,
|
85, 84, 83, 82, 81, 80, 79, 78, 77, 76,
|
||||||
75, 74, 73, 72, 71, 70, 69, 68, 67, 66,
|
75, 74, 73, 72, 71, 70, 69, 68, 67, 66,
|
||||||
65, 64, 35, 34, 32, 63, 62, 61, 57, 53,
|
65, 64, 63, 35, 34, 32, 62, 61, 60, 56,
|
||||||
48, 47, 44, 38, 35, 34, 32, 256, 3, 256,
|
52, 48, 47, 44, 38, 35, 34, 32, 247, 3,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
|
247, 247, 247, 247
|
||||||
|
|
||||||
256, 256, 256
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_chk[304] =
|
static yyconst flex_int16_t yy_chk[295] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 5, 12, 5, 14, 15, 17,
|
1, 1, 1, 1, 5, 12, 5, 14, 15, 17,
|
||||||
14, 22, 20, 14, 24, 12, 20, 17, 258, 22,
|
14, 22, 20, 14, 24, 12, 20, 17, 249, 22,
|
||||||
20, 15, 75, 24, 22, 20, 24, 30, 101, 30,
|
20, 15, 74, 24, 22, 30, 24, 30, 99, 248,
|
||||||
257, 75, 253, 101, 252, 250, 249, 247, 101, 101,
|
244, 74, 243, 99, 241, 240, 238, 237, 99, 99,
|
||||||
246, 245, 244, 242, 241, 240, 239, 237, 236, 235,
|
236, 235, 233, 232, 231, 230, 228, 227, 226, 225,
|
||||||
234, 233, 232, 231, 229, 228, 227, 225, 224, 223,
|
224, 223, 222, 220, 219, 218, 216, 215, 214, 213,
|
||||||
222, 221, 219, 217, 216, 214, 213, 212, 211, 210,
|
212, 211, 209, 208, 206, 205, 204, 203, 202, 201,
|
||||||
|
|
||||||
209, 208, 206, 205, 204, 203, 202, 201, 199, 197,
|
199, 198, 197, 196, 195, 194, 192, 190, 186, 185,
|
||||||
193, 192, 191, 189, 188, 187, 186, 185, 184, 183,
|
183, 182, 181, 180, 179, 178, 177, 176, 175, 174,
|
||||||
182, 181, 180, 179, 178, 177, 176, 175, 174, 172,
|
173, 172, 171, 170, 169, 167, 166, 165, 164, 163,
|
||||||
171, 170, 169, 168, 167, 166, 165, 163, 162, 161,
|
162, 161, 160, 158, 157, 156, 155, 154, 152, 151,
|
||||||
160, 159, 157, 156, 155, 154, 153, 152, 151, 150,
|
150, 149, 148, 147, 146, 145, 144, 143, 142, 141,
|
||||||
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
|
140, 139, 138, 137, 136, 134, 133, 132, 131, 130,
|
||||||
138, 137, 136, 135, 134, 133, 132, 131, 130, 128,
|
129, 128, 127, 125, 124, 123, 122, 121, 120, 119,
|
||||||
127, 126, 125, 124, 123, 122, 121, 120, 119, 118,
|
118, 117, 116, 115, 114, 113, 112, 110, 109, 108,
|
||||||
117, 116, 115, 113, 112, 111, 109, 108, 107, 106,
|
106, 105, 104, 102, 100, 98, 96, 95, 94, 93,
|
||||||
104, 102, 100, 98, 97, 96, 95, 94, 93, 92,
|
92, 91, 90, 89, 88, 87, 86, 84, 83, 82,
|
||||||
|
|
||||||
91, 90, 89, 88, 86, 85, 84, 83, 82, 81,
|
81, 80, 79, 78, 77, 76, 75, 72, 71, 70,
|
||||||
80, 79, 78, 77, 76, 73, 72, 71, 70, 69,
|
69, 68, 67, 66, 65, 64, 63, 62, 61, 60,
|
||||||
68, 67, 66, 65, 64, 63, 62, 61, 60, 59,
|
59, 58, 57, 56, 55, 54, 53, 52, 51, 50,
|
||||||
58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
|
49, 48, 47, 45, 44, 43, 42, 41, 40, 39,
|
||||||
48, 47, 45, 44, 43, 42, 41, 40, 39, 38,
|
38, 37, 36, 35, 33, 31, 27, 26, 25, 23,
|
||||||
37, 36, 35, 33, 31, 27, 26, 25, 23, 21,
|
21, 19, 18, 16, 13, 9, 8, 7, 3, 247,
|
||||||
19, 18, 16, 13, 9, 8, 7, 3, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
|
||||||
256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
|
247, 247, 247, 247
|
||||||
|
|
||||||
256, 256, 256
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yy_state_type yy_last_accepting_state;
|
static yy_state_type yy_last_accepting_state;
|
||||||
@ -621,7 +616,7 @@ list_t *parse_conf(FILE *file)
|
|||||||
}
|
}
|
||||||
return root_list;
|
return root_list;
|
||||||
}
|
}
|
||||||
#line 625 "lex.yy.c"
|
#line 620 "lex.yy.c"
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
|
|
||||||
@ -774,7 +769,7 @@ YY_DECL
|
|||||||
|
|
||||||
#line 36 "lex.l"
|
#line 36 "lex.l"
|
||||||
|
|
||||||
#line 778 "lex.yy.c"
|
#line 773 "lex.yy.c"
|
||||||
|
|
||||||
if ( (yy_init) )
|
if ( (yy_init) )
|
||||||
{
|
{
|
||||||
@ -827,13 +822,13 @@ yy_match:
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 257 )
|
if ( yy_current_state >= 248 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
++yy_cp;
|
++yy_cp;
|
||||||
}
|
}
|
||||||
while ( yy_base[yy_current_state] != 269 );
|
while ( yy_base[yy_current_state] != 260 );
|
||||||
|
|
||||||
yy_find_action:
|
yy_find_action:
|
||||||
yy_act = yy_accept[yy_current_state];
|
yy_act = yy_accept[yy_current_state];
|
||||||
@ -1011,47 +1006,52 @@ YY_RULE_SETUP
|
|||||||
case 29:
|
case 29:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 72 "lex.l"
|
#line 72 "lex.l"
|
||||||
{ return LEX_NO_BACKLOG; }
|
{ return LEX_BACKLOG; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 30:
|
case 30:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 73 "lex.l"
|
#line 73 "lex.l"
|
||||||
{ return LEX_ALWAYS_BACKLOG; }
|
{ return LEX_LOG; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 31:
|
case 31:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 74 "lex.l"
|
#line 74 "lex.l"
|
||||||
{ return LEX_LOG_SYNC_INTERVAL; }
|
{ return LEX_ALWAYS_BACKLOG; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 32:
|
case 32:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 75 "lex.l"
|
#line 75 "lex.l"
|
||||||
{ return LEX_FOLLOW_NICK; }
|
{ return LEX_LOG_SYNC_INTERVAL; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 33:
|
case 33:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 76 "lex.l"
|
#line 76 "lex.l"
|
||||||
{ return LEX_IGN_FIRST_NICK; }
|
{ return LEX_FOLLOW_NICK; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 34:
|
case 34:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 77 "lex.l"
|
#line 77 "lex.l"
|
||||||
{ return LEX_AWAY_NICK; }
|
{ return LEX_IGN_FIRST_NICK; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 35:
|
case 35:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 78 "lex.l"
|
#line 78 "lex.l"
|
||||||
{ return LEX_ON_CONNECT_SEND; }
|
{ return LEX_AWAY_NICK; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 36:
|
case 36:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 79 "lex.l"
|
#line 79 "lex.l"
|
||||||
{ return LEX_PID_FILE; }
|
{ return LEX_ON_CONNECT_SEND; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 37:
|
case 37:
|
||||||
/* rule 37 can match eol */
|
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 80 "lex.l"
|
#line 80 "lex.l"
|
||||||
|
{ return LEX_PID_FILE; }
|
||||||
|
YY_BREAK
|
||||||
|
case 38:
|
||||||
|
/* rule 38 can match eol */
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 81 "lex.l"
|
||||||
{
|
{
|
||||||
size_t len = strlen(yytext) - 2;
|
size_t len = strlen(yytext) - 2;
|
||||||
yylval.string = malloc(len + 1);
|
yylval.string = malloc(len + 1);
|
||||||
@ -1062,35 +1062,35 @@ YY_RULE_SETUP
|
|||||||
return LEX_STRING;
|
return LEX_STRING;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 38:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 89 "lex.l"
|
|
||||||
{ return LEX_EQ; }
|
|
||||||
YY_BREAK
|
|
||||||
case 39:
|
case 39:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 90 "lex.l"
|
#line 90 "lex.l"
|
||||||
{ return LEX_LBRA; }
|
{ return LEX_EQ; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 40:
|
case 40:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 91 "lex.l"
|
#line 91 "lex.l"
|
||||||
{ return LEX_RBRA; }
|
{ return LEX_LBRA; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 41:
|
case 41:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 92 "lex.l"
|
#line 92 "lex.l"
|
||||||
{ return LEX_SEMICOLON; }
|
{ return LEX_RBRA; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 42:
|
case 42:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 93 "lex.l"
|
#line 93 "lex.l"
|
||||||
{ printf("Parse error line %d, unknown character '%s'\n", linec + 1, yytext);
|
{ return LEX_SEMICOLON; }
|
||||||
return LEX_BUNCH; }
|
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 43:
|
case 43:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 95 "lex.l"
|
#line 94 "lex.l"
|
||||||
|
{ printf("Parse error line %d, unknown character '%s'\n", linec + 1, yytext);
|
||||||
|
return LEX_BUNCH; }
|
||||||
|
YY_BREAK
|
||||||
|
case 44:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 96 "lex.l"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 1097 "lex.yy.c"
|
#line 1097 "lex.yy.c"
|
||||||
@ -1377,7 +1377,7 @@ static int yy_get_next_buffer (void)
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 257 )
|
if ( yy_current_state >= 248 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
@ -1405,11 +1405,11 @@ static int yy_get_next_buffer (void)
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 257 )
|
if ( yy_current_state >= 248 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
yy_is_jam = (yy_current_state == 256);
|
yy_is_jam = (yy_current_state == 247);
|
||||||
|
|
||||||
return yy_is_jam ? 0 : yy_current_state;
|
return yy_is_jam ? 0 : yy_current_state;
|
||||||
}
|
}
|
||||||
@ -2059,7 +2059,7 @@ void yyfree (void * ptr )
|
|||||||
#undef YY_DECL_IS_OURS
|
#undef YY_DECL_IS_OURS
|
||||||
#undef YY_DECL
|
#undef YY_DECL
|
||||||
#endif
|
#endif
|
||||||
#line 95 "lex.l"
|
#line 96 "lex.l"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,8 @@ list_t *parse_conf(FILE *file)
|
|||||||
"log_root" { return LEX_LOG_ROOT; }
|
"log_root" { return LEX_LOG_ROOT; }
|
||||||
"log_format" { return LEX_LOG_FORMAT; }
|
"log_format" { return LEX_LOG_FORMAT; }
|
||||||
"backlog_lines" { return LEX_BACKLOG_LINES; }
|
"backlog_lines" { return LEX_BACKLOG_LINES; }
|
||||||
"no_backlog" { return LEX_NO_BACKLOG; }
|
"backlog" { return LEX_BACKLOG; }
|
||||||
|
"log" { return LEX_LOG; }
|
||||||
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
|
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
|
||||||
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
|
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
|
||||||
"follow_nick" { return LEX_FOLLOW_NICK; }
|
"follow_nick" { return LEX_FOLLOW_NICK; }
|
||||||
|
267
src/log.c
267
src/log.c
@ -20,14 +20,17 @@ extern int errno;
|
|||||||
extern int log_level;
|
extern int log_level;
|
||||||
extern char *conf_log_root;
|
extern char *conf_log_root;
|
||||||
extern char *conf_log_format;
|
extern char *conf_log_format;
|
||||||
|
extern int conf_log;
|
||||||
|
|
||||||
|
int conf_memlog = 1;
|
||||||
|
|
||||||
/* conf_always_backlog => conf_backlog_lines != 0 */
|
/* conf_always_backlog => conf_backlog_lines != 0 */
|
||||||
extern int conf_no_backlog;
|
extern int conf_backlog;
|
||||||
extern int conf_backlog_lines;
|
extern int conf_backlog_lines;
|
||||||
extern int conf_always_backlog;
|
extern int conf_always_backlog;
|
||||||
|
|
||||||
int log_set_backlog_offset(log_t *logdata, char *dest);
|
int log_set_backlog_offset(log_t *logdata, char *dest);
|
||||||
static int _log_write(log_t *logdata, logfilegroup_t *lf, char *str);
|
static int _log_write(log_t *logdata, logfilegroup_t *lf, char *d, char *str);
|
||||||
void logfile_free(logfile_t *lf);
|
void logfile_free(logfile_t *lf);
|
||||||
|
|
||||||
/* TODO: change fatal("out of memory") to cleanup & return NULL */
|
/* TODO: change fatal("out of memory") to cleanup & return NULL */
|
||||||
@ -194,12 +197,14 @@ void log_reinit(logfilegroup_t *lfg)
|
|||||||
static int log_add_file(log_t *logdata, char *destination, char *filename)
|
static int log_add_file(log_t *logdata, char *destination, char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
logfile_t *lf;
|
logfile_t *lf = NULL;
|
||||||
logfilegroup_t *lfg;
|
logfilegroup_t *lfg;
|
||||||
|
|
||||||
|
if (conf_log) {
|
||||||
f = fopen(filename, "a+");
|
f = fopen(filename, "a+");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
mylog(LOG_ERROR, "fopen(%s) %s", filename, strerror(errno));
|
mylog(LOG_ERROR, "fopen(%s) %s", filename,
|
||||||
|
strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,10 +222,12 @@ static int log_add_file(log_t *logdata, char *destination, char *filename)
|
|||||||
lf->len = ftell(f);
|
lf->len = ftell(f);
|
||||||
lf->backlog_offset = lf->len;
|
lf->backlog_offset = lf->len;
|
||||||
log_updatelast(lf);
|
log_updatelast(lf);
|
||||||
|
}
|
||||||
|
|
||||||
lfg = hash_get(&logdata->logfgs, destination);
|
lfg = hash_get(&logdata->logfgs, destination);
|
||||||
|
|
||||||
if (!lfg) {
|
if (!lfg) {
|
||||||
lfg = malloc(sizeof(logfilegroup_t));
|
lfg = calloc(sizeof(logfilegroup_t), 1);
|
||||||
if (!lfg)
|
if (!lfg)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
list_init(&lfg->file_group, NULL);
|
list_init(&lfg->file_group, NULL);
|
||||||
@ -230,6 +237,13 @@ static int log_add_file(log_t *logdata, char *destination, char *filename)
|
|||||||
lfg->skip_advance = 0;
|
lfg->skip_advance = 0;
|
||||||
hash_insert(&logdata->logfgs, destination, lfg);
|
hash_insert(&logdata->logfgs, destination, lfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conf_memlog) {
|
||||||
|
if (!lfg->memlog)
|
||||||
|
lfg->memlog = list_new(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lf)
|
||||||
list_add_last(&lfg->file_group, lf);
|
list_add_last(&lfg->file_group, lf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -252,7 +266,7 @@ logfilegroup_t *log_find_file(log_t *logdata, char *destination)
|
|||||||
{
|
{
|
||||||
logfile_t *lf;
|
logfile_t *lf;
|
||||||
logfilegroup_t *lfg;
|
logfilegroup_t *lfg;
|
||||||
char *filename;
|
char *filename = NULL;
|
||||||
time_t t;
|
time_t t;
|
||||||
struct tm *ltime;
|
struct tm *ltime;
|
||||||
|
|
||||||
@ -261,13 +275,17 @@ logfilegroup_t *log_find_file(log_t *logdata, char *destination)
|
|||||||
|
|
||||||
lfg = hash_get(&logdata->logfgs, destination);
|
lfg = hash_get(&logdata->logfgs, destination);
|
||||||
|
|
||||||
|
if (lfg && !conf_log)
|
||||||
|
return lfg;
|
||||||
|
|
||||||
if (!lfg) {
|
if (!lfg) {
|
||||||
|
if (conf_log) {
|
||||||
filename = log_build_filename(logdata, destination);
|
filename = log_build_filename(logdata, destination);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
mylog(LOG_DEBUG, "Creating new logfile for %s: %s",
|
||||||
mylog(LOG_DEBUG, "Creating new logfile for %s: %s", destination,
|
destination, filename);
|
||||||
filename);
|
}
|
||||||
if (!log_add_file(logdata, destination, filename)) {
|
if (!log_add_file(logdata, destination, filename)) {
|
||||||
free(filename);
|
free(filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -275,9 +293,11 @@ logfilegroup_t *log_find_file(log_t *logdata, char *destination)
|
|||||||
lfg = hash_get(&logdata->logfgs, destination);
|
lfg = hash_get(&logdata->logfgs, destination);
|
||||||
if (!lfg)
|
if (!lfg)
|
||||||
fatal("internal log_find_file");
|
fatal("internal log_find_file");
|
||||||
|
if (filename)
|
||||||
free(filename);
|
free(filename);
|
||||||
return lfg;
|
return lfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is reached if lfg already exists */
|
/* This is reached if lfg already exists */
|
||||||
time(&t);
|
time(&t);
|
||||||
ltime = localtime(&t);
|
ltime = localtime(&t);
|
||||||
@ -305,7 +325,7 @@ logfilegroup_t *log_find_file(log_t *logdata, char *destination)
|
|||||||
}
|
}
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
||||||
if (conf_no_backlog) {
|
if (!conf_backlog) {
|
||||||
/* remove oldlf from file_group */
|
/* remove oldlf from file_group */
|
||||||
if (list_remove_first(&lfg->file_group) != oldlf)
|
if (list_remove_first(&lfg->file_group) != oldlf)
|
||||||
fatal("internal log_find_file 2");
|
fatal("internal log_find_file 2");
|
||||||
@ -366,12 +386,16 @@ void log_nick(log_t *logdata, char *ircmask, char *channel, char *newnick)
|
|||||||
log_write(logdata, channel, logdata->buffer);
|
log_write(logdata, channel, logdata->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
static void _log_privmsg(log_t *logdata, char *ircmask, int src,
|
||||||
char *message)
|
char *destination, char *message)
|
||||||
{
|
{
|
||||||
|
char dir = '<';
|
||||||
if (!ircmask)
|
if (!ircmask)
|
||||||
ircmask = "Server message";
|
ircmask = "Server message";
|
||||||
|
|
||||||
|
if (src)
|
||||||
|
dir = '>';
|
||||||
|
|
||||||
if (*message == '\001' && *(message + strlen(message) - 1) == '\001') {
|
if (*message == '\001' && *(message + strlen(message) - 1) == '\001') {
|
||||||
char *msg = strdup(message);
|
char *msg = strdup(message);
|
||||||
if (!msg)
|
if (!msg)
|
||||||
@ -383,44 +407,74 @@ void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
|||||||
*(msg + strlen(msg) - 1) = '\0';
|
*(msg + strlen(msg) - 1) = '\0';
|
||||||
if (ischannel(*destination) || strchr(destination, '@')) {
|
if (ischannel(*destination) || strchr(destination, '@')) {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
"%s * %s %s\n", timestamp(), ircmask,
|
"%s * %c %s %s\n", timestamp(), dir,
|
||||||
msg + 8);
|
ircmask, msg + 8);
|
||||||
} else {
|
} else {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
"%s (%s) * %s %s\n", timestamp(),
|
"%s (%s) * %c %s %s\n", timestamp(),
|
||||||
destination, ircmask, msg + 8);
|
destination, dir, ircmask, msg + 8);
|
||||||
}
|
}
|
||||||
free(msg);
|
free(msg);
|
||||||
} else {
|
} else {
|
||||||
if (ischannel(*destination) || strchr(destination, '@')) {
|
if (ischannel(*destination) || strchr(destination, '@')) {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s %s: %s\n",
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
timestamp(), ircmask, message);
|
"%s %c %s: %s\n", timestamp(), dir,
|
||||||
|
ircmask, message);
|
||||||
} else {
|
} else {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
"%s %s (%s): %s\n", timestamp(),
|
"%s %c %s (%s): %s\n", timestamp(),
|
||||||
ircmask, destination, message);
|
dir, ircmask, destination, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_write(logdata, destination, logdata->buffer);
|
log_write(logdata, destination, logdata->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_notice(log_t *logdata, char *ircmask, char *destination, char *message)
|
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||||
|
char *message)
|
||||||
{
|
{
|
||||||
|
_log_privmsg(logdata, ircmask, 0, destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_cli_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||||
|
char *message)
|
||||||
|
{
|
||||||
|
_log_privmsg(logdata, ircmask, 1, destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _log_notice(log_t *logdata, char *ircmask, int src,
|
||||||
|
char *destination, char *message)
|
||||||
|
{
|
||||||
|
char dir = '<';
|
||||||
|
|
||||||
if (!ircmask)
|
if (!ircmask)
|
||||||
ircmask = "Server message";
|
ircmask = "Server message";
|
||||||
|
if (src)
|
||||||
|
dir = '>';
|
||||||
if (*message == '\001' && *(message + strlen(message) - 1) == '\001')
|
if (*message == '\001' && *(message + strlen(message) - 1) == '\001')
|
||||||
return;
|
return;
|
||||||
if (ischannel(*destination) || strchr(destination, '@')) {
|
if (ischannel(*destination) || strchr(destination, '@')) {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s %s: %s\n",
|
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s %c %s: %s\n",
|
||||||
timestamp(), ircmask, message);
|
timestamp(), dir, ircmask, message);
|
||||||
} else {
|
} else {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
"%s %s (%s): %s\n", timestamp(),
|
"%s %c %s (%s): %s\n", timestamp(),
|
||||||
ircmask, destination, message);
|
dir, ircmask, destination, message);
|
||||||
}
|
}
|
||||||
log_write(logdata, destination, logdata->buffer);
|
log_write(logdata, destination, logdata->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void log_notice(log_t *logdata, char *ircmask, char *destination,
|
||||||
|
char *message)
|
||||||
|
{
|
||||||
|
_log_notice(logdata, ircmask, 0, destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_cli_notice(log_t *logdata, char *ircmask, char *destination,
|
||||||
|
char *message)
|
||||||
|
{
|
||||||
|
_log_notice(logdata, ircmask, 1, destination, message);
|
||||||
|
}
|
||||||
|
|
||||||
void log_topic(log_t *logdata, char *ircmask, char *channel, char *message)
|
void log_topic(log_t *logdata, char *ircmask, char *channel, char *message)
|
||||||
{
|
{
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
snprintf(logdata->buffer, LOGLINE_MAXLEN,
|
||||||
@ -462,15 +516,20 @@ void log_mode(log_t *logdata, char *ircmask, char *channel, char *modes,
|
|||||||
char **modargv, unsigned modargc)
|
char **modargv, unsigned modargc)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s -!- mode/%s [%s ",
|
char *tmpbuf = malloc(LOGLINE_MAXLEN + 1);
|
||||||
timestamp(), channel, modes);
|
char *tmpbuf2 = malloc(LOGLINE_MAXLEN + 1);
|
||||||
log_write(logdata, channel, logdata->buffer);
|
char *tmp;
|
||||||
|
snprintf(tmpbuf, LOGLINE_MAXLEN, "%s -!- mode/%s [%s ", timestamp(),
|
||||||
|
channel, modes);
|
||||||
for (i = 0; i < modargc; i++) {
|
for (i = 0; i < modargc; i++) {
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s%c", modargv[i],
|
snprintf(tmpbuf2, LOGLINE_MAXLEN, "%s%s%c", tmpbuf,
|
||||||
i == modargc - 1 ? ']' : ' ');
|
modargv[i], i == modargc - 1 ? ']' : ' ');
|
||||||
log_write(logdata, channel, logdata->buffer);
|
tmp = tmpbuf;
|
||||||
|
tmpbuf = tmpbuf2;
|
||||||
|
tmpbuf2 = tmp;
|
||||||
}
|
}
|
||||||
snprintf(logdata->buffer, LOGLINE_MAXLEN, " by %s\n", ircmask);
|
snprintf(logdata->buffer, LOGLINE_MAXLEN, "%s by %s\n", tmpbuf,
|
||||||
|
ircmask);
|
||||||
log_write(logdata, channel, logdata->buffer);
|
log_write(logdata, channel, logdata->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +542,7 @@ void log_disconnected(log_t *logdata)
|
|||||||
for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi);
|
for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi);
|
||||||
hash_it_next(&hi)) {
|
hash_it_next(&hi)) {
|
||||||
lfg = hash_it_item(&hi);
|
lfg = hash_it_item(&hi);
|
||||||
_log_write(logdata, lfg, logdata->buffer);
|
_log_write(logdata, lfg, hash_it_key(&hi), logdata->buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +563,7 @@ void log_connected(log_t *logdata)
|
|||||||
for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi);
|
for (hash_it_init(&logdata->logfgs, &hi); hash_it_item(&hi);
|
||||||
hash_it_next(&hi)) {
|
hash_it_next(&hi)) {
|
||||||
lfg = hash_it_item(&hi);
|
lfg = hash_it_item(&hi);
|
||||||
_log_write(logdata, lfg, logdata->buffer);
|
_log_write(logdata, lfg, hash_it_key(&hi), logdata->buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +603,7 @@ void log_client_connected(log_t *logdata)
|
|||||||
void log_advance_backlogs(log_t* ld, logfilegroup_t *lfg)
|
void log_advance_backlogs(log_t* ld, logfilegroup_t *lfg)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
if (conf_no_backlog || conf_backlog_lines == 0)
|
if (!conf_backlog || conf_backlog_lines == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (lfg->skip_advance < conf_backlog_lines) {
|
if (lfg->skip_advance < conf_backlog_lines) {
|
||||||
@ -589,6 +648,9 @@ int log_has_backlog(log_t *logdata, char *destination)
|
|||||||
if (!lfg)
|
if (!lfg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (lfg->memlog)
|
||||||
|
return !list_is_empty(lfg->memlog);
|
||||||
|
|
||||||
logfile_t *lf;
|
logfile_t *lf;
|
||||||
lf = list_get_first(&lfg->file_group);
|
lf = list_get_first(&lfg->file_group);
|
||||||
if (lf != list_get_last(&lfg->file_group))
|
if (lf != list_get_last(&lfg->file_group))
|
||||||
@ -601,8 +663,8 @@ int log_has_backlog(log_t *logdata, char *destination)
|
|||||||
#define LAMESTRING "!bip@bip.bip.bip PRIVMSG "
|
#define LAMESTRING "!bip@bip.bip.bip PRIVMSG "
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 13-05-2005 12:14:29 nohar (nohar): coucou
|
* 13-05-2005 12:14:29 > nohar (nohar): coucou
|
||||||
* 13-05-2005 12:14:30 nohar!~nohar@je.suis.t1r.net (nohar): coucou
|
* 13-05-2005 12:14:30 < nohar!~nohar@je.suis.t1r.net (nohar): coucou
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* must *not* return NULL */
|
/* must *not* return NULL */
|
||||||
@ -617,7 +679,7 @@ static char *log_beautify(char *buf, char *dest, int *raw)
|
|||||||
char *sots, *son, *som, *sod = NULL;
|
char *sots, *son, *som, *sod = NULL;
|
||||||
size_t lots, lon, lom, lod;
|
size_t lots, lon, lom, lod;
|
||||||
char *ret;
|
char *ret;
|
||||||
int guess_was_me = 0;
|
int out;
|
||||||
|
|
||||||
mylog(LOG_INFO, "beautify in: \"%s\"", buf);
|
mylog(LOG_INFO, "beautify in: \"%s\"", buf);
|
||||||
|
|
||||||
@ -627,62 +689,72 @@ static char *log_beautify(char *buf, char *dest, int *raw)
|
|||||||
|
|
||||||
p = strchr(buf, ' ');
|
p = strchr(buf, ' ');
|
||||||
if (!p || !p[0] || !p[1])
|
if (!p || !p[0] || !p[1])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
p++;
|
p++;
|
||||||
sots = p;
|
sots = p;
|
||||||
p = strchr(p, ' ');
|
p = strchr(p, ' ');
|
||||||
if (!p || !p[0] || !p[1])
|
if (!p || !p[0] || !p[1])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
lots = p - sots;
|
lots = p - sots;
|
||||||
p++;
|
p++;
|
||||||
if (strncmp(p, "-!-", 3) == 0)
|
if (strncmp(p, "-!-", 3) == 0)
|
||||||
return buf;
|
return strdup(buf);
|
||||||
|
|
||||||
|
if (*p == '>')
|
||||||
|
out = 1;
|
||||||
|
else if (*p == '<')
|
||||||
|
out = 0;
|
||||||
|
else
|
||||||
|
return strdup(buf);
|
||||||
|
p++;
|
||||||
|
if (*p != ' ')
|
||||||
|
return strdup(buf);
|
||||||
|
p++;
|
||||||
if (*p == '*') {
|
if (*p == '*') {
|
||||||
action = 1;
|
action = 1;
|
||||||
if (!p[1] || !p[2])
|
if (!p[1] || !p[2])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
p += 2;
|
p += 2;
|
||||||
}
|
}
|
||||||
son = p;
|
son = p;
|
||||||
/* 'date time blawithnoexcl bla bla ! bla' --> ? */
|
/* 'date time blawithnoexcl bla bla ! bla' --> ? */
|
||||||
while (*p && *p != '!' && *p != ' ' && *p != ':')
|
while (*p && *p != '!' && *p != ' ' && *p != ':')
|
||||||
p++;
|
p++;
|
||||||
if (*p != '!')
|
|
||||||
guess_was_me = 1;
|
|
||||||
if (!p[0] || !p[1])
|
if (!p[0] || !p[1])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
lon = p - son;
|
lon = p - son;
|
||||||
p = strchr(p, ' ');
|
p = strchr(p, ' ');
|
||||||
if (!p || !p[0] || !p[1])
|
if (!p || !p[0] || !p[1])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (*p == '(') {
|
if (*p == '(') {
|
||||||
p++;
|
p++;
|
||||||
if (!p[0] || !p[1] || p[0] == ')')
|
if (!p[0] || !p[1] || p[0] == ')')
|
||||||
return buf;
|
return strdup(buf);
|
||||||
sod = p;
|
sod = p;
|
||||||
while (*p && *p != ')' && *p != ' ')
|
while (*p && *p != ')' && *p != ' ')
|
||||||
p++;
|
p++;
|
||||||
if (*p != ')')
|
if (*p != ')')
|
||||||
return buf;
|
return strdup(buf);
|
||||||
lod = p - sod;
|
lod = p - sod;
|
||||||
p++;
|
p++;
|
||||||
if (*p != ':')
|
if (*p != ':')
|
||||||
return buf;
|
return strdup(buf);
|
||||||
p++;
|
p++;
|
||||||
if (*p != ' ')
|
if (*p != ' ')
|
||||||
return buf;
|
return strdup(buf);
|
||||||
p++;
|
p++;
|
||||||
if (!p[0] || !p[1])
|
if (!p[0] || !p[1])
|
||||||
return buf;
|
return strdup(buf);
|
||||||
} else {
|
} else {
|
||||||
sod = dest;
|
sod = dest;
|
||||||
lod = strlen(dest);
|
lod = strlen(dest);
|
||||||
}
|
}
|
||||||
if (guess_was_me) {
|
|
||||||
lon = lod;
|
if (out && strcmp(dest, "privates") == 0) {
|
||||||
son = sod;
|
son = sod;
|
||||||
|
lon = lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
som = p;
|
som = p;
|
||||||
@ -713,8 +785,8 @@ static char *log_beautify(char *buf, char *dest, int *raw)
|
|||||||
memcpy(p, "ACTION ", strlen("ACTION "));
|
memcpy(p, "ACTION ", strlen("ACTION "));
|
||||||
p += strlen("ACTION ");
|
p += strlen("ACTION ");
|
||||||
}
|
}
|
||||||
if (guess_was_me) {
|
if (out) {
|
||||||
memcpy(p, "<-", 2);
|
memcpy(p, "->", 2);
|
||||||
p += 2;
|
p += 2;
|
||||||
}
|
}
|
||||||
memcpy(p, sots, lots);
|
memcpy(p, sots, lots);
|
||||||
@ -731,17 +803,17 @@ static char *log_beautify(char *buf, char *dest, int *raw)
|
|||||||
*p++ = '\n';
|
*p++ = '\n';
|
||||||
*p = 0;
|
*p = 0;
|
||||||
mylog(LOG_INFO, "beautify out: \"%s\"", ret);
|
mylog(LOG_INFO, "beautify out: \"%s\"", ret);
|
||||||
free(buf);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *log_backread(log_t *logdata, char *destination, int *raw)
|
static char *_log_backread(log_t *logdata, char *destination, int *raw)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
logfile_t *lf;
|
logfile_t *lf;
|
||||||
logfilegroup_t *lfg;
|
logfilegroup_t *lfg;
|
||||||
int c;
|
int c;
|
||||||
|
char *ret;
|
||||||
|
|
||||||
if (!conf_always_backlog && logdata->connected)
|
if (!conf_always_backlog && logdata->connected)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -750,14 +822,31 @@ char *log_backread(log_t *logdata, char *destination, int *raw)
|
|||||||
if (!lfg)
|
if (!lfg)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* freed by log_beautify sometimes */
|
|
||||||
buf = (char *)malloc((LOGLINE_MAXLEN + 1) * sizeof(char));
|
|
||||||
|
|
||||||
if (!logdata->backlogging) {
|
if (!logdata->backlogging) {
|
||||||
list_it_init(&lfg->file_group, &logdata->file_it);
|
|
||||||
logdata->backlogging = 1;
|
logdata->backlogging = 1;
|
||||||
mylog(LOG_INFO, "backlogging!");
|
mylog(LOG_INFO, "backlogging!");
|
||||||
|
if (lfg->memlog)
|
||||||
|
list_it_init(lfg->memlog, &lfg->backlog_it);
|
||||||
|
else
|
||||||
|
list_it_init(&lfg->file_group, &logdata->file_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lfg->memlog) {
|
||||||
|
char *ptr;
|
||||||
|
ptr = list_it_item(&lfg->backlog_it);
|
||||||
|
if (!ptr) {
|
||||||
|
logdata->backlogging = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
list_it_next(&lfg->backlog_it);
|
||||||
|
return strdup(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conf_log)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
buf = (char *)malloc((LOGLINE_MAXLEN + 1) * sizeof(char));
|
||||||
|
|
||||||
next_file:
|
next_file:
|
||||||
/* check the files containing data to backlog */
|
/* check the files containing data to backlog */
|
||||||
lf = list_it_item(&logdata->file_it);
|
lf = list_it_item(&logdata->file_it);
|
||||||
@ -812,7 +901,9 @@ next_file:
|
|||||||
goto next_file;
|
goto next_file;
|
||||||
}
|
}
|
||||||
buf[pos] = 0;
|
buf[pos] = 0;
|
||||||
return log_beautify(buf, destination, raw);
|
ret = log_beautify(buf, destination, raw);
|
||||||
|
free(buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
buf[pos++] = c;
|
buf[pos++] = c;
|
||||||
}
|
}
|
||||||
@ -859,7 +950,9 @@ next_file:
|
|||||||
if (conf_always_backlog && c == EOF)
|
if (conf_always_backlog && c == EOF)
|
||||||
lf->backlog_offset--;
|
lf->backlog_offset--;
|
||||||
buf[pos] = 0;
|
buf[pos] = 0;
|
||||||
return log_beautify(buf, destination, raw);
|
ret = log_beautify(buf, destination, raw);
|
||||||
|
free(buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
buf[pos++] = c;
|
buf[pos++] = c;
|
||||||
}
|
}
|
||||||
@ -868,10 +961,54 @@ next_file:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _log_write(log_t *logdata, logfilegroup_t *lfg, char *str)
|
char *log_backread(log_t *log, char *dest)
|
||||||
|
{
|
||||||
|
int raw;
|
||||||
|
char *line;
|
||||||
|
char *buf;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
line = _log_backread(log, dest, &raw);
|
||||||
|
if (raw)
|
||||||
|
return line;
|
||||||
|
|
||||||
|
buf = malloc(LOGLINE_MAXLEN + 1);
|
||||||
|
count = snprintf(buf, LOGLINE_MAXLEN + 1,
|
||||||
|
":" P_IRCMASK " PRIVMSG %s :%s", dest, line);
|
||||||
|
if (count >= LOGLINE_MAXLEN + 1) {
|
||||||
|
buf[LOGLINE_MAXLEN - 2] = '\r';
|
||||||
|
buf[LOGLINE_MAXLEN - 1] = '\n';
|
||||||
|
buf[LOGLINE_MAXLEN] = 0;
|
||||||
|
}
|
||||||
|
free(line);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int _log_write(log_t *logdata, logfilegroup_t *lfg, char *destination,
|
||||||
|
char *str)
|
||||||
{
|
{
|
||||||
size_t nbwrite;
|
size_t nbwrite;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
if (str[LOGLINE_MAXLEN - 1] != 0) {
|
||||||
|
str[LOGLINE_MAXLEN - 1] = '\n';
|
||||||
|
str[LOGLINE_MAXLEN] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lfg->memlog) {
|
||||||
|
int raw;
|
||||||
|
char *r = log_beautify(str, destination, &raw);
|
||||||
|
list_add_last(lfg->memlog, r);
|
||||||
|
if (lfg->memc == conf_backlog_lines)
|
||||||
|
free(list_remove_first(lfg->memlog));
|
||||||
|
else
|
||||||
|
lfg->memc++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conf_log)
|
||||||
|
return 0;
|
||||||
|
|
||||||
logfile_t *lf = list_get_last(&lfg->file_group);
|
logfile_t *lf = list_get_last(&lfg->file_group);
|
||||||
|
|
||||||
/* str alloced size is LOGLINE_MAXLEN + 1 */
|
/* str alloced size is LOGLINE_MAXLEN + 1 */
|
||||||
@ -897,7 +1034,7 @@ void log_write(log_t *logdata, char *destination, char *str)
|
|||||||
destination);
|
destination);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_log_write(logdata, lfg, str);
|
_log_write(logdata, lfg, destination, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static list_t *log_all_logs = NULL;
|
static list_t *log_all_logs = NULL;
|
||||||
|
10
src/log.h
10
src/log.h
@ -42,6 +42,10 @@ typedef struct logfilegroup
|
|||||||
char *name;
|
char *name;
|
||||||
list_t file_group;
|
list_t file_group;
|
||||||
int skip_advance;
|
int skip_advance;
|
||||||
|
|
||||||
|
list_t *memlog;
|
||||||
|
int memc;
|
||||||
|
list_iterator_t backlog_it;
|
||||||
} logfilegroup_t;
|
} logfilegroup_t;
|
||||||
|
|
||||||
typedef struct log {
|
typedef struct log {
|
||||||
@ -69,6 +73,10 @@ void log_nick(log_t *logdata, char *ircmask, char *channel, char *newnick);
|
|||||||
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
void log_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||||
char *message);
|
char *message);
|
||||||
void log_notice(log_t *logdata, char *ircmask, char *channel, char *message);
|
void log_notice(log_t *logdata, char *ircmask, char *channel, char *message);
|
||||||
|
void log_cli_privmsg(log_t *logdata, char *ircmask, char *destination,
|
||||||
|
char *message);
|
||||||
|
void log_cli_notice(log_t *logdata, char *ircmask, char *channel,
|
||||||
|
char *message);
|
||||||
void log_write(log_t *logdata, char *str, char *destination);
|
void log_write(log_t *logdata, char *str, char *destination);
|
||||||
void log_mode(log_t *logdata, char *ircmask, char *channel,
|
void log_mode(log_t *logdata, char *ircmask, char *channel,
|
||||||
char *modes, char **modargv, unsigned modargc);
|
char *modes, char **modargv, unsigned modargc);
|
||||||
@ -80,7 +88,7 @@ void log_disconnected(log_t *logdata);
|
|||||||
void log_ping_timeout(log_t *logdata);
|
void log_ping_timeout(log_t *logdata);
|
||||||
void log_client_disconnected(log_t *logdata);
|
void log_client_disconnected(log_t *logdata);
|
||||||
void log_client_connected(log_t *logdata);
|
void log_client_connected(log_t *logdata);
|
||||||
char *log_backread(log_t *logdata, char *destination, int *raw);
|
char *log_backread(log_t *logdata, char *destination);
|
||||||
int log_has_backlog(log_t *logdata, char *destination);
|
int log_has_backlog(log_t *logdata, char *destination);
|
||||||
void log_flush_all(void);
|
void log_flush_all(void);
|
||||||
void log_client_none_connected(log_t *logdata);
|
void log_client_none_connected(log_t *logdata);
|
||||||
|
Loading…
Reference in New Issue
Block a user