Mercurial > hg > nnchat
changeset 236:71fa0364c058
Report network errors to the user.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 17 Mar 2011 08:58:19 +0200 |
parents | 87f434330547 |
children | 52a2f06fd41c |
files | VERSION nnchat.c |
diffstat | 2 files changed, 27 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/VERSION Sun Mar 13 11:49:33 2011 +0200 +++ b/VERSION Thu Mar 17 08:58:19 2011 +0200 @@ -1,1 +1,1 @@ -0.8.9 +0.8.10
--- a/nnchat.c Sun Mar 13 11:49:33 2011 +0200 +++ b/nnchat.c Thu Mar 17 08:58:19 2011 +0200 @@ -391,18 +391,15 @@ char *errorMessages = NULL; -void errorMsg(const char *fmt, ...) +void errorMsgV(const char *fmt, va_list ap) { char *tmp; - va_list ap1, ap2; + va_list ap2; - va_start(ap1, fmt); - va_copy(ap2, ap1); - printMsgV(TRUE, FALSE, fmt, ap1); - va_end(ap1); + va_copy(ap2, ap); + printMsgV(TRUE, FALSE, fmt, ap); tmp = th_strdup_vprintf(fmt, ap2); - va_end(ap2); if (errorMessages != NULL) { char *tmp2 = th_strdup_printf("%s%s", errorMessages, tmp); @@ -413,6 +410,25 @@ errorMessages = tmp; } +void errorMsg(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + errorMsgV(fmt, ap); + va_end(ap); +} + +void errorFunc(struct _nn_conn_t *conn, const char *fmt, va_list ap) +{ + errorMsgV(fmt, ap); +} + +void messageFunc(struct _nn_conn_t *conn, const char *fmt, va_list ap) +{ + printMsgV(TRUE, FALSE, fmt, ap); +} + BOOL checkIgnoreList(const char *name) { @@ -1105,6 +1121,9 @@ goto err_exit; } + conn->errfunc = errorFunc; + conn->msgfunc = messageFunc; + THMSG(1, "Connected, logging in as '%s', site '%s'.\n", optUserName, optSite); optUserNameEnc = nn_dblencode_str(optUserName); tmpStr = nn_dblencode_str(optSite);