--- a/src/protocols/msn/msn.c Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/msn.c Tue Feb 22 10:16:16 2005 -0500
@@ -338,7 +338,6 @@
/* TODO: This might move somewhere else, after USR might be */
swboard->chat_id = session->conv_seq++;
swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
- swboard->flag = MSN_SB_FLAG_IM;
gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
gaim_account_get_username(buddy->account), NULL, GAIM_CBFLAGS_NONE, TRUE);
@@ -697,7 +696,7 @@
session = gc->proto_data;
- swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM);
+ swboard = msn_session_get_swboard(session, who); msn_switchboard_send_msg(swboard, msg, TRUE);
@@ -753,7 +752,7 @@
return MSN_TYPING_SEND_TIMEOUT;
- swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM);
+ swboard = msn_session_find_swboard(session, who); if (swboard == NULL || !msn_switchboard_can_send(swboard))
@@ -1056,7 +1055,7 @@
session = gc->proto_data;
- swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
+ swboard = msn_session_find_swboard_with_id(session, id); @@ -1065,7 +1064,6 @@
msn_switchboard_request(swboard);
swboard->conv = gaim_find_chat(gc, id);
- swboard->flag = MSN_SB_FLAG_IM;
msn_switchboard_request_add_user(swboard, who);
@@ -1076,16 +1074,27 @@
+ GaimConversation *conv; session = gc->proto_data;
- swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
+ swboard = msn_session_find_swboard_with_id(session, id); /* if swboard is NULL we were the only person left anyway */
msn_switchboard_close(swboard);
+ /* If other switchboards managed to associate themselves with this + * conv, make sure they know it's gone! */ + while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) @@ -1100,7 +1109,7 @@
account = gaim_connection_get_account(gc);
session = gc->proto_data;
- swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM);
+ swboard = msn_session_find_swboard_with_id(session, id); @@ -1193,10 +1202,11 @@
+ GaimConversation *conv; session = gc->proto_data;
- swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM);
+ swboard = msn_session_find_swboard(session, who); * Don't perform an assertion here. If swboard is NULL, then the
@@ -1206,10 +1216,20 @@
if (!(swboard->flag & MSN_SB_FLAG_FT))
msn_switchboard_close(swboard);
+ /* If other switchboards managed to associate themselves with this + * conv, make sure they know it's gone! */ + while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) --- a/src/protocols/msn/session.c Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/session.c Tue Feb 22 10:16:16 2005 -0500
@@ -45,6 +45,7 @@
gaim_account_get_username(account), NULL);
session->protocol_ver = 9;
@@ -144,8 +145,7 @@
/* TODO: This must go away when conversation is redesigned */
-msn_session_find_swboard(MsnSession *session, const char *username,
+msn_session_find_swboard(MsnSession *session, const char *username) @@ -158,8 +158,7 @@
- if ((swboard->im_user != NULL) &&
- !strcmp(username, swboard->im_user) && (swboard->flag & flag))
+ if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) @@ -167,8 +166,28 @@
-msn_session_find_swboard_with_id(const MsnSession *session, int chat_id,
+msn_session_find_swboard_with_conv(MsnSession *session, GaimConversation *conv) + g_return_val_if_fail(session != NULL, NULL); + g_return_val_if_fail(conv != NULL, NULL); + for (l = session->switches; l != NULL; l = l->next) + MsnSwitchBoard *swboard; + if (swboard->conv == conv) +msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) @@ -181,7 +200,7 @@
- if ((swboard->chat_id == chat_id) && (swboard->flag & flag))
+ if (swboard->chat_id == chat_id) @@ -189,18 +208,16 @@
-msn_session_get_swboard(MsnSession *session, const char *username,
+msn_session_get_swboard(MsnSession *session, const char *username) - swboard = msn_session_find_swboard(session, username, flag);
+ swboard = msn_session_find_swboard(session, username); swboard = msn_switchboard_new(session);
swboard->im_user = g_strdup(username);
msn_switchboard_request(swboard);
msn_switchboard_request_add_user(swboard, username);
--- a/src/protocols/msn/session.h Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/session.h Tue Feb 22 10:16:16 2005 -0500
@@ -160,36 +160,43 @@
* @param session The MSN session.
* @param username The username to search for.
- * @param flag The flag of the switchboard.
* @return The switchboard, if found.
MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
- const char *username, MsnSBFlag flag);
+ * Finds a switchboard with the given conversation. + * @param session The MSN session. + * @param conv The conversation to search for. + * @return The switchboard, if found. +MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, + GaimConversation *conv); * Finds a switchboard with the given chat ID.
* @param session The MSN session.
* @param chat_id The chat ID to search for.
- * @param flag The flag of the switchboard.
* @return The switchboard, if found.
MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session,
- int chat_id, MsnSBFlag flag);
* Returns a switchboard to communicate with certain username.
* @param session The MSN session.
* @param username The username to search for.
- * @param flag The flag of the switchboard.
* @return The switchboard.
MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
- const char *username, MsnSBFlag flag);
* Sets an error for the MSN session.
--- a/src/protocols/msn/slplink.c Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/slplink.c Tue Feb 22 10:16:16 2005 -0500
@@ -162,11 +162,8 @@
msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
- if (slplink->slp_calls == NULL)
- if (slplink->swboard != NULL)
- slplink->swboard->flag |= MSN_SB_FLAG_FT;
+ if (slplink->swboard != NULL) + slplink->swboard->flag |= MSN_SB_FLAG_FT; slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall);
@@ -233,8 +230,7 @@
if (slplink->swboard == NULL)
slplink->swboard = msn_session_get_swboard(slplink->session,
if (slplink->swboard == NULL)
--- a/src/protocols/msn/switchboard.c Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/switchboard.c Tue Feb 22 10:16:16 2005 -0500
@@ -867,20 +867,14 @@
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);
- swboard->flag |= MSN_SB_FLAG_IM;
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));
- swboard->flag |= MSN_SB_FLAG_IM;
--- a/src/protocols/msn/switchboard.h Tue Feb 22 10:08:27 2005 -0500
+++ b/src/protocols/msn/switchboard.h Tue Feb 22 10:16:16 2005 -0500
@@ -54,8 +54,7 @@
- MSN_SB_FLAG_IM = 0x01, /**< This switchboard is used for instant messaging. */
- MSN_SB_FLAG_FT = 0x02, /**< This switchboard is used for file transfer. */
+ MSN_SB_FLAG_FT = 0x01, /**< This switchboard is being used for file transfer. */