diff src/gaimrc.c @ 2379:cacaf7ace3a5

[gaim-migrate @ 2392] reorganization of some functions. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 28 Sep 2001 01:25:02 +0000
parents 2927c2c26fe6
children 3d4bbadf4b8d
line wrap: on
line diff
--- a/src/gaimrc.c	Thu Sep 27 23:58:48 2001 +0000
+++ b/src/gaimrc.c	Fri Sep 28 01:25:02 2001 +0000
@@ -165,7 +165,7 @@
 	return -1;
 }
 
-void filter_break(char *msg)
+static void filter_break(char *msg)
 {
 	char *c;
 	int mc;
@@ -190,6 +190,40 @@
 	g_free(c);
 }
 
+static char *escape_text2(const char *msg)
+{
+	char *c, *cpy;
+	char *woo;
+	int cnt = 0;
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
+
+	woo = malloc(strlen(msg) * 4 + 1);
+	cpy = g_strndup(msg, 2048);
+	c = cpy;
+	while (*c) {
+		switch (*c) {
+		case '\n':
+			woo[cnt++] = '<';
+			woo[cnt++] = 'B';
+			woo[cnt++] = 'R';
+			woo[cnt++] = '>';
+			break;
+		case '{':
+		case '}':
+		case '\\':
+		case '"':
+			woo[cnt++] = '\\';
+			/* Fall through */
+		default:
+			woo[cnt++] = *c;
+		}
+		c++;
+	}
+	woo[cnt] = '\0';
+
+	g_free(cpy);
+	return woo;
+}
 
 static void gaimrc_read_away(FILE *f)
 {