1
0
forked from bip/bip

[log] close logs files more intensively.

This commit is contained in:
Arnaud Cornet 2009-06-25 00:43:44 +02:00
parent 7af35a3018
commit 5ae1c1dec5
3 changed files with 16 additions and 8 deletions

View File

@ -132,12 +132,12 @@ list_t *channel_name_list(struct channel *c)
if (ovmask & NICKOP)
strcat(str, "@");
else if (ovmask & NICKHALFOP)
strncat(str, "%");
strcat(str, "%");
else if (ovmask & NICKVOICED)
strcat(str, "+");
len++;
strncat(str, nick);
strcat(str, nick);
len += strlen(nick);
assert(len < NAMESIZE);
}
@ -1058,12 +1058,19 @@ static int irc_cli_join(struct link_client *irc, struct line *line)
static int irc_cli_part(struct link_client *irc, struct line *line)
{
struct chan_info *ci;
char *cname;
if (irc_line_count(line) != 2 && irc_line_count(line) != 3)
return ERR_PROTOCOL;
struct chan_info *ci;
cname = irc_line_elem(line, 1);
log_reset_store(LINK(irc)->log, cname);
log_drop(LINK(irc)->log, cname);
if ((ci = hash_remove_if_exists(&LINK(irc)->chan_infos,
irc_line_elem(line, 1))) != NULL) {
cname)) != NULL) {
list_remove(&LINK(irc)->chan_infos_order, ci);
free(ci->name);
if (ci->key)

View File

@ -30,7 +30,8 @@ static int _log_write(log_t *logdata, logstore_t *lf, const char *d,
const char *str);
static char *_log_wrap(const char *dest, const char *line);
void logfile_free(logfile_t *lf);
static void log_drop(log_t *log, const char *storename);
void log_drop(log_t *log, const char *storename);
static void log_reset(logstore_t *store);
#define BOLD_CHAR 0x02
#define LAMESTRING "!bip@" P_SERV " PRIVMSG "
@ -179,7 +180,7 @@ void log_updatelast(logfile_t *lf)
localtime_r(&t, &lf->last_log);
}
void log_reset(logstore_t *store)
static void log_reset(logstore_t *store)
{
logfile_t *olf;
@ -669,7 +670,7 @@ void log_store_free(logstore_t *store)
free(store);
}
static void log_drop(log_t *log, const char *storename)
void log_drop(log_t *log, const char *storename)
{
logstore_t *store;

View File

@ -96,11 +96,11 @@ void log_client_connected(log_t *logdata);
int log_has_backlog(log_t *logdata, const char *destination);
void log_flush_all(void);
void log_client_none_connected(log_t *logdata);
void log_reset(logstore_t *);
void log_reset_all(log_t *logdata);
void log_free(log_t *log);
int check_dir(char *filename, int is_fatal);
void log_reset_store(log_t *log, const char *storename);
void log_drop(log_t *log, const char *storename);
list_t *log_backlogs(log_t *log);
list_t *backlog_lines(log_t *log, const char *bl, const char *cli_nick,