Mercurial > hg > nnchat
diff nnchat.c @ 240:e85d453e82eb
Merged.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 20 Apr 2011 15:46:42 +0300 |
parents | b7e7ed741a18 52a2f06fd41c |
children | cb86d7543be2 |
line wrap: on
line diff
--- a/nnchat.c Wed Apr 20 15:44:34 2011 +0300 +++ b/nnchat.c Wed Apr 20 15:46:42 2011 +0300 @@ -1,7 +1,7 @@ /* * NNChat - Custom chat client for NewbieNudes.com chatrooms * Written by Matti 'ccr' Hämäläinen - * (C) Copyright 2008-2010 Tecnic Software productions (TNSP) + * (C) Copyright 2008-2011 Tecnic Software productions (TNSP) */ #include "libnnchat.h" #include <stdlib.h> @@ -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) { @@ -1030,7 +1046,7 @@ /* Initialize */ th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, - "Written and designed by Anonymous Finnish Guy (C) 2008-2010", + "Written and designed by Anonymous Finnish Guy (C) 2008-2011", "This software is freeware, use and distribute as you wish."); th_verbosityLevel = 0; @@ -1172,6 +1188,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);