--- a/src/protocols/msn/httpconn.c Wed Jan 19 22:22:53 2005 -0500
+++ b/src/protocols/msn/httpconn.c Thu Jan 20 11:36:49 2005 -0500
@@ -283,7 +283,6 @@
gaim_debug_error("msn", "HTTP: Read error\n");
msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ);
- msn_httpconn_disconnect(httpconn);
@@ -310,11 +309,15 @@
gaim_debug_error("msn", "HTTP: Special error\n");
msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ);
- msn_httpconn_disconnect(httpconn);
+ if (httpconn->rx_buf != NULL) + g_free(httpconn->rx_buf); + httpconn->rx_buf = NULL; @@ -322,17 +325,11 @@
gaim_debug_info("msn", "HTTP: nothing to do here\n");
- g_free(httpconn->rx_buf);
- httpconn->rx_buf = NULL;
- g_free(httpconn->rx_buf);
- httpconn->rx_buf = NULL;
- g_free(servconn->rx_buf);
+ if (servconn->rx_buf != NULL) + g_free(servconn->rx_buf); servconn->rx_buf = result_msg;
servconn->rx_len = result_len;
@@ -702,8 +699,10 @@
servconn = httpconn->servconn;
- servconn->wasted = TRUE;
+ /* I'll be honest, I don't fully understand all this, but this + * causes crashes, Stu. */ + /* if (servconn != NULL) + servconn->wasted = TRUE; */ --- a/src/protocols/msn/msn.c Wed Jan 19 22:22:53 2005 -0500
+++ b/src/protocols/msn/msn.c Thu Jan 20 11:36:49 2005 -0500
@@ -1050,16 +1050,21 @@
session = gc->proto_data;
swboard = msn_session_find_switch_with_id(session, id);
- g_return_if_fail(swboard != NULL);
- cmdproc = swboard->servconn->cmdproc;
+ /* if we have no switchboard, everyone else left the chat already */ + swboard = msn_switchboard_new(session); + msn_switchboard_request(swboard); + swboard->conv = gaim_find_chat(gc, id); - msn_cmdproc_send(cmdproc, "CAL", "%s", who);
+ msn_switchboard_request_add_user(swboard, who); @@ -1071,11 +1076,12 @@
session = gc->proto_data;
swboard = msn_session_find_switch_with_id(session, id);
- g_return_if_fail(swboard != NULL);
+ /* if swboard is NULL we were the only person left anyway */ msn_switchboard_close(swboard);
- /* serv_got_chat_left(gc, id); */
--- a/src/protocols/msn/session.c Wed Jan 19 22:22:53 2005 -0500
+++ b/src/protocols/msn/session.c Thu Jan 20 11:36:49 2005 -0500
@@ -322,6 +322,7 @@
msn_session_disconnect(session);
gaim_connection_error(gc, msg);
@@ -375,12 +376,12 @@
+ if (session->logged_in) account = session->account;
gc = gaim_account_get_connection(account);
- if (session->logged_in)
msn_user_set_buddy_icon(session->user,
gaim_account_get_buddy_icon(session->account));
--- a/src/protocols/msn/switchboard.c Wed Jan 19 22:22:53 2005 -0500
+++ b/src/protocols/msn/switchboard.c Thu Jan 20 11:36:49 2005 -0500
@@ -227,9 +227,12 @@
/* gaim_debug_info("msn", "[chat] Switching to chat.\n"); */
+ /* this is bad - it causes msn_switchboard_close to be called on the + * switchboard we're in the middle of using :( */ if (swboard->conv != NULL)
gaim_conversation_destroy(swboard->conv);
cmdproc->session->conv_seq++;
swboard->chat_id = cmdproc->session->conv_seq;
@@ -310,7 +313,9 @@
gaim_debug_info("msg", "Error: Unable to call the user %s\n", passport);
- if (swboard->total_users == 0)
+ /* TODO: if current_users > 0, this is probably a chat and an invite failed, + * we should report that in the chat or something */ + if (swboard->current_users == 0) msn_switchboard_close(swboard);
@@ -608,10 +613,14 @@
/* This is a helper switchboard */
msn_switchboard_destroy(swboard);
- else if (swboard->current_users > 1)
+ else if ((swboard->current_users > 1) || + (gaim_conversation_get_type(swboard->conv) == GAIM_CONV_CHAT)) /* This is a switchboard used for a chat */
gaim_conv_chat_remove_user(GAIM_CONV_CHAT(swboard->conv), user, NULL);
+ swboard->current_users--; + if (swboard->current_users == 0) + msn_switchboard_destroy(swboard); @@ -849,13 +858,22 @@
- if (swboard->current_users > 1)
+ if (swboard->current_users > 1 || + ((swboard->conv != NULL) && + gaim_conversation_get_type(swboard->conv) == GAIM_CONV_CHAT)) serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final,
+ if (swboard->conv == NULL) + swboard->conv = gaim_find_chat(gc, swboard->chat_id); serv_got_im(gc, passport, body_final, 0, time(NULL));
+ if (swboard->conv == NULL) + swboard->conv = gaim_find_conversation_with_account(passport, + gaim_connection_get_account(gc)); @@ -1093,6 +1111,9 @@
g_return_if_fail(swboard != NULL);
+ /* forget any conversation that used to be associated with this swboard */ if (swboard->error != MSN_SB_ERROR_NONE)
msn_switchboard_destroy(swboard);
--- a/src/protocols/msn/userlist.c Wed Jan 19 22:22:53 2005 -0500
+++ b/src/protocols/msn/userlist.c Thu Jan 20 11:36:49 2005 -0500
@@ -154,10 +154,25 @@
g_return_val_if_fail(user != NULL, NULL);
- if ((store_name = msn_user_get_store_name(user)) != NULL)
- return gaim_url_encode(store_name);
+ store_name = msn_user_get_store_name(user); + if (store_name != NULL) + store_name = gaim_url_encode(store_name); + store_name = msn_user_get_passport(user); - return msn_user_get_passport(user);
+ /* this might be a bit of a hack, but it should prevent notification server + * disconnections for people who have buddies with insane friendly names + * who added you to their buddy list from being disconnected. Stu. */ + /* Shx: What? Isn't the store_name obtained from the server, and hence it's + * below the BUDDY_ALIAS_MAXLEN ? */ + /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're + * probably decoding the incoming store_name wrong, or something. bleh. */ + if (strlen(store_name) > BUDDY_ALIAS_MAXLEN) + store_name = msn_user_get_passport(user); @@ -467,7 +482,6 @@
msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group)
userlist->groups = g_list_remove(userlist->groups, group);
- msn_group_destroy(group);
@@ -554,7 +568,10 @@
group = msn_userlist_find_group_with_id(userlist, group_id);
msn_userlist_remove_group(userlist, group);
+ msn_group_destroy(group); @@ -631,13 +648,6 @@
store_name = (user != NULL) ? get_store_name(user) : who;
- /* this might be a bit of a hack, but it should prevent notification server
- * disconnections for people who have buddies with insane friendly names
- * who added you to their buddy list from being disconnected. Stu. */
- /* ... No, that sentence didn't parse for me either. Stu. */
- if (strlen(store_name) > BUDDY_ALIAS_MAXLEN)
/* Then request the add to the server. */