diff src/protocols/msn/msn.c @ 2273:0b5c3338fa3d

[gaim-migrate @ 2283] One of the girls on the floor of my sister's dorm lost both her parents when their plane was hijacked and crashed into the World Trade Center. my girlfriend's boss's sister-in-law's brother died when the building collapsed. my parents flew to atlanta on monday; they're safe but currently stranded there. they had planned on flying to Raleigh, NC today but now are just hoping to be able to fly home soon. how did this happen? committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 12 Sep 2001 21:29:32 +0000
parents 2f03cfd21fc2
children f5bf315e6104
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Wed Sep 12 18:57:46 2001 +0000
+++ b/src/protocols/msn/msn.c	Wed Sep 12 21:29:32 2001 +0000
@@ -17,6 +17,7 @@
 #define MSN_BUF_LEN 8192
 #define MIME_HEADER	"MIME-Version: 1.0\r\n" \
 			"Content-Type: text/plain; charset=UTF-8\r\n" \
+			"User-Agent: Gaim/" VERSION "\r\n" \
 			"X-MMS-IM-Format: FN=MS%20Sans%20Serif; EF=; CO=0; PF=0\r\n\r\n"
 
 #define MSN_ONLINE  1
@@ -434,8 +435,9 @@
 	} else if (!g_strncasecmp(buf, "MSG", 3)) {
 		char *user, *tmp = buf;
 		int length;
-		char *msg, *content, *utf;
+		char *msg, *content, *agent, *utf;
 		int len, r;
+		int flags = 0;
 
 		GET_NEXT(tmp);
 		user = tmp;
@@ -456,6 +458,11 @@
 			}
 		}
 
+		agent = strstr(msg, "User-Agent: ");
+		if (agent) {
+			if (!g_strncasecmp(agent, "User-Agent: Gaim", strlen("User-Agent: Gaim")))
+				flags |= IM_FLAG_GAIMUSER;
+		}
 		content = strstr(msg, "Content-Type: ");
 		if (!content) {
 			g_free(msg);
@@ -477,9 +484,9 @@
 			g_free(utf);
 
 			if (ms->chat)
-				serv_got_chat_in(gc, ms->chat->id, user, 0, final, time(NULL));
+				serv_got_chat_in(gc, ms->chat->id, user, flags, final, time(NULL));
 			else
-				serv_got_im(gc, user, final, 0, time(NULL));
+				serv_got_im(gc, user, final, flags, time(NULL));
 
 			g_free(final);
 		}
@@ -1206,7 +1213,7 @@
 		ms->fd = -1;
 	} else
 		/* in msn you can't send messages to yourself, so we'll fake like we received it ;) */
-		serv_got_im(gc, who, message, flags & IM_FLAG_AWAY, time(NULL));
+		serv_got_im(gc, who, message, flags | IM_FLAG_GAIMUSER, time(NULL));
 	return 0;
 }