--- a/src/protocols/msn/msn.c Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/msn.c Wed Feb 16 15:13:12 2005 -0500
@@ -338,6 +338,7 @@
/* 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);
@@ -696,7 +697,7 @@
session = gc->proto_data;
- swboard = msn_session_get_swboard(session, who);
+ swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM); msn_switchboard_send_msg(swboard, msg, TRUE);
@@ -752,7 +753,7 @@
return MSN_TYPING_SEND_TIMEOUT;
- swboard = msn_session_find_swboard(session, who);
+ swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM); if (swboard == NULL || !msn_switchboard_can_send(swboard))
@@ -1055,7 +1056,7 @@
session = gc->proto_data;
- swboard = msn_session_find_switch_with_id(session, id);
+ swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM); @@ -1064,6 +1065,7 @@
msn_switchboard_request(swboard);
swboard->conv = gaim_find_chat(gc, id);
+ swboard->flag = MSN_SB_FLAG_IM; msn_switchboard_request_add_user(swboard, who);
@@ -1077,7 +1079,7 @@
session = gc->proto_data;
- swboard = msn_session_find_switch_with_id(session, id);
+ swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM); /* if swboard is NULL we were the only person left anyway */
@@ -1098,7 +1100,7 @@
account = gaim_connection_get_account(gc);
session = gc->proto_data;
- swboard = msn_session_find_switch_with_id(session, id);
+ swboard = msn_session_find_swboard_with_id(session, id, MSN_SB_FLAG_IM); @@ -1134,14 +1136,17 @@
msn_keepalive(GaimConnection *gc)
session = gc->proto_data;
- cmdproc = session->notification->cmdproc;
+ if (!session->http_method) - if (!session->http_method)
+ cmdproc = session->notification->cmdproc; msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL);
@@ -1191,17 +1196,20 @@
session = gc->proto_data;
- swboard = msn_session_find_swboard(session, who);
+ swboard = msn_session_find_swboard(session, who, MSN_SB_FLAG_IM); - * Don't perform an assertion here. It swboard is NULL, then the
+ * Don't perform an assertion here. If swboard is NULL, then the * switchboard was either closed by the other party, or the person
- msn_switchboard_close(swboard);
+ if (!(swboard->flag & MSN_SB_FLAG_FT)) + msn_switchboard_close(swboard); --- a/src/protocols/msn/session.c Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/session.c Wed Feb 16 15:13:12 2005 -0500
@@ -144,7 +144,8 @@
/* 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, @@ -157,16 +158,17 @@
- if (swboard->im_user != NULL)
- if (!strcmp(username, swboard->im_user))
+ if ((swboard->im_user != NULL) && + !strcmp(username, swboard->im_user) && (swboard->flag & flag)) -msn_session_find_switch_with_id(const MsnSession *session, int chat_id)
+msn_session_find_swboard_with_id(const MsnSession *session, int chat_id, @@ -179,7 +181,7 @@
- if (swboard->chat_id == chat_id)
+ if ((swboard->chat_id == chat_id) && (swboard->flag & flag)) @@ -187,16 +189,18 @@
-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);
+ swboard = msn_session_find_swboard(session, username, flag); 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 Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/session.h Wed Feb 16 15:13:12 2005 -0500
@@ -155,21 +155,41 @@
void msn_session_disconnect(MsnSession *session);
+ * Finds a switchboard with the given username. + * @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 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_switch_with_id(const MsnSession *session,
+MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, + int chat_id, MsnSBFlag flag); -MsnSwitchBoard *msn_session_find_swboard(MsnSession *session,
+ * 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/slp.c Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/slp.c Wed Feb 16 15:13:12 2005 -0500
@@ -732,6 +732,13 @@
session = cmdproc->servconn->session;
slplink = msn_session_get_slplink(session, msg->remote_user);
+ if (slplink->swboard == NULL) + /* We will need this in order to change it's flags. */ + slplink->swboard = (MsnSwitchBoard *)cmdproc->data; + slplink->swboard->slplink = slplink; msn_slplink_process_msg(slplink, msg);
--- a/src/protocols/msn/slpcall.c Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/slpcall.c Wed Feb 16 15:13:12 2005 -0500
@@ -46,7 +46,7 @@
/**************************************************************************
**************************************************************************/
@@ -59,8 +59,8 @@
slpcall = g_new0(MsnSlpCall, 1);
slpcall->slplink = slplink;
- g_list_append(slplink->slp_calls, slpcall);
+ msn_slplink_add_slpcall(slplink, slpcall); slpcall->timer = gaim_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall);
@@ -86,8 +86,7 @@
if (slpcall->data_info != NULL)
g_free(slpcall->data_info);
- slpcall->slplink->slp_calls =
- g_list_remove(slpcall->slplink->slp_calls, slpcall);
+ msn_slplink_remove_slpcall(slpcall->slplink, slpcall); for (e = slpcall->slplink->slp_msgs; e != NULL; )
--- a/src/protocols/msn/slplink.c Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/slplink.c Wed Feb 16 15:13:12 2005 -0500
@@ -54,6 +54,10 @@
+/************************************************************************** + **************************************************************************/ msn_slplink_new(MsnSession *session, const char *username)
@@ -155,6 +159,31 @@
+msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) + if (slplink->slp_calls == NULL) + if (slplink->swboard != NULL) + slplink->swboard->flag |= MSN_SB_FLAG_FT; + slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); +msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) + slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); + /* The slplink has no slpcalls in it, maybe we should destroy it. */ + if (slplink->slp_calls == NULL) + if (slplink->swboard != NULL) + slplink->swboard->flag &= ~MSN_SB_FLAG_FT; msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id)
@@ -204,7 +233,8 @@
if (slplink->swboard == NULL)
slplink->swboard = msn_session_get_swboard(slplink->session,
if (slplink->swboard == NULL)
--- a/src/protocols/msn/slplink.h Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/slplink.h Wed Feb 16 15:13:12 2005 -0500
@@ -61,6 +61,8 @@
MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username);
MsnSlpSession *msn_slplink_find_slp_session(MsnSlpLink *slplink,
+void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); +void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink,
MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id);
--- a/src/protocols/msn/switchboard.h Wed Feb 16 14:55:26 2005 -0500
+++ b/src/protocols/msn/switchboard.h Wed Feb 16 15:13:12 2005 -0500
@@ -50,6 +50,16 @@
+ MSN_SB_FLAG_IM = 0x01, /**< This switchboard is used for instant messaging. */ + MSN_SB_FLAG_FT = 0x02, /**< This switchboard is used for file transfer. */ * A place where a bunch of users send messages to the rest of the users.
@@ -61,6 +71,7 @@