Mercurial > pidgin.yaz
diff src/protocols/msn/msg.c @ 6800:8f228a7d5076
[gaim-migrate @ 7340]
Added what I have of MSNSLP in my tree. It's broken, and therefore
disabled, but I need to get this out so I can do other stuff too, and have
something to revert back to if I break something :)
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 10 Sep 2003 00:24:48 +0000 |
parents | 8efafdc38718 |
children | 2adf21e70601 |
line wrap: on
line diff
--- a/src/protocols/msn/msg.c Tue Sep 09 16:55:10 2003 +0000 +++ b/src/protocols/msn/msg.c Wed Sep 10 00:24:48 2003 +0000 @@ -69,6 +69,21 @@ } MsnMessage * +msn_message_new_msnslp(void) +{ + MsnMessage *msg; + + msg = msn_message_new(); + + msn_message_set_attr(msg, "User-Agent", NULL); + + msg->msnslp_message = TRUE; + msg->size += 52; + + return msg; +} + +MsnMessage * msn_message_new_from_str(MsnSession *session, const char *str) { MsnMessage *msg; @@ -357,7 +372,9 @@ long session_id, id, offset, total_size, length, flags; long ack_session_id, ack_unique_id, ack_length; - memcpy(blank, 0, 4); + blank[0] = blank[1] = blank[2] = blank[3] = 0; + + g_strlcat(str, "\r\n", 3); c = str + strlen(str); @@ -388,20 +405,33 @@ c += strlen(msn_message_get_body(msg)); - memcpy(c, blank, 1); c++; + if (strlen(msn_message_get_body(msg)) > 0) + *c++ = '\0'; + memcpy(c, &msg->msnslp_footer.app_id, 4); c += 4; + *c = '\0'; + + gaim_debug_misc("msn", "cur size = %d\n", (c - str)); + gaim_debug_misc("msn", "msg->size = %d\n", msg->size); + + if (msg->size != (c - str)) + { + gaim_debug(GAIM_DEBUG_ERROR, "msn", + "Outgoing message size (%d) and string length (%d) " + "do not match!\n", msg->size, (c - str)); + } } else { g_snprintf(buf, sizeof(buf), "\r\n%s", msn_message_get_body(msg)); g_strlcat(str, buf, len); - } - if (msg->size != strlen(msg_start)) { - gaim_debug(GAIM_DEBUG_ERROR, "msn", - "Outgoing message size (%d) and string length (%d) " - "do not match!\n", msg->size, strlen(msg_start)); + if (msg->size != strlen(msg_start)) { + gaim_debug(GAIM_DEBUG_ERROR, "msn", + "Outgoing message size (%d) and string length (%d) " + "do not match!\n", msg->size, strlen(msg_start)); + } } return str; @@ -430,7 +460,7 @@ g_return_if_fail(user != NULL); msg->sender = user; - + msn_user_ref(msg->sender); } @@ -449,7 +479,7 @@ g_return_if_fail(user != NULL); msg->receiver = user; - + msn_user_ref(msg->receiver); } @@ -509,6 +539,9 @@ if (msg->body != NULL) { msg->size -= strlen(msg->body); g_free(msg->body); + + if (msg->msnslp_message) + msg->size--; } for (c = body; *c != '\0'; c++) { @@ -532,6 +565,9 @@ msg->body = buf; msg->size += new_len; + + if (msg->msnslp_message) + msg->size++; } const char *