# HG changeset patch # User Christian Hammond # Date 1058474980 0 # Node ID 29fef9695c4d0f9ae4bc2039884d6fe6f3c0758d # Parent 4fb902212769f3e78776b4ae9c8f7dbd79faf4dd [gaim-migrate @ 6667] MSN messages with newlines being sent to an MSN client had \n and not \r\n, but the official MSN client requires \r\n (wonderful, huh?) Now we send \r\n for MSN messages. Problem solved. committer: Tailor Script diff -r 4fb902212769 -r 29fef9695c4d src/protocols/msn/msg.c --- a/src/protocols/msn/msg.c Thu Jul 17 15:24:21 2003 +0000 +++ b/src/protocols/msn/msg.c Thu Jul 17 20:49:40 2003 +0000 @@ -407,6 +407,11 @@ void msn_message_set_body(MsnMessage *msg, const char *body) { + const char *c; + char *buf, *d; + int newline_count = 0; + size_t new_len; + g_return_if_fail(msg != NULL); g_return_if_fail(body != NULL); @@ -415,9 +420,27 @@ g_free(msg->body); } - msg->body = g_strdup(body); + for (c = body; *c != '\0'; c++) { + if (*c == '\n' && (c == body || *(c - 1) != '\r')) + newline_count++; + } + + new_len = strlen(body) + newline_count; + + buf = g_new0(char, new_len + 1); - msg->size += strlen(body); + for (c = body, d = buf; *c != '\0'; c++) { + if (*c == '\n' && (c == body || *(c - 1) != '\r')) { + *d++ = '\r'; + *d++ = '\n'; + } + else + *d++ = *c; + } + + msg->body = buf; + + msg->size += new_len; } const char *