irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit 040101687bc1b67448429cca891706f7bbbdc892
parent 414f9b84fc6d2db87be9de7546da38a18ebdd8f7
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 11 Jul 2012 22:29:27 +0200

error reporting

Diffstat:
TODO | 1+
irctk.c | 13+++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/TODO b/TODO @@ -1,3 +1,4 @@ +irc_color_convert_to_mirc Remove UUOCs in readme ssl support password support diff --git a/irctk.c b/irctk.c @@ -441,8 +441,8 @@ static struct argp argp = { options, parse_opt, args_doc, doc }; void message(int verbosity, const char *err, va_list ap) { if (args.verbosity >= verbosity) { - fprintf(stderr, "%s: ", verbosity > 0 ? "debug" : - verbosity >= 0 ? "info" : "error"); + fprintf(stderr, "%s ", verbosity > 0 ? "irctk: [debug]" : + verbosity >= 0 ? "irctk:" : "irctk: [error]"); vfprintf(stderr, err, ap); fprintf(stderr, "\n"); } @@ -1137,7 +1137,6 @@ int do_cmd_msg(irc_session_t *s, char* chan, char* line) rsl = irc_cmd_msg (s, chan, line); } } - /* TODO manage errors */ if (rsl) return rsl; @@ -1619,6 +1618,7 @@ int start (int max_wait) int cont = 1; action *results; int n_results; + int rsl, error; s = do_connect(); @@ -1668,7 +1668,12 @@ int start (int max_wait) } else { debug("[main] manage line %s %s, pointer %p", results[i].destination, results[i].line, results[i].full_line ); - do_cmd_msg(s, results[i].destination, results[i].line); + rsl = do_cmd_msg(s, results[i].destination, results[i].line); + if (rsl) { + error = irc_errno(s); + info("Interpreting \"%s\" returned %d, error %d: %s", results[i].line, + rsl, error, irc_strerror(error)); + } } } // now, we free stuff