changeset 22:ccf302dae898

Add decoding of entities.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 21 Jun 2008 11:16:09 +0300
parents 29098addfa65
children 40fecbab1dc1
files nnchat.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Thu Jun 12 23:55:41 2008 +0300
+++ b/nnchat.c	Sat Jun 21 11:16:09 2008 +0300
@@ -477,7 +477,7 @@
 int handleUser(int sock, char *str)
 {
 	const char *msg = "</USER><MESSAGE>";
-	char *p = str, *q, *s;
+	char *p = str, *q, *s, *t, *h;
 	
 	(void) sock;
 	
@@ -499,21 +499,24 @@
 		return -2;
 	}
 	
-	/* FIXME: decodeStr2() */
 	
 	if (*s == '/') {
-		char *t;
 		if (!strncmp(s, "/BPRV", 5)) {
 			t = stripTags(s + 2);
-			printMsg("%s\n", t);
+			h = decodeStr2(t);
+			printMsg("%s\n", h);
 		} else {
 			t = stripTags(s + 1);
-			printMsg("* %s\n", t);
+			h = decodeStr2(t);
+			printMsg("* %s\n", h);
 		}
+		th_free(h);
 		th_free(t);
 	} else {
-		char *t = stripTags(s);
-		printMsg("<%s> %s\n", p, t);
+		t = stripTags(s);
+		h = decodeStr2(t);
+		printMsg("<%s> %s\n", p, h);
+		th_free(h);
 		th_free(t);
 	}
 		
@@ -654,8 +657,8 @@
 			return -1;
 	} else {
 		/* Send double-encoded */
-		printf("ENC>%s\n", buf);
-		fflush(stdout);
+		//printf("ENC>%s\n", buf);
+		//fflush(stdout);
 	
 		tmpStr = encodeStr2(buf);
 		if (!tmpStr) return -2;