summaryrefslogtreecommitdiff
blob: c0cdc7785f9d1c76ea3dfefd8fdb2bd281512780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Index: src/events.c
===================================================================
--- src/events.c	(revision 976)
+++ src/events.c	(revision 987)
@@ -72,6 +72,7 @@
 			free(e->event.msg.message);
 			free(e->event.msg.formats);
 			free(e->event.msg.recipients);
+			free(e->event.msg.xhtml_message);
 			break;
 
 		case GG_EVENT_NOTIFY:
@@ -420,6 +421,7 @@
 {
 	struct gg_recv_msg *r = (struct gg_recv_msg*) ((char*) h + sizeof(struct gg_header));
 	char *p, *packet_end = (char*) r + h->length;
+	int ctcp = 0;
 
 	gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_handle_recv_msg(%p, %p);\n", h, e);
 
@@ -438,6 +440,7 @@
 
 		if (*p == 0x02 && p == packet_end - 1) {
 			gg_debug_session(sess, GG_DEBUG_MISC, "// gg_handle_recv_msg() received ctcp packet\n");
+			ctcp = 1;
 			break;
 		}
 
@@ -463,8 +466,12 @@
 	e->event.msg.sender = gg_fix32(r->sender);
 	e->event.msg.time = gg_fix32(r->time);
 	e->event.msg.seq = gg_fix32(r->seq);
-	e->event.msg.message = (unsigned char*) strdup((char*) r + sizeof(*r));
+	if (ctcp)
+		e->event.msg.message = (unsigned char*) strdup("\x02");
+	else
+		e->event.msg.message = (unsigned char*) strdup((char*) r + sizeof(*r));
 
+
 	return 0;
 
 malformed: