changeset 240:e85d453e82eb

Merged.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 20 Apr 2011 15:46:42 +0300
parents b7e7ed741a18 (current diff) 578730eebe07 (diff)
children a1ee6c76ca1c
files nnchat.c
diffstat 3 files changed, 37 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/VERSION	Wed Apr 20 15:44:34 2011 +0300
+++ b/VERSION	Wed Apr 20 15:46:42 2011 +0300
@@ -1,1 +1,1 @@
-0.8.9
+0.8.10
--- 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);
--- a/th_util.h	Wed Apr 20 15:44:34 2011 +0300
+++ b/th_util.h	Wed Apr 20 15:46:42 2011 +0300
@@ -38,7 +38,7 @@
 #define TH_PROG_AUTHOR      NULL
 #define TH_PROG_LICENSE     NULL
 #else
-#define TH_PROG_AUTHOR      "By Matti 'ccr' Hämäläinen (C) Copyright 2010 TNSP"
+#define TH_PROG_AUTHOR      "By Matti 'ccr' Hämäläinen (C) Copyright 2011 TNSP"
 #define TH_PROG_LICENSE     "This software is licensed under GNU GPL version 2"
 #endif
 
@@ -54,17 +54,17 @@
 
 /* Global variables
  */
-extern  int th_verbosityLevel;
-extern  char *th_prog_name,
-        *th_prog_fullname,
-        *th_prog_version,
-        *th_prog_author,
-        *th_prog_license;
+extern int  th_verbosityLevel;
+extern char *th_prog_name,
+            *th_prog_fullname,
+            *th_prog_version,
+            *th_prog_author,
+            *th_prog_license;
 
 /* Functions
  */
 void    th_init(char *progName, char *progFullName, char *progVersion,
-        char *progAuthor, char *progLicense);
+               char *progAuthor, char *progLicense);
 void    THERR(const char *, ...);
 void    THMSG(int, const char *, ...);
 void    THPRINT(int, const char *, ...);