changeset 6061:c28dea25983c

[gaim-migrate @ 6511] Assorted fixes. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 08 Jul 2003 04:12:12 +0000
parents 6b4a12cd4caf
children 2cd7c409d71d
files src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c
diffstat 3 files changed, 26 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/toc/toc.c	Tue Jul 08 04:05:02 2003 +0000
+++ b/src/protocols/toc/toc.c	Tue Jul 08 04:12:12 2003 +0000
@@ -120,7 +120,7 @@
 #define USEROPT_AUTH      0
 #define USEROPT_AUTHPORT  1
 
-#define TOC_CONNECT_STEPS 3
+#define TOC_CONNECT_STEPS 4
 
 static void toc_login_callback(gpointer, gint, GaimInputCondition);
 static void toc_callback(gpointer, gint, GaimInputCondition);
@@ -353,22 +353,26 @@
 	/* Copy the string */
 	i = 0;
 	j = 0;
-	while (msg[i++]) {
+	while (msg[i]) {
 		switch (msg[i]) {
 		case '\n':
-			ret[j++] = '<';
-			ret[j++] = 'B';
-			ret[j++] = 'R';
-			ret[j++] = '>';
+			ret[j] = '<';
+			ret[j+1] = 'B';
+			ret[j+2] = 'R';
+			ret[j+3] = '>';
+			j += 4;
 			break;
 		case '{':
 		case '}':
 		case '\\':
 		case '"':
-			ret[j++] = '\\';
+			ret[j] = '\\';
+			j++;
 		default:
-			ret[j++] = msg[i];
+			ret[j] = msg[i];
+			j++;
 		}
+		i++;
 	}
 	ret[j] = '\0';
 
@@ -1025,19 +1029,20 @@
 
 static int toc_send_im(GaimConnection *gc, const char *name, const char *message, int len, int flags)
 {
-	char buf[BUF_LEN * 2];
-	char *tmp;
+	char *buf1, *buf2;
 
-	tmp = escape_text(message);
-	if (strlen(tmp) + 52 > MSG_LEN) {
-		g_free(tmp);
+	buf1 = escape_text(message);
+	if (strlen(buf1) + 52 > MSG_LEN) {
+		g_free(buf1);
 		return -E2BIG;
 	}
-	g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
-		   tmp, ((flags & IM_FLAG_AWAY) ? " auto" : ""));
-	sflap_send(gc, buf, -1, TYPE_DATA);
-	
-	g_free(tmp);
+
+	buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", normalize(name), buf1, 
+						   ((flags & IM_FLAG_AWAY) ? " auto" : ""));
+	g_free(buf1);
+	sflap_send(gc, buf2, -1, TYPE_DATA);
+	g_free(buf2);
+
 	return 1;
 }
 
--- a/src/protocols/trepia/trepia.c	Tue Jul 08 04:05:02 2003 +0000
+++ b/src/protocols/trepia/trepia.c	Tue Jul 08 04:12:12 2003 +0000
@@ -599,7 +599,7 @@
 		*data->type = *element_name;
 	}
 	else {
-		data->tag = g_strdup(element_name);
+		data->tag = g_strdup(element_name); /* XXX - Make sure this is freed */
 	}
 }
 
@@ -683,7 +683,7 @@
 	}
 
 	g_markup_parse_context_free(context);
-
+	g_free(parser_data);
 	*info = keys;
 
 	return 0;
--- a/src/protocols/yahoo/yahoo.c	Tue Jul 08 04:05:02 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Jul 08 04:12:12 2003 +0000
@@ -581,7 +581,7 @@
 			msg[j++] = m[i];
 		}
 		msg[j] = 0;
-		serv_got_im(gc, from, g_strdup(msg), 0, tm, -1);
+		serv_got_im(gc, from, msg, 0, tm, -1);
 	} else if (pkt->status == 2) {
 		gaim_notify_error(gc, NULL,
 						  _("Your Yahoo! message did not get sent."), NULL);