diff src/protocols/msn/msn.c @ 4474:8fbf1c989f2b

[gaim-migrate @ 4749] Reverting shx's patch. It uses a function that the man page claims should never be used, and it breaks things on Solaris and probably other platforms. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 30 Jan 2003 18:14:22 +0000
parents e926d3bdfd14
children 3196d9044a45
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Thu Jan 30 18:08:04 2003 +0000
+++ b/src/protocols/msn/msn.c	Thu Jan 30 18:14:22 2003 +0000
@@ -154,7 +154,6 @@
 			while (*(tmp) && *(tmp) == ' ') \
 				(tmp)++;
 
-#define GET_NEXT_LINE(tmp,s)	strsep (&tmp, " "); s = strsep (&tmp, "\r");
 
 static char *msn_normalize(const char *s)
 {
@@ -786,10 +785,21 @@
 		char *cookie_s, *filesize_s;
 		size_t filesize;
 
-		tmp = strstr(msg, "Invitation-Cookie:");
-		GET_NEXT_LINE(tmp, cookie_s);
-		GET_NEXT_LINE(tmp, filename);
-		GET_NEXT_LINE(tmp, filesize_s);
+		tmp = strstr(msg, "Invitation-Cookie");
+		GET_NEXT(tmp);
+		cookie_s = tmp;
+		GET_NEXT(tmp);
+		GET_NEXT(tmp);
+		filename = tmp;
+
+		/* Needed for filenames with spaces */
+		tmp = strchr(tmp, '\r');
+		*tmp = '\0';
+		tmp += 2;
+
+		GET_NEXT(tmp);
+		filesize_s = tmp;
+		GET_NEXT(tmp);
 
 		mft = g_new0(struct msn_file_transfer, 1);
 		mft->gc = ms->gc;
@@ -822,12 +832,19 @@
 
 			char *cookie_s, *ip, *port_s, *authcookie_s;
 
-			tmp = strstr(msg, "Invitation-Cookie:");
-			GET_NEXT_LINE(tmp, cookie_s);
-			GET_NEXT_LINE(tmp, ip);
-			GET_NEXT_LINE(tmp, port_s);
-			GET_NEXT_LINE(tmp, authcookie_s);
-			GET_NEXT_LINE(tmp, authcookie_s);
+			tmp = strstr(msg, "Invitation-Cookie");
+			GET_NEXT(tmp);
+			cookie_s = tmp;
+			GET_NEXT(tmp);
+			GET_NEXT(tmp);
+			ip = tmp;
+			GET_NEXT(tmp);
+			GET_NEXT(tmp);
+			port_s = tmp;
+			GET_NEXT(tmp);
+			GET_NEXT(tmp);
+			authcookie_s = tmp;
+			GET_NEXT(tmp);
 
 			mft = find_mft_by_cookie(ms->gc, atoi(cookie_s));