/bip blreset implemented
This commit is contained in:
parent
db676b3221
commit
cb2f3a5e1e
15
src/bip.c
15
src/bip.c
@ -624,7 +624,6 @@ int fireup(FILE *conf)
|
|||||||
{
|
{
|
||||||
struct tuple *t;
|
struct tuple *t;
|
||||||
list_t *l;
|
list_t *l;
|
||||||
list_iterator_t li;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
conf_start();
|
conf_start();
|
||||||
@ -695,7 +694,7 @@ int fireup(FILE *conf)
|
|||||||
if (t->type == TUPLE_STR)
|
if (t->type == TUPLE_STR)
|
||||||
free(t->pdata);
|
free(t->pdata);
|
||||||
conf_die("Config error in base config (%d)", t->type);
|
conf_die("Config error in base config (%d)", t->type);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
@ -707,7 +706,7 @@ int fireup(FILE *conf)
|
|||||||
conf_die("You must set conf_backlog_lines if "
|
conf_die("You must set conf_backlog_lines if "
|
||||||
"conf_log = false and "
|
"conf_log = false and "
|
||||||
"conf_backlog = true");
|
"conf_backlog = true");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +714,7 @@ int fireup(FILE *conf)
|
|||||||
if (conf_backlog_lines == 0) {
|
if (conf_backlog_lines == 0) {
|
||||||
conf_die("You must have not nul conf_backlog_lines if "
|
conf_die("You must have not nul conf_backlog_lines if "
|
||||||
"conf_always_backlog is enabled");
|
"conf_always_backlog is enabled");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,6 +1079,14 @@ void adm_bip(struct link_client *ic, struct line *line)
|
|||||||
"jumpin' jumpin'");
|
"jumpin' jumpin'");
|
||||||
connection_close(CONN(LINK(ic)->l_server));
|
connection_close(CONN(LINK(ic)->l_server));
|
||||||
}
|
}
|
||||||
|
} else if (strcasecmp(line->elemv[1], "BLRESET") == 0) {
|
||||||
|
hash_iterator_t it;
|
||||||
|
for (hash_it_init(&LINK(ic)->log->logfgs, &it);
|
||||||
|
hash_it_item(&it);
|
||||||
|
hash_it_next(&it)) {
|
||||||
|
logfilegroup_t *lfg = hash_it_item(&it);
|
||||||
|
log_reset(lfg);
|
||||||
|
}
|
||||||
} else if (strcasecmp(line->elemv[1], "HELP") == 0) {
|
} else if (strcasecmp(line->elemv[1], "HELP") == 0) {
|
||||||
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG", nick,
|
WRITE_LINE2(CONN(ic), P_IRCMASK, "PRIVMSG", nick,
|
||||||
"/BIP (RELOAD|LIST|JUMP|HELP)");
|
"/BIP (RELOAD|LIST|JUMP|HELP)");
|
||||||
|
@ -944,7 +944,7 @@ static connection_t *connection_init(int anti_flood, int ssl, int timeout,
|
|||||||
{
|
{
|
||||||
connection_t *conn;
|
connection_t *conn;
|
||||||
char *incoming;
|
char *incoming;
|
||||||
list_t *outgoing, *incoming_lines;
|
list_t *outgoing;
|
||||||
|
|
||||||
conn = (connection_t*)malloc(sizeof(connection_t));
|
conn = (connection_t*)malloc(sizeof(connection_t));
|
||||||
incoming = (char*)malloc(sizeof(char) * CONN_BUFFER_SIZE);
|
incoming = (char*)malloc(sizeof(char) * CONN_BUFFER_SIZE);
|
||||||
|
25
src/log.c
25
src/log.c
@ -178,16 +178,24 @@ void log_updatelast(logfile_t *lf)
|
|||||||
localtime_r(&t, &lf->last_log);
|
localtime_r(&t, &lf->last_log);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_reinit(logfilegroup_t *lfg)
|
void log_reset(logfilegroup_t *lfg)
|
||||||
{
|
{
|
||||||
mylog(LOG_ERROR, "%s is inconsistant, droping backlog info",
|
|
||||||
lfg->name);
|
|
||||||
logfile_t *olf;
|
logfile_t *olf;
|
||||||
|
|
||||||
|
if (lfg->memlog) {
|
||||||
|
while (!list_is_empty(lfg->memlog))
|
||||||
|
free(list_remove_first(lfg->memlog));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while ((olf = list_get_first(&lfg->file_group)) !=
|
while ((olf = list_get_first(&lfg->file_group)) !=
|
||||||
list_get_last(&lfg->file_group)) {
|
list_get_last(&lfg->file_group)) {
|
||||||
logfile_free(olf);
|
logfile_free(olf);
|
||||||
list_remove_first(&lfg->file_group);
|
list_remove_first(&lfg->file_group);
|
||||||
}
|
}
|
||||||
|
if (!olf)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!olf->file)
|
if (!olf->file)
|
||||||
fatal("internal, (NULL logfile)");
|
fatal("internal, (NULL logfile)");
|
||||||
fseek(olf->file, 0, SEEK_END);
|
fseek(olf->file, 0, SEEK_END);
|
||||||
@ -195,6 +203,13 @@ void log_reinit(logfilegroup_t *lfg)
|
|||||||
olf->backlog_offset = olf->len;
|
olf->backlog_offset = olf->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void log_reinit(logfilegroup_t *lfg)
|
||||||
|
{
|
||||||
|
mylog(LOG_ERROR, "%s is inconsistant, droping backlog info",
|
||||||
|
lfg->name);
|
||||||
|
log_reset(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;
|
||||||
@ -784,7 +799,7 @@ char *log_beautify(char *buf, char *dest)
|
|||||||
|
|
||||||
p = ret = (char *)malloc(
|
p = ret = (char *)malloc(
|
||||||
1 + lon + strlen(LAMESTRING) + lod + 2 + lots +
|
1 + lon + strlen(LAMESTRING) + lod + 2 + lots +
|
||||||
1 + 3 + lom + 3 + action * (2 + strlen("ACTION ")));
|
1 + 5 + lom + 3 + action * (2 + strlen("ACTION ")));
|
||||||
if (!p)
|
if (!p)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
*p++ = ':';
|
*p++ = ':';
|
||||||
@ -807,7 +822,7 @@ char *log_beautify(char *buf, char *dest)
|
|||||||
p += strlen("ACTION ");
|
p += strlen("ACTION ");
|
||||||
}
|
}
|
||||||
if (out) {
|
if (out) {
|
||||||
memcpy(p, "->", 2);
|
memcpy(p, " -> ", 4);
|
||||||
p += 2;
|
p += 2;
|
||||||
}
|
}
|
||||||
memcpy(p, sots, lots);
|
memcpy(p, sots, lots);
|
||||||
|
@ -92,4 +92,5 @@ 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);
|
||||||
|
void log_reset(logfilegroup_t *);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user