# HG changeset patch # User Christian Hammond # Date 1056622438 0 # Node ID 115769a4c6fc658db8cd578d2934f4b4ddb79733 # Parent fc8ba872a43f03afc7b39b638ec605ad20a1278d [gaim-migrate @ 6409] Guess I found out. It crashes gaim! This fix should work... hahahaha right. committer: Tailor Script diff -r fc8ba872a43f -r 115769a4c6fc src/protocols/msn/notification.c --- a/src/protocols/msn/notification.c Thu Jun 26 09:39:21 2003 +0000 +++ b/src/protocols/msn/notification.c Thu Jun 26 10:13:58 2003 +0000 @@ -364,10 +364,12 @@ { gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); - servconn->parsing_msg = TRUE; + servconn->parsing_multiline = TRUE; + servconn->multiline_type = MSN_MULTILINE_MSG; + servconn->multiline_len = atoi(params[2]); + servconn->msg_passport = g_strdup(params[0]); servconn->msg_friendly = g_strdup(params[1]); - servconn->msg_len = atoi(params[2]); return TRUE; } @@ -607,10 +609,12 @@ { GaimConnection *gc = servconn->session->account->gc; - servconn->parsing_msg = TRUE; + servconn->parsing_multiline = TRUE; + servconn->multiline_type = MSN_MULTILINE_IPG; + servconn->multiline_len = atoi(params[0]); + servconn->msg_passport = NULL; servconn->msg_friendly = NULL; - servconn->msg_len = atoi(params[0]); return TRUE; } @@ -828,10 +832,12 @@ { GaimConnection *gc = servconn->session->account->gc; - servconn->parsing_msg = TRUE; + servconn->parsing_multiline = TRUE; + servconn->multiline_type = MSN_MULTILINE_NOT; + servconn->multiline_len = atoi(params[0]); + servconn->msg_passport = NULL; servconn->msg_friendly = NULL; - servconn->msg_len = atoi(params[0]); return TRUE; } diff -r fc8ba872a43f -r 115769a4c6fc src/protocols/msn/servconn.c --- a/src/protocols/msn/servconn.c Thu Jun 26 09:39:21 2003 +0000 +++ b/src/protocols/msn/servconn.c Thu Jun 26 10:13:58 2003 +0000 @@ -141,23 +141,42 @@ static gboolean process_multi_line(MsnServConn *servconn, char *buffer) { - MsnMessage *msg; char msg_str[MSN_BUF_LEN]; - gboolean result; + gboolean result = TRUE; + + if (servconn->multiline_type == MSN_MULTILINE_MSG) { + MsnMessage *msg; - g_snprintf(msg_str, sizeof(msg_str), - "MSG %s %s %d\r\n%s", - servconn->msg_passport, servconn->msg_friendly, - servconn->msg_len, buffer); + g_snprintf(msg_str, sizeof(msg_str), + "MSG %s %s %d\r\n%s", + servconn->msg_passport, servconn->msg_friendly, + servconn->multiline_len, buffer); + + gaim_debug(GAIM_DEBUG_MISC, "msn", + "Message: {%s}\n", buffer); + + msg = msn_message_new_from_str(servconn->session, msg_str); + + result = process_message(servconn, msg); - gaim_debug(GAIM_DEBUG_MISC, "msn", - "Message: {%s}\n", buffer); + msn_message_destroy(msg); + } + else if (servconn->multiline_type == MSN_MULTILINE_IPG) { + g_snprintf(msg_str, sizeof(msg_str), + "IPG %d\r\n%s", + servconn->multiline_len, buffer); - msg = msn_message_new_from_str(servconn->session, msg_str); + gaim_debug(GAIM_DEBUG_MISC, "msn", + "Incoming Page: {%s}\n", buffer); + } + else if (servconn->multiline_type == MSN_MULTILINE_NOT) { + g_snprintf(msg_str, sizeof(msg_str), + "NOT %d\r\n%s", + servconn->multiline_len, buffer); - result = process_message(servconn, msg); - - msn_message_destroy(msg); + gaim_debug(GAIM_DEBUG_MISC, "msn", + "Notification: {%s}\n", buffer); + } return result; } @@ -440,34 +459,34 @@ servconn->rxlen += len; while (cont) { - if (servconn->parsing_msg) { + if (servconn->parsing_multiline) { char *msg; if (servconn->rxlen == 0) break; - if (servconn->msg_len > servconn->rxlen) + if (servconn->multiline_len > servconn->rxlen) break; msg = servconn->rxqueue; - servconn->rxlen -= servconn->msg_len; + servconn->rxlen -= servconn->multiline_len; if (servconn->rxlen) { - servconn->rxqueue = g_memdup(msg + servconn->msg_len, + servconn->rxqueue = g_memdup(msg + servconn->multiline_len, servconn->rxlen); } else { servconn->rxqueue = NULL; - msg = g_realloc(msg, servconn->msg_len + 1); + msg = g_realloc(msg, servconn->multiline_len + 1); } - msg[servconn->msg_len] = '\0'; - servconn->parsing_msg = FALSE; + msg[servconn->multiline_len] = '\0'; + servconn->parsing_multiline = FALSE; process_multi_line(servconn, msg); if (g_list_find(session->servconns, servconn) != NULL) { - servconn->msg_len = 0; + servconn->multiline_len = 0; if (servconn->msg_passport != NULL) g_free(servconn->msg_passport); diff -r fc8ba872a43f -r 115769a4c6fc src/protocols/msn/servconn.h --- a/src/protocols/msn/servconn.h Thu Jun 26 09:39:21 2003 +0000 +++ b/src/protocols/msn/servconn.h Thu Jun 26 10:13:58 2003 +0000 @@ -34,6 +34,14 @@ #include "session.h" +typedef enum +{ + MSN_MULTILINE_MSG, + MSN_MULTILINE_IPG, + MSN_MULTILINE_NOT + +} MsnMultilineType; + struct _MsnServConn { MsnSession *session; @@ -53,10 +61,11 @@ GSList *txqueue; - gboolean parsing_msg; + gboolean parsing_multiline; + MsnMultilineType multiline_type; char *msg_passport; char *msg_friendly; - int msg_len; + int multiline_len; GHashTable *commands; GHashTable *msg_types; diff -r fc8ba872a43f -r 115769a4c6fc src/protocols/msn/switchboard.c --- a/src/protocols/msn/switchboard.c Thu Jun 26 09:39:21 2003 +0000 +++ b/src/protocols/msn/switchboard.c Thu Jun 26 10:13:58 2003 +0000 @@ -221,10 +221,12 @@ { gaim_debug(GAIM_DEBUG_INFO, "msn", "Found message. Parsing.\n"); - servconn->parsing_msg = TRUE; + servconn->parsing_multiline = TRUE; + servconn->multiline_type = MSN_MULTILINE_MSG; + servconn->multiline_len = atoi(params[2]); + servconn->msg_passport = g_strdup(params[0]); servconn->msg_friendly = g_strdup(params[1]); - servconn->msg_len = atoi(params[2]); return TRUE; }