1
0
forked from bip/bip

bl_msg_only

This commit is contained in:
nohar 2006-10-21 12:06:31 +00:00
parent 7aa6305280
commit 98dcc2e4d4
6 changed files with 70 additions and 29 deletions

16
TODO
View File

@ -22,3 +22,19 @@ Thanks a lot for your help.
Best regards,
Whoopie
--
23:46 < nixternal> i have a question...when i log into my bip server with more
than 1 client at a time...i get a mass "ban message" from
the server..notice of all channel bans that i am in
23:52 < nohar> one of you client is downloading the ban list
23:52 < nohar> an both recieve the reply
23:52 < nixternal> ahhh
23:52 < nixternal> i am using konversation..so i need to figure how to shut
that off
23:53 < nixternal> the ban list for 50 channels sucks ;)
23:53 < nohar> yeah i don't know if you can disable this in konversation. maybe
we should code a hack for the ban reply to go only to the client
that asked for it
23:54 < nohar> there is such thing for /who already

View File

@ -55,6 +55,7 @@ int conf_backlog_lines = 10;
int conf_always_backlog;
int conf_log_sync_interval;
int conf_blreset_on_talk = 0;
int conf_bl_msg_only = 0;
list_t *parse_conf(FILE *file);
static void conf_die(char *fmt, ...);
@ -614,6 +615,9 @@ int fireup(FILE *conf)
case LEX_BACKLOG:
conf_backlog = t->ndata;
break;
case LEX_BL_MSG_ONLY:
conf_bl_msg_only = t->ndata;
break;
case LEX_LOG:
conf_log = t->ndata;
break;

View File

@ -86,9 +86,10 @@
LEX_DEFAULT_NICK = 302,
LEX_DEFAULT_REALNAME = 303,
LEX_NO_CLIENT_AWAY_MSG = 304,
LEX_BOOL = 305,
LEX_INT = 306,
LEX_STRING = 307
LEX_BL_MSG_ONLY = 305,
LEX_BOOL = 306,
LEX_INT = 307,
LEX_STRING = 308
};
#endif
/* Tokens. */
@ -139,9 +140,10 @@
#define LEX_DEFAULT_NICK 302
#define LEX_DEFAULT_REALNAME 303
#define LEX_NO_CLIENT_AWAY_MSG 304
#define LEX_BOOL 305
#define LEX_INT 306
#define LEX_STRING 307
#define LEX_BL_MSG_ONLY 305
#define LEX_BOOL 306
#define LEX_INT 307
#define LEX_STRING 308
@ -156,7 +158,7 @@ typedef union YYSTYPE
struct tuple *tuple;
}
/* Line 1529 of yacc.c. */
#line 160 "conf.h"
#line 162 "conf.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View File

@ -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_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_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_LOGIN LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG
%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_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_LOGIN 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;
@ -113,6 +113,9 @@ command:
$3); }
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG,
$3); }
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $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, $3); }

View File

@ -84,6 +84,7 @@ list_t *parse_conf(FILE *file)
"log_format" { return LEX_LOG_FORMAT; }
"backlog_lines" { return LEX_BACKLOG_LINES; }
"backlog" { return LEX_BACKLOG; }
"bl_msg_only" { return LEX_BL_MSG_ONLY; }
"log" { return LEX_LOG; }
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }

View File

@ -28,6 +28,7 @@ int conf_memlog = 1;
extern int conf_backlog;
extern int conf_backlog_lines;
extern int conf_always_backlog;
extern int conf_bl_msg_only;
int log_set_backlog_offset(log_t *logdata, char *dest);
static int _log_write(log_t *logdata, logfilegroup_t *lf, char *d, char *str);
@ -699,7 +700,6 @@ int log_has_backlog(log_t *logdata, char *destination)
* 01-08-2005 10:46:11 < * jj!john@thebox.ofjj.net
*/
/* must *not* return NULL */
char *log_beautify(char *buf, char *dest)
{
int action = 0;
@ -727,8 +727,12 @@ char *log_beautify(char *buf, char *dest)
return _log_wrap(dest, buf);
lots = p - sots;
p++;
if (strncmp(p, "-!-", 3) == 0)
if (strncmp(p, "-!-", 3) == 0) {
if (conf_bl_msg_only)
return NULL;
else
return _log_wrap(dest, buf);
}
if (*p == '>')
out = 1;
@ -736,6 +740,7 @@ char *log_beautify(char *buf, char *dest)
out = 0;
else
return _log_wrap(dest, buf);
p++;
if (*p != ' ')
return _log_wrap(dest, buf);
@ -951,6 +956,10 @@ next_file:
}
buf[pos] = 0;
ret = log_beautify(buf, destination);
if (ret == NULL) {
pos = 0;
continue;
}
free(buf);
return ret;
}
@ -1000,6 +1009,10 @@ next_file:
lf->backlog_offset--;
buf[pos] = 0;
ret = log_beautify(buf, destination);
if (ret == NULL) {
pos = 0;
continue;
}
free(buf);
return ret;
}
@ -1037,12 +1050,14 @@ static int _log_write(log_t *logdata, logfilegroup_t *lfg, char *destination,
if (lfg->memlog) {
char *r = log_beautify(str, destination);
if (r != NULL) {
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;