From 1e6f0593fb1ef9cb096289b52bcc05580e358c09 Mon Sep 17 00:00:00 2001 From: kyoshiro Date: Thu, 17 Nov 2005 17:55:12 +0000 Subject: [PATCH] clean README and TODO files loglevels cleanup debug prints cleanup log info when connecting to a server default log level to INFO --- IDEAS | 14 -------------- README | 2 -- TODO | 8 +------- src/bip.c | 7 +++---- src/conf.h | 13 +++++++------ src/connection.c | 2 -- src/irc.c | 4 ++++ src/log.c | 23 ++++++++++------------- src/util.c | 2 +- src/util.h | 2 +- 10 files changed, 27 insertions(+), 50 deletions(-) delete mode 100644 IDEAS diff --git a/IDEAS b/IDEAS deleted file mode 100644 index dfe427d..0000000 --- a/IDEAS +++ /dev/null @@ -1,14 +0,0 @@ -- parser limité aux join part mode kick kill privmsg notices quit nick names -- parser client : join, part, quit, nick, privmsg/notice -- gestion des chans avec liste des nicks et statut -- backlog avec timestamp à la reconnexion -- logs au format irssi + timestamp complet -- parser de conf (lex) du style var = value -- backlog dans un dir, plusieurs fichiers (un par chan + le reste dans un autre) -- [secondaire] rotate logs - -- connection.c: conn, read/write polls, waitevent, ssl transparent et anti flood -- irc.c: gestion des chans, des spécificités d'un client IRC (ping) -- log.c: log et backlog -- client.c: gestion des clients (auth, etc...) -- config.c: lecture et enregistrement de la conf diff --git a/README b/README index 3be0aa0..e69de29 100644 --- a/README +++ b/README @@ -1,2 +0,0 @@ -log encryption support -salt this md5 diff --git a/TODO b/TODO index f96cca8..ea40579 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,6 @@ -Before release: -- SSL certificate verification - keep invites when detached ? - allow global (or per net ?) IP filtering -- /bip command for admin (at least rehash, jump, ...) -- check why log_mode doesn't add closing bracket... -- bug: bip using 100% cpu when reconnecting (to SSL only ?) - -TODO: +- more /bip commands - DCC proxying... - crypt logs diff --git a/src/bip.c b/src/bip.c index 0cb30f6..1233cf5 100644 --- a/src/bip.c +++ b/src/bip.c @@ -245,8 +245,8 @@ pid_is_there: } if (pid) mylog(LOG_INFO, "pid file found (pid %ld).", pid); - mylog(LOG_INFO, "Another instance of bip is certainly runing."); - mylog(LOG_INFO, "If you are sure this is not the case remove" + mylog(LOG_STD, "Another instance of bip is certainly runing."); + mylog(LOG_STD, "If you are sure this is not the case remove" " %s.", conf_pid_file); exit(2); } @@ -769,7 +769,6 @@ void ircize(list_t *ll) struct c_channel *chan = list_it_item(&chit); struct chan_info *ci = chan_info_new(); - printf("%s\n",chan->name); ci->name = strdup(chan->name); ci->key = strmaydup(chan->key); hash_insert(&link->chan_infos, @@ -891,7 +890,7 @@ int main(int argc, char **argv) conf_log_root = NULL; conf_log_format = NULL; - conf_log_level = LOG_ERROR; + conf_log_level = LOG_INFO; conf_backlog = 1; conf_log = 1; conf_backlog_lines = 100; diff --git a/src/conf.h b/src/conf.h index 77d3648..d3dc052 100644 --- a/src/conf.h +++ b/src/conf.h @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 2.1. */ /* 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, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -80,6 +80,7 @@ LEX_STRING = 306 }; #endif +/* Tokens. */ #define LEX_IP 258 #define LEX_EQ 259 #define LEX_PORT 260 @@ -141,8 +142,8 @@ typedef union YYSTYPE { void *list; struct tuple *tuple; } YYSTYPE; -/* Line 1285 of yacc.c. */ -#line 146 "y.tab.h" +/* Line 1447 of yacc.c. */ +#line 147 "y.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 diff --git a/src/connection.c b/src/connection.c index 766d5a0..237394f 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1071,8 +1071,6 @@ static connection_t *_connection_new(char *dsthostname, char *dstport, { connection_t *conn; - printf("%s\n", dsthostname); - conn = connection_init(1, 0, timeout, 0); create_socket(dsthostname, dstport, srchostname, srcport, conn); diff --git a/src/irc.c b/src/irc.c index f23df73..d5e6033 100644 --- a/src/irc.c +++ b/src/irc.c @@ -1870,6 +1870,10 @@ connection_t *irc_server_connect(struct link *link) struct link_server *ls; connection_t *conn; + mylog(LOG_INFO, "Connecting user '%s' to network '%s' using server " + "%s:%d", link->username, link->name, + link->serverv[link->cur_server]->host, + link->serverv[link->cur_server]->port); conn = connection_new(link->serverv[link->cur_server]->host, link->serverv[link->cur_server]->port, link->vhost, link->bind_port, diff --git a/src/log.c b/src/log.c index 41a79a3..ae78cb8 100644 --- a/src/log.c +++ b/src/log.c @@ -715,7 +715,7 @@ char *log_beautify(char *buf, char *dest) int done; if (!buf) - mylog(LOG_INFO, "BUG!"); + mylog(LOG_DEBUG, "BUG!"); p = strchr(buf, ' '); if (!p || !p[0] || !p[1]) @@ -850,9 +850,6 @@ char *log_beautify(char *buf, char *dest) *p++ = '\r'; *p++ = '\n'; *p = 0; -#if 0 - mylog(LOG_INFO, "beautify out: \"%s\"", ret); -#endif return ret; } @@ -874,7 +871,7 @@ char *log_backread(log_t *logdata, char *destination) if (!logdata->backlogging) { logdata->backlogging = 1; - mylog(LOG_INFO, "backlogging!"); + mylog(LOG_DEBUG, "backlogging!"); if (lfg->memlog) list_it_init(lfg->memlog, &lfg->backlog_it); else @@ -901,12 +898,12 @@ next_file: /* check the files containing data to backlog */ lf = list_it_item(&logdata->file_it); if (lf != list_get_last(&lfg->file_group)) { - mylog(LOG_INFO, "%s not last file!", lf->filename); + mylog(LOG_DEBUG, "%s not last file!", lf->filename); /* if the file is not the current open for logging * (it is an old file that has been rotated) * open if necessary, backlog line per line, and close */ if (!lf->file) { - mylog(LOG_INFO, "opening: %s!", lf->filename); + mylog(LOG_DEBUG, "opening: %s!", lf->filename); lf->file = fopen(lf->filename, "r"); if (!lf->file) { mylog(LOG_ERROR, "Can't open %s for reading", @@ -916,7 +913,7 @@ next_file: return _log_wrap("Error reading logfile", destination); } - mylog(LOG_INFO, "seeking: %d!", lf->backlog_offset); + mylog(LOG_DEBUG, "seeking: %d!", lf->backlog_offset); if (fseek(lf->file, lf->backlog_offset, SEEK_SET)) { log_reinit(lfg); free(buf); @@ -933,9 +930,9 @@ next_file: * then the log file is corrupted so we also * drop this file */ if (pos == LOGLINE_MAXLEN) - mylog(LOG_INFO, "logline too long"); + mylog(LOG_DEBUG, "logline too long"); if (c == EOF || pos == LOGLINE_MAXLEN) { - mylog(LOG_INFO, "EOF: %s (%d)!", + mylog(LOG_DEBUG, "EOF: %s (%d)!", lf->filename, conf_always_backlog); @@ -969,7 +966,7 @@ next_file: destination); } logdata->lastfile_seeked = 1; - mylog(LOG_INFO, "last file seedked!"); + mylog(LOG_DEBUG, "last file seedked!"); } c = fgetc(lf->file); @@ -990,7 +987,7 @@ next_file: lf->backlog_offset++; if (c == EOF || c == '\n' || pos == LOGLINE_MAXLEN) { if (pos == LOGLINE_MAXLEN) { - mylog(LOG_INFO, "logline too long"); + mylog(LOG_DEBUG, "logline too long"); fseek(lf->file, 0, SEEK_END); /* in the corruption case we alwayse reset * backlog offset */ @@ -1022,7 +1019,7 @@ static char *_log_wrap(char *dest, char *line) count = snprintf(buf, LOGLINE_MAXLEN + 1, ":" P_IRCMASK " PRIVMSG %s :%s\r\n", dest, line); if (count >= LOGLINE_MAXLEN + 1) { - mylog(LOG_INFO, "line too long"); + mylog(LOG_DEBUG, "line too long"); buf[LOGLINE_MAXLEN - 2] = '\r'; buf[LOGLINE_MAXLEN - 1] = '\n'; buf[LOGLINE_MAXLEN] = 0; diff --git a/src/util.c b/src/util.c index b79eb7a..45a0685 100644 --- a/src/util.c +++ b/src/util.c @@ -100,7 +100,7 @@ void _mylog(int level, char *fmt, va_list ap) prefix = "WARNING: "; break; case LOG_INFO: - prefix = "INFO: "; + prefix = ""; break; default: prefix = ""; diff --git a/src/util.h b/src/util.h index f044f10..9770a09 100644 --- a/src/util.h +++ b/src/util.h @@ -17,12 +17,12 @@ #include /* Warning: must be in order, 0 = less output */ +#define LOG_STD -1 #define LOG_FATAL 0 #define LOG_ERROR 1 #define LOG_WARN 2 #define LOG_INFO 3 #define LOG_DEBUG 4 -#define LOG_STD 4 #define LOG_DEBUGVERB 5 #define LOG_DEBUGTOOMUCH 6