--- a/src/protocols/msn/httpconn.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/httpconn.c Thu Feb 03 14:47:26 2005 -0500
@@ -80,6 +80,40 @@
+msn_httpconn_proxy_auth(MsnHttpConn *httpconn) + const char *username, *password; + account = httpconn->session->account; + if (gaim_account_get_proxy_info(account) == NULL) + gpi = gaim_global_proxy_get_info(); + gpi = gaim_account_get_proxy_info(account); + if (gpi == NULL || !(gaim_proxy_info_get_type(gpi) == GAIM_PROXY_HTTP || + gaim_proxy_info_get_type(gpi) == GAIM_PROXY_USE_ENVVAR)) + username = gaim_proxy_info_get_username(gpi); + password = gaim_proxy_info_get_password(gpi); + if (username != NULL) { + auth = g_strdup_printf("%s:%s", username, password ? password : ""); + tmp = gaim_base64_encode(auth, strlen(auth)); + auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp); write_raw(MsnHttpConn *httpconn, const char *header,
const char *body, size_t body_len)
@@ -129,6 +163,7 @@
msn_httpconn_poll(MsnHttpConn *httpconn)
g_return_if_fail(httpconn != NULL);
@@ -139,6 +174,8 @@
+ auth = msn_httpconn_proxy_auth(httpconn); header = g_strdup_printf(
"POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n"
@@ -146,13 +183,18 @@
"Proxy-Connection: Keep-Alive\r\n"
"Connection: Keep-Alive\r\n"
"Content-Type: application/x-msn-messenger\r\n"
httpconn->full_session_id,
r = write_raw(httpconn, header, NULL, -1);
@@ -172,10 +214,18 @@
+ g_return_val_if_fail(httpconn != NULL, TRUE); gaim_debug_info("msn", "polling from %s\n", httpconn->session_id);
+ if ((httpconn->host == NULL) || (httpconn->full_session_id == NULL)) + gaim_debug_warning("msn", "Attempted HTTP poll before session is established\n"); msn_httpconn_poll(httpconn);
@@ -296,7 +346,9 @@
if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len,
&result_msg, &result_len, &error))
- /* We must wait for more input */
+ /* We must wait for more input, or something went wrong */ + msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); @@ -421,6 +473,7 @@
const char *server_types[] = { "NS", "SB" };
@@ -469,10 +522,18 @@
/* The rest of the times servconn->host is the gateway host. */
+ if (host == NULL || httpconn->full_session_id == NULL) + gaim_debug_warning("msn", "Attempted HTTP write before session is established\n"); params = g_strdup_printf("SessionID=%s",
httpconn->full_session_id);
+ auth = msn_httpconn_proxy_auth(httpconn); header = g_strdup_printf(
"POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n"
@@ -480,6 +541,7 @@
"Proxy-Connection: Keep-Alive\r\n"
"Connection: Keep-Alive\r\n"
"Content-Type: application/x-msn-messenger\r\n"
@@ -487,10 +549,14 @@
r = write_raw(httpconn, header, data, size);
--- a/src/protocols/msn/msn.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/msn.c Thu Feb 03 14:47:26 2005 -0500
@@ -645,7 +645,8 @@
if (strcmp(username, gaim_account_get_username(account)))
gaim_account_set_username(account, username);
- msn_session_connect(session, host, port, http_method);
+ if (!msn_session_connect(session, host, port, http_method)) + gaim_connection_error(gc, _("Failed to connect to server.")); @@ -713,7 +714,8 @@
format = msn_message_get_attr(msg, "X-MMS-IM-Format");
msn_parse_format(format, &pre, &post);
- body_str = g_strdup_printf("%s%s%s", pre, body_enc, post);
+ body_str = g_strdup_printf("%s%s%s", pre ? pre : "", + body_enc ? body_enc : "", post ? post : ""); --- a/src/protocols/msn/nexus.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/nexus.c Thu Feb 03 14:47:26 2005 -0500
@@ -93,8 +93,6 @@
g_return_if_fail(nexus != NULL);
@@ -102,16 +100,9 @@
session = nexus->session;
g_return_if_fail(session != NULL);
- account = session->account;
- g_return_if_fail(account != NULL);
- gc = gaim_account_get_connection(account);
- g_return_if_fail(gc != NULL);
msn_session_set_error(session, MSN_ERROR_AUTH, _("Unable to connect"));
- msn_nexus_destroy(nexus);
+ /* the above line will result in nexus being destroyed, so we don't want + * to destroy it here, or we'd crash */ --- a/src/protocols/msn/notification.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/notification.c Thu Feb 03 14:47:26 2005 -0500
@@ -269,6 +269,30 @@
+usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) + MsnErrorType msnerr = 0; + msnerr = MSN_ERROR_SERV_UNAVAILABLE; + msnerr = MSN_ERROR_AUTH; + msn_session_set_error(cmdproc->session, msnerr, NULL); ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -322,6 +346,9 @@
g_return_if_fail(notification != NULL);
+ if (!notification->in_use) msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL);
msn_notification_disconnect(notification);
@@ -975,7 +1002,8 @@
swboard->im_user = g_strdup(cmd->params[4]);
/* msn_switchboard_add_user(swboard, cmd->params[4]); */
- msn_switchboard_connect(swboard, host, port);
+ if (!msn_switchboard_connect(swboard, host, port)) + msn_switchboard_destroy(swboard); @@ -1319,15 +1347,7 @@
msn_table_add_error(cbs_table, "REG", reg_error);
msn_table_add_error(cbs_table, "RMG", rmg_error);
/* msn_table_add_error(cbs_table, "REA", rea_error); */
- /* I received a '500' error from the notification server just now.
- * I think this means 'Service temporarily unavailable' or similar,
- * in response to a USR command. We should report this instead of
- * 'Error reading from notification server'.
- * I'm not going to implement this right now, because we're string
- * frozen (and I'd probably break something anyway), so I'll put this
- * here as a reminder, or something. Stu. */
- /* msn_table_add_error(cbs_table, "USR", usr_error); */
+ msn_table_add_error(cbs_table, "USR", usr_error); msn_table_add_msg_type(cbs_table,
--- a/src/protocols/msn/servconn.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/servconn.c Thu Feb 03 14:47:26 2005 -0500
@@ -212,7 +212,8 @@
if (!servconn->httpconn->connected)
- msn_httpconn_connect(servconn->httpconn, host, port);
+ if (!msn_httpconn_connect(servconn->httpconn, host, port)) servconn->connected = TRUE;
servconn->httpconn->virgin = TRUE;
--- a/src/protocols/msn/session.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/session.c Thu Feb 03 14:47:26 2005 -0500
@@ -284,7 +284,7 @@
- gc = session->account->gc;
+ gc = gaim_account_get_connection(session->account); @@ -302,6 +302,11 @@
msg = g_strdup(_("You have signed on from another location."));
+ case MSN_ERROR_SERV_UNAVAILABLE: + msg = g_strdup(_("The MSN servers are temporarily " + "unavailable. Please wait and try " case MSN_ERROR_SERV_DOWN:
msg = g_strdup(_("The MSN servers are going down "
--- a/src/protocols/msn/session.h Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/session.h Thu Feb 03 14:47:26 2005 -0500
@@ -51,7 +51,8 @@
+ MSN_ERROR_SERV_UNAVAILABLE --- a/src/protocols/msn/switchboard.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/switchboard.c Thu Feb 03 14:47:26 2005 -0500
@@ -408,7 +408,8 @@
format = msn_message_get_attr(msg, "X-MMS-IM-Format");
msn_parse_format(format, &pre, &post);
- body_str = g_strdup_printf("%s%s%s", pre, body_enc, post);
+ body_str = g_strdup_printf("%s%s%s", pre ? pre : "", + body_enc ? body_enc : "", post ? post : ""); @@ -843,14 +844,15 @@
if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL)
- char *pre_format, *post_format;
- msn_parse_format(value, &pre_format, &post_format);
+ msn_parse_format(value, &pre, &post); - body_final = g_strdup_printf("%s%s%s", pre_format, body_enc, post_format);
+ body_final = g_strdup_printf("%s%s%s", pre ? pre : "", + body_enc ? body_enc : "", post ? post : "");
@@ -1068,7 +1070,8 @@
msn_parse_socket(cmd->params[2], &host, &port);
- msn_switchboard_connect(swboard, host, port);
+ if (!msn_switchboard_connect(swboard, host, port)) + msn_switchboard_destroy(swboard); --- a/src/protocols/msn/userlist.c Thu Feb 03 14:44:44 2005 -0500
+++ b/src/protocols/msn/userlist.c Thu Feb 03 14:47:26 2005 -0500
@@ -669,6 +669,6 @@
+ msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, new_group_name); msn_userlist_rem_buddy(userlist, who, MSN_LIST_FL, old_group_name);
- msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, new_group_name);