changeset 2371:db02399a9ad7

[gaim-migrate @ 2384] continuing the big code reorganization committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Sep 2001 17:44:23 +0000
parents 25e7c2a68ed2
children 2927c2c26fe6
files src/buddy_chat.c src/gaim.h src/protocols/toc/toc.c src/util.c
diffstat 4 files changed, 70 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy_chat.c	Thu Sep 27 09:20:47 2001 +0000
+++ b/src/buddy_chat.c	Thu Sep 27 17:44:23 2001 +0000
@@ -530,7 +530,6 @@
 
 	gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1);
 
-	escape_text(buf);	/* it's ok to leave this here because oscar can't whisper */
 	serv_chat_whisper(b->gc, b->id, who, buf);
 
 	g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who);
--- a/src/gaim.h	Thu Sep 27 09:20:47 2001 +0000
+++ b/src/gaim.h	Thu Sep 27 17:44:23 2001 +0000
@@ -616,9 +616,7 @@
 
 /* Functions in util.c */
 extern char *normalize(const char *);
-extern int escape_text(char *);
 extern char *escape_text2(const char *);
-extern int escape_message(char *msg);
 extern char *tobase64(const char *);
 extern void frombase64(const char *, char **, int *);
 extern gint clean_pid(gpointer);
--- a/src/protocols/toc/toc.c	Thu Sep 27 09:20:47 2001 +0000
+++ b/src/protocols/toc/toc.c	Thu Sep 27 17:44:23 2001 +0000
@@ -208,6 +208,74 @@
 	g_free(gc->proto_data);
 }
 
+static int escape_message(char *msg)
+{
+	char *c, *cpy;
+	int cnt = 0;
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
+	if (strlen(msg) > BUF_LEN) {
+		debug_printf("Warning:  truncating message to 2048 bytes\n");
+		msg[2047] = '\0';
+	}
+
+	cpy = g_strdup(msg);
+	c = cpy;
+	while (*c) {
+		switch (*c) {
+		case '$':
+		case '[':
+		case ']':
+		case '(':
+		case ')':
+		case '#':
+			msg[cnt++] = '\\';
+			/* Fall through */
+		default:
+			msg[cnt++] = *c;
+		}
+		c++;
+	}
+	msg[cnt] = '\0';
+	g_free(cpy);
+	return cnt;
+}
+
+static int escape_text(char *msg)
+{
+	char *c, *cpy;
+	int cnt = 0;
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 4 bytes */
+	if (strlen(msg) > BUF_LEN) {
+		fprintf(stderr, "Warning:  truncating message to 2048 bytes\n");
+		msg[2047] = '\0';
+	}
+
+	cpy = g_strdup(msg);
+	c = cpy;
+	while (*c) {
+		switch (*c) {
+		case '\n':
+			msg[cnt++] = '<';
+			msg[cnt++] = 'B';
+			msg[cnt++] = 'R';
+			msg[cnt++] = '>';
+			break;
+		case '{':
+		case '}':
+		case '\\':
+		case '"':
+			msg[cnt++] = '\\';
+			/* Fall through */
+		default:
+			msg[cnt++] = *c;
+		}
+		c++;
+	}
+	msg[cnt] = '\0';
+	g_free(cpy);
+	return cnt;
+}
+
 static int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type)
 {
 	int len;
@@ -1080,7 +1148,8 @@
 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message)
 {
 	char buf2[BUF_LEN * 2];
-	g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
+	escape_text(message);
+	g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, normalize(who), message);
 	sflap_send(g, buf2, -1, TYPE_DATA);
 }
 
--- a/src/util.c	Thu Sep 27 09:20:47 2001 +0000
+++ b/src/util.c	Thu Sep 27 17:44:23 2001 +0000
@@ -477,76 +477,6 @@
 		return open_gaim_log_file("system", &x);
 }
 
-/* we only need this for TOC, because messages must be escaped */
-int escape_message(char *msg)
-{
-	char *c, *cpy;
-	int cnt = 0;
-	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
-	if (strlen(msg) > BUF_LEN) {
-		debug_printf("Warning:  truncating message to 2048 bytes\n");
-		msg[2047] = '\0';
-	}
-
-	cpy = g_strdup(msg);
-	c = cpy;
-	while (*c) {
-		switch (*c) {
-		case '$':
-		case '[':
-		case ']':
-		case '(':
-		case ')':
-		case '#':
-			msg[cnt++] = '\\';
-			/* Fall through */
-		default:
-			msg[cnt++] = *c;
-		}
-		c++;
-	}
-	msg[cnt] = '\0';
-	g_free(cpy);
-	return cnt;
-}
-
-/* we don't need this for oscar either */
-int escape_text(char *msg)
-{
-	char *c, *cpy;
-	int cnt = 0;
-	/* Assumes you have a buffer able to cary at least BUF_LEN * 4 bytes */
-	if (strlen(msg) > BUF_LEN) {
-		fprintf(stderr, "Warning:  truncating message to 2048 bytes\n");
-		msg[2047] = '\0';
-	}
-
-	cpy = g_strdup(msg);
-	c = cpy;
-	while (*c) {
-		switch (*c) {
-		case '\n':
-			msg[cnt++] = '<';
-			msg[cnt++] = 'B';
-			msg[cnt++] = 'R';
-			msg[cnt++] = '>';
-			break;
-		case '{':
-		case '}':
-		case '\\':
-		case '"':
-			msg[cnt++] = '\\';
-			/* Fall through */
-		default:
-			msg[cnt++] = *c;
-		}
-		c++;
-	}
-	msg[cnt] = '\0';
-	g_free(cpy);
-	return cnt;
-}
-
 char *escape_text2(const char *msg)
 {
 	char *c, *cpy;