--- a/src/protocols/msn/cmdproc.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/cmdproc.c Thu Jan 06 21:48:07 2005 -0500
@@ -43,15 +43,13 @@
- if (cmdproc->last_trans != NULL)
- g_free(cmdproc->last_trans);
while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL)
msn_transaction_destroy(trans);
g_queue_free(cmdproc->txqueue);
msn_history_destroy(cmdproc->history);
@@ -59,11 +57,8 @@
- while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL &&
+ while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) msn_cmdproc_send_trans(cmdproc, trans);
@@ -109,19 +104,17 @@
g_return_if_fail(cmdproc != NULL);
- g_return_if_fail(cmdproc->ready);
g_return_if_fail(trans != NULL);
servconn = cmdproc->servconn;
+ if (!servconn->connected) msn_history_add(cmdproc->history, trans);
data = msn_transaction_to_string(trans);
- if (cmdproc->last_trans != NULL)
- g_free(cmdproc->last_trans);
- cmdproc->last_trans = g_strdup(data);
show_debug_cmd(cmdproc, FALSE, data);
@@ -153,11 +146,13 @@
g_return_if_fail(cmdproc != NULL);
- g_return_if_fail(cmdproc->ready);
g_return_if_fail(command != NULL);
servconn = cmdproc->servconn;
+ if (!servconn->connected) @@ -189,9 +184,11 @@
g_return_if_fail(cmdproc != NULL);
- g_return_if_fail(cmdproc->ready);
g_return_if_fail(command != NULL);
+ if (!cmdproc->servconn->connected) trans = g_new0(MsnTransaction, 1);
trans->command = g_strdup(command);
@@ -317,19 +314,8 @@
- /* TODO this is really ugly */
- /* Since commands have not stored payload and we need it for pendent
- * commands at the time we process again the same command we will try
- * to read again the payload of payload_len size but we will actually
- * read sometime else, and reading from server synchronization goes to
- /* Now we store the payload in the command when we queue them :D */
if (trans != NULL && trans->pendent_cmd != NULL)
- msn_transaction_unqueue_cmd(trans, cmdproc);
+ msn_transaction_unqueue_cmd(trans, cmdproc); @@ -344,32 +330,3 @@
msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd);
-msn_cmdproc_show_error(MsnCmdProc *cmdproc, int error)
- gaim_account_get_connection(cmdproc->session->account);
- tmp = _("Miscellaneous error"); break;
- case MSN_ERROR_SIGNOTHER:
- gc->wants_to_die = TRUE;
- tmp = _("You have signed on from another location."); break;
- case MSN_ERROR_SERVDOWN:
- tmp = _("The MSN servers are going down temporarily."); break;
- gaim_connection_error(gc, tmp);
--- a/src/protocols/msn/httpconn.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/httpconn.c Thu Jan 06 21:48:07 2005 -0500
@@ -28,7 +28,7 @@
@@ -48,6 +48,8 @@
httpconn = g_new0(MsnHttpConn, 1);
+ gaim_debug_info("msn", "new httpconn (%p)\n", httpconn); httpconn->session = servconn->session;
@@ -61,87 +63,55 @@
g_return_if_fail(httpconn != NULL);
+ gaim_debug_info("msn", "destroy httpconn (%p)\n", httpconn); msn_httpconn_disconnect(httpconn);
- if (httpconn->host != NULL)
- g_free(httpconn->host);
-show_error(MsnHttpConn *httpconn)
+write_raw(MsnHttpConn *httpconn, const char *header, + const char *body, size_t body_len)
- const char *names[] = { "Notification", "Switchboard" };
- gc = gaim_account_get_connection(httpconn->servconn->session->account);
- name = names[httpconn->servconn->type];
- switch (httpconn->servconn->cmdproc->error)
- case MSN_ERROR_CONNECT:
- tmp = g_strdup_printf(_("Unable to connect to %s server"),
- tmp = g_strdup_printf(_("Error writing to %s server"), name);
- cmd = httpconn->servconn->cmdproc->last_trans;
- tmp = g_strdup_printf(_("Error reading from %s server"), name);
- gaim_debug_info("msn", "Last command was: %s\n", cmd);
- tmp = g_strdup_printf(_("Unknown error from %s server"), name);
- if (httpconn->servconn->type == MSN_SERVER_NS)
- gaim_connection_error(gc, tmp);
- MsnSwitchBoard *swboard;
- swboard = httpconn->servconn->cmdproc->data;
- swboard->error = MSN_SB_ERROR_CONNECTION;
-write_raw(MsnHttpConn *httpconn, const void *buffer, size_t len)
ssize_t res; /* result of the write operation */
- gaim_debug_misc("msn", "Writing HTTP: {%s}\n", buffer);
+ gaim_debug_misc("msn", "Writing HTTP (header): {%s}\n", header); + buf = g_strdup_printf("%s\r\n", header); + buf = g_realloc(buf, buf_len + body_len); + memcpy(buf + buf_len, body, body_len); - res = write(httpconn->fd, buffer, len);
+ res = write(httpconn->fd, buf, buf_len); else if (errno != EAGAIN)
- httpconn->servconn->cmdproc->error = MSN_ERROR_WRITE;
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE);
@@ -149,8 +119,8 @@
msn_httpconn_poll(MsnHttpConn *httpconn)
g_return_if_fail(httpconn != NULL);
@@ -160,7 +130,7 @@
- temp = g_strdup_printf(
+ header = g_strdup_printf( "POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n"
"Accept-Language: en-us\r\n"
@@ -170,15 +140,14 @@
"Connection: Keep-Alive\r\n"
"Content-Type: application/x-msn-messenger\r\n"
- "Content-Length: 0\r\n"
+ "Content-Length: 0\r\n", httpconn->full_session_id,
- r = write_raw(httpconn, temp, strlen(temp));
+ r = write_raw(httpconn, header, NULL, -1);
@@ -224,7 +193,7 @@
gaim_debug_error("msn", "HTTP: Connection error\n");
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT); @@ -257,7 +226,9 @@
msn_httpconn_disconnect(MsnHttpConn *httpconn)
g_return_if_fail(httpconn != NULL);
- g_return_if_fail(httpconn->connected);
+ if (!httpconn->connected) gaim_timeout_remove(httpconn->timer);
@@ -302,7 +273,7 @@
gaim_debug_error("msn", "HTTP: Read error\n");
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); msn_httpconn_disconnect(httpconn);
@@ -329,7 +300,7 @@
gaim_debug_error("msn", "HTTP: Special error\n");
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); msn_httpconn_disconnect(httpconn);
@@ -341,6 +312,7 @@
gaim_debug_info("msn", "HTTP: nothing to do here\n");
g_free(httpconn->rx_buf);
@@ -351,6 +323,7 @@
+ g_free(servconn->rx_buf); servconn->rx_buf = result_msg;
servconn->rx_len = result_len;
@@ -425,10 +398,10 @@
httpconn->queue = g_list_remove(httpconn->queue, queue_data);
msn_httpconn_write(queue_data->httpconn,
- g_free(queue_data->buffer);
+ g_free(queue_data->data); @@ -438,22 +411,21 @@
-msn_httpconn_write(MsnHttpConn *httpconn, const char *buf, size_t size)
+msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t size)
const char *server_types[] = { "NS", "SB" };
size_t r; /* result of the write operation */
/* TODO: remove http data from servconn */
g_return_val_if_fail(httpconn != NULL, 0);
- g_return_val_if_fail(buf != NULL, 0);
+ g_return_val_if_fail(data != NULL, 0); g_return_val_if_fail(size > 0, 0);
servconn = httpconn->servconn;
@@ -463,7 +435,7 @@
MsnHttpQueueData *queue_data = g_new0(MsnHttpQueueData, 1);
queue_data->httpconn = httpconn;
- queue_data->buffer = g_memdup(buf, size);
+ queue_data->data = g_memdup(data, size); httpconn->queue = g_list_append(httpconn->queue, queue_data);
@@ -495,7 +467,7 @@
httpconn->full_session_id);
- temp = g_strdup_printf(
+ header = g_strdup_printf( "POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n"
"Accept-Language: en-us\r\n"
@@ -505,8 +477,7 @@
"Connection: Keep-Alive\r\n"
"Content-Type: application/x-msn-messenger\r\n"
- "Content-Length: %d\r\n"
+ "Content-Length: %d\r\n", @@ -514,15 +485,9 @@
- temp = g_realloc(temp, len + size + 1);
- memcpy(temp + len, buf, size);
+ r = write_raw(httpconn, header, data, size); - r = write_raw(httpconn, temp, len);
@@ -541,7 +506,7 @@
@@ -604,12 +569,12 @@
if ((s = strstr(buf, "\r\n\r\n")) == NULL)
- headers = g_strndup(buf, s - buf);
+ header = g_strndup(buf, s - buf); body_len = size - (body_start - buf);
- if ((s = strstr(headers, "Content-Length: ")) != NULL)
+ if ((s = strstr(header, "Content-Length: ")) != NULL) @@ -617,7 +582,7 @@
if ((c = strchr(s, '\r')) == NULL)
@@ -628,7 +593,7 @@
gaim_debug_warning("msn",
@@ -640,14 +605,16 @@
- body = g_memdup(body_start, body_len);
+ body = g_malloc0(body_len + 1); + memcpy(body, body_start, body_len); - gaim_debug_misc("msn", "Incoming HTTP buffer: {%s\r\n\r\n%s}\n", headers, body);
+ gaim_debug_misc("msn", "Incoming HTTP buffer (header): {%s\r\n}\n", /* Now we should be able to process the data. */
- if ((s = strstr(headers, "X-MSN-Messenger: ")) != NULL)
+ if ((s = strstr(header, "X-MSN-Messenger: ")) != NULL) char *full_session_id, *gw_ip, *session_action;
@@ -659,10 +626,12 @@
if ((c = strchr(s, '\r')) == NULL)
- gaim_connection_error(gc, "Malformed X-MSN-Messenger field.");
+ msn_session_set_error(httpconn->session, + MSN_ERROR_HTTP_MALFORMED, NULL); gaim_debug_error("msn", "Malformed X-MSN-Messenger field.\n{%s}",
@@ -731,7 +700,7 @@
--- a/src/protocols/msn/msn.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/msn.c Thu Jan 06 21:48:07 2005 -0500
@@ -631,22 +631,23 @@
host = gaim_account_get_string(account, "server", MSN_SERVER);
- port = gaim_account_get_int(account, "port", MSN_PORT);
+ port = gaim_account_get_int(account, "port", MSN_PORT); - session = msn_session_new(account, host, port, http_method);
+ session = msn_session_new(account); gc->proto_data = session;
gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_FORMATTING_WBFO | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_FONTSIZE | GAIM_CONNECTION_NO_URLDESC;
- gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS);
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_START); /* Hmm, I don't like this. */
+ /* XXX shx: Me neither */ username = msn_normalize(account, gaim_account_get_username(account));
if (strcmp(username, gaim_account_get_username(account)))
gaim_account_set_username(account, username);
- msn_session_connect(session);
+ msn_session_connect(session, host, port, http_method); @@ -698,14 +699,7 @@
session = gc->proto_data;
swboard = msn_session_get_swboard(session, who);
- if (!g_queue_is_empty(swboard->im_queue) || swboard->empty)
- msn_switchboard_queue_msg(swboard, msg);
- msn_switchboard_send_msg(swboard, msg);
+ msn_switchboard_send_msg(swboard, msg, TRUE); @@ -760,13 +754,7 @@
swboard = msn_session_find_swboard(session, who);
- if (!g_queue_is_empty(swboard->im_queue))
+ if (swboard == NULL || !msn_switchboard_can_send(swboard)) msg = msn_message_new(MSN_MSG_TYPING);
@@ -776,7 +764,7 @@
gaim_account_get_username(account));
msn_message_set_bin_data(msg, "\r\n", 2);
- msn_switchboard_send_msg(swboard, msg);
+ msn_switchboard_send_msg(swboard, msg, FALSE); msn_message_destroy(msg);
@@ -1124,7 +1112,7 @@
msg = msn_message_new_plain(msgtext);
msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
- msn_switchboard_send_msg(swboard, msg);
+ msn_switchboard_send_msg(swboard, msg, FALSE); msn_message_destroy(msg);
@@ -1143,6 +1131,7 @@
session = gc->proto_data;
cmdproc = session->notification->cmdproc;
if (!session->http_method)
--- a/src/protocols/msn/nexus.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/nexus.c Thu Jan 06 21:48:07 2005 -0500
@@ -26,6 +26,38 @@
#include "notification.h"
/**************************************************************************
+ **************************************************************************/ +msn_nexus_new(MsnSession *session) + nexus = g_new0(MsnNexus, 1); + nexus->session = session; + nexus->challenge_data = g_hash_table_new_full(g_str_hash, g_str_equal, +msn_nexus_destroy(MsnNexus *nexus) + if (nexus->login_host != NULL) + g_free(nexus->login_host); + if (nexus->login_path != NULL) + g_free(nexus->login_path); + if (nexus->challenge_data != NULL) + g_hash_table_destroy(nexus->challenge_data); +/************************************************************************** **************************************************************************/
@@ -76,7 +108,7 @@
gc = gaim_account_get_connection(account);
g_return_if_fail(gc != NULL);
- gaim_connection_error(gc, _("Unable to connect to server"));
+ msn_session_set_error(session, MSN_ERROR_AUTH, _("Unable to connect")); msn_nexus_destroy(nexus);
@@ -100,6 +132,8 @@
session = nexus->session;
g_return_if_fail(session != NULL);
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); g_strdup(gaim_url_encode(gaim_account_get_username(session->account)));
@@ -191,14 +225,15 @@
else if (strstr(buffer, "HTTP/1.1 401 Unauthorized") != NULL)
if ((error = strstr(buffer, "WWW-Authenticate")) != NULL)
if ((error = strstr(error, "cbtxt=")) != NULL)
error += strlen("cbtxt=");
if ((c = strchr(error, '\n')) == NULL)
@@ -210,16 +245,7 @@
- gc = gaim_account_get_connection(session->account);
- gaim_connection_error(gc,
- _("Unknown error when attempting to authorize with "
- gaim_connection_error(gc, error);
+ msn_session_set_error(session, MSN_ERROR_AUTH, error); else if (strstr(buffer, "HTTP/1.1 200 OK"))
@@ -264,6 +290,10 @@
+/************************************************************************** + **************************************************************************/ nexus_connect_cb(gpointer data, GaimSslConnection *gsc,
@@ -282,6 +312,8 @@
session = nexus->session;
g_return_if_fail(session != NULL);
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH); request_str = g_strdup_printf("GET /rdr/pprdr.asp\r\n\r\n");
if ((s = gaim_ssl_write(gsc, request_str, strlen(request_str))) <= 0)
@@ -332,38 +364,6 @@
-/**************************************************************************
- **************************************************************************/
-msn_nexus_new(MsnSession *session)
- nexus = g_new0(MsnNexus, 1);
- nexus->session = session;
- nexus->challenge_data = g_hash_table_new_full(g_str_hash, g_str_equal,
-msn_nexus_destroy(MsnNexus *nexus)
- if (nexus->login_host != NULL)
- g_free(nexus->login_host);
- if (nexus->login_path != NULL)
- g_free(nexus->login_path);
- if (nexus->challenge_data != NULL)
- g_hash_table_destroy(nexus->challenge_data);
msn_nexus_connect(MsnNexus *nexus)
--- a/src/protocols/msn/notification.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/notification.c Thu Jan 06 21:48:07 2005 -0500
@@ -32,13 +32,12 @@
-#define BUDDY_ALIAS_MAXLEN 388
static MsnTable *cbs_table;
/**************************************************************************
**************************************************************************/
destroy_cb(MsnServConn *servconn)
@@ -61,7 +60,7 @@
notification = g_new0(MsnNotification, 1);
notification->session = session;
- notification->servconn = servconn = msn_servconn_new(session, MSN_SERVER_NS);
+ notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); msn_servconn_set_destroy_cb(servconn, destroy_cb);
notification->cmdproc = servconn->cmdproc;
@@ -74,20 +73,19 @@
msn_notification_destroy(MsnNotification *notification)
- if (notification->destroying)
+ notification->cmdproc->data = NULL; - notification->destroying = TRUE;
+ msn_servconn_set_destroy_cb(notification->servconn, NULL); msn_servconn_destroy(notification->servconn);
- notification->session->notification = NULL;
/**************************************************************************
**************************************************************************/
connect_cb(MsnServConn *servconn)
@@ -113,17 +111,11 @@
vers = g_strjoinv(" ", a);
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); msn_cmdproc_send(cmdproc, "VER", "%s", vers);
- if (session->user == NULL)
- session->user = msn_user_new(session->userlist,
- gaim_account_get_username(account), NULL);
@@ -155,6 +147,7 @@
/**************************************************************************
**************************************************************************/
group_error_helper(MsnSession *session, const char *msg, int group_id, int error)
@@ -198,6 +191,7 @@
/**************************************************************************
**************************************************************************/
msn_got_login_params(MsnSession *session, const char *login_params)
@@ -205,6 +199,8 @@
cmdproc = session->notification->cmdproc;
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); msn_cmdproc_send(cmdproc, "USR", "TWN S %s", login_params);
@@ -220,31 +216,6 @@
-inf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
- account = cmdproc->session->account;
- gc = gaim_account_get_connection(account);
- if (strcmp(cmd->params[1], "MD5"))
- msn_cmdproc_show_error(cmdproc, MSN_ERROR_MISC);
- msn_cmdproc_send(cmdproc, "USR", "MD5 I %s",
- gaim_account_get_username(account));
- gaim_connection_update_progress(gc, _("Requesting to send password"),
usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -255,33 +226,22 @@
account = session->account;
gc = gaim_account_get_connection(account);
- * We're either getting the passport connect info (if we're on
- * MSNP8 or higher), or a challenge request (MSNP7 and lower).
if (!g_ascii_strcasecmp(cmd->params[1], "OK"))
const char *friendly = gaim_url_decode(cmd->params[3]);
gaim_connection_set_display_name(gc, friendly);
- msn_cmdproc_send(cmdproc, "SYN", "%s", "0");
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN);
- gaim_connection_update_progress(gc, _("Retrieving buddy list"),
+ msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); else if (!g_ascii_strcasecmp(cmd->params[1], "TWN"))
+ /* Passport authentication */ char **elems, **cur, **tokens;
- /* Passport authentication */
session->nexus = msn_nexus_new(session);
/* Parse the challenge data. */
@@ -298,39 +258,9 @@
- msn_nexus_connect(session->nexus);
- gaim_connection_update_progress(gc, _("Password sent"),
- else if (!g_ascii_strcasecmp(cmd->params[1], "MD5"))
+ msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); - challenge = cmd->params[3];
- password = gaim_account_get_password(account);
- md5_append(&st, (const md5_byte_t *)challenge, strlen(challenge));
- md5_append(&st, (const md5_byte_t *)password, strlen(password));
- for (i = 0; i < 16; i++)
- g_snprintf(buf + (i*2), 3, "%02x", di[i]);
- msn_cmdproc_send(cmdproc, "USR", "MD5 S %s", buf);
- gaim_connection_update_progress(gc, _("Password sent"),
+ msn_nexus_connect(session->nexus); @@ -359,7 +289,8 @@
- msn_cmdproc_show_error(cmdproc, MSN_ERROR_MISC);
+ msn_session_set_error(session, MSN_ERROR_UNSUPORTED_PROTOCOL, @@ -371,13 +302,15 @@
/**************************************************************************
**************************************************************************/
out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
if (!g_ascii_strcasecmp(cmd->params[0], "OTH"))
- msn_cmdproc_show_error(cmdproc, MSN_ERROR_SIGNOTHER);
+ msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, else if (!g_ascii_strcasecmp(cmd->params[0], "SSD"))
- msn_cmdproc_show_error(cmdproc, MSN_ERROR_SERVDOWN);
+ msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); @@ -393,6 +326,7 @@
/**************************************************************************
**************************************************************************/
msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
@@ -431,6 +365,7 @@
/**************************************************************************
**************************************************************************/
chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -464,6 +399,7 @@
/**************************************************************************
**************************************************************************/
add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -873,22 +809,13 @@
if (cmd->param_count == 2)
* This can happen if we sent a SYN with an up-to-date
* buddy list revision, but we send 0 to get a full list.
- _("Your MSN buddy list for %s is temporarily unavailable. "
- "Please wait and try again."),
- gaim_account_get_username(session->account));
- gaim_connection_error(gaim_account_get_connection(session->account),
+ msn_session_set_error(cmdproc->session, MSN_ERROR_BAD_BLIST, NULL); @@ -915,6 +842,7 @@
/**************************************************************************
**************************************************************************/
url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -1017,6 +945,7 @@
/**************************************************************************
**************************************************************************/
rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -1055,7 +984,8 @@
if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS"))
- msn_cmdproc_show_error(cmdproc, MSN_ERROR_MISC);
+ /* Maybe we can have a generic bad command error. */ + gaim_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); @@ -1064,19 +994,6 @@
if (!strcmp(cmd->params[1], "SB"))
gaim_debug_error("msn", "This shouldn't be handled here.\n");
- swboard = cmd->trans->data;
- msn_switchboard_set_auth_key(swboard, cmd->params[4]);
- if (session->http_method)
- msn_switchboard_connect(swboard, host, port);
else if (!strcmp(cmd->params[1], "NS"))
@@ -1084,6 +1001,9 @@
session = cmdproc->session;
+ if (!session->logged_in) + msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); msn_notification_connect(session->notification, host, port);
@@ -1093,6 +1013,7 @@
/**************************************************************************
**************************************************************************/
profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
@@ -1342,6 +1263,7 @@
/**************************************************************************
**************************************************************************/
msn_notification_init(void)
@@ -1359,7 +1281,6 @@
msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd);
msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd);
msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd);
- msn_table_add_cmd(cbs_table, "INF", "INF", inf_cmd);
msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd);
msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd);
/* msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); */
--- a/src/protocols/msn/servconn.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/servconn.c Thu Jan 06 21:48:07 2005 -0500
@@ -27,6 +27,10 @@
static void read_cb(gpointer data, gint source, GaimInputCondition cond);
+/************************************************************************** + **************************************************************************/ msn_servconn_new(MsnSession *session, MsnServConnType type)
@@ -42,8 +46,7 @@
servconn->cmdproc = msn_cmdproc_new(session);
servconn->cmdproc->servconn = servconn;
- if (session->http_method)
- servconn->httpconn = msn_httpconn_new(servconn);
+ servconn->httpconn = msn_httpconn_new(servconn); servconn->num = session->servconns_count++;
@@ -61,11 +64,6 @@
- if (servconn->destroying)
- servconn->destroying = TRUE;
msn_servconn_disconnect(servconn);
@@ -82,52 +80,83 @@
-show_error(MsnServConn *servconn)
+msn_servconn_set_connect_cb(MsnServConn *servconn, + void (*connect_cb)(MsnServConn *)) + g_return_if_fail(servconn != NULL); + servconn->connect_cb = connect_cb; +msn_servconn_set_disconnect_cb(MsnServConn *servconn, + void (*disconnect_cb)(MsnServConn *))
+ g_return_if_fail(servconn != NULL); + servconn->disconnect_cb = disconnect_cb; +msn_servconn_set_destroy_cb(MsnServConn *servconn, + void (*destroy_cb)(MsnServConn *)) + g_return_if_fail(servconn != NULL); + servconn->destroy_cb = destroy_cb; +/************************************************************************** + **************************************************************************/ +msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error)
const char *names[] = { "Notification", "Switchboard" };
- gc = gaim_account_get_connection(servconn->session->account);
name = names[servconn->type];
- switch (servconn->cmdproc->error)
- case MSN_ERROR_CONNECT:
- tmp = g_strdup_printf(_("Unable to connect to %s server"),
- tmp = g_strdup_printf(_("Error writing to %s server"), name);
- cmd = servconn->cmdproc->last_trans;
- tmp = g_strdup_printf(_("Error reading from %s server"), name);
- gaim_debug_info("msn", "Last command was: %s\n", cmd);
+ case MSN_SERVCONN_ERROR_CONNECT: + reason = _("Unable to connect"); break; + case MSN_SERVCONN_ERROR_WRITE: + reason = _("Writing error"); break; + case MSN_SERVCONN_ERROR_READ: + reason = _("Reading error"); break; - tmp = g_strdup_printf(_("Unknown error from %s server"), name);
+ reason = _("Unknown error"); break; - if (servconn->type != MSN_SERVER_SB)
+ tmp = g_strdup_printf(_("Connection error from %s server (%s):\n%s"), + name, servconn->host, reason); + if (servconn->type == MSN_SERVCONN_NS) - gaim_connection_error(gc, tmp);
+ msn_session_set_error(servconn->session, MSN_ERROR_SERVCONN, tmp);
+ else if (servconn->type == MSN_SERVCONN_SB) swboard = servconn->cmdproc->data;
- swboard->error = MSN_SB_ERROR_CONNECTION;
+ swboard->error = MSN_SB_ERROR_CONNECTION; + msn_servconn_disconnect(servconn); +/************************************************************************** + **************************************************************************/ connect_cb(gpointer data, gint source, GaimInputCondition cond)
@@ -146,7 +175,6 @@
servconn->connected = TRUE;
- servconn->cmdproc->ready = TRUE;
/* Someone wants to know we connected. */
servconn->connect_cb(servconn);
@@ -155,8 +183,7 @@
- servconn->cmdproc->error = MSN_ERROR_CONNECT;
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT); @@ -188,7 +215,6 @@
msn_httpconn_connect(servconn->httpconn, host, port);
servconn->connected = TRUE;
- servconn->cmdproc->ready = TRUE;
servconn->httpconn->virgin = TRUE;
/* Someone wants to know we connected. */
@@ -216,6 +242,7 @@
if (!servconn->connected)
+ /* We could not connect. */ if (servconn->disconnect_cb != NULL)
servconn->disconnect_cb(servconn);
@@ -224,7 +251,7 @@
if (servconn->session->http_method)
- /* Fake disconnection */
+ /* Fake disconnection. */ if (servconn->disconnect_cb != NULL)
servconn->disconnect_cb(servconn);
@@ -244,48 +271,11 @@
servconn->payload_len = 0;
servconn->connected = FALSE;
- servconn->cmdproc->ready = FALSE;
if (servconn->disconnect_cb != NULL)
servconn->disconnect_cb(servconn);
-msn_servconn_set_connect_cb(MsnServConn *servconn,
- void (*connect_cb)(MsnServConn *))
- g_return_if_fail(servconn != NULL);
- servconn->connect_cb = connect_cb;
-msn_servconn_set_disconnect_cb(MsnServConn *servconn,
- void (*disconnect_cb)(MsnServConn *))
- g_return_if_fail(servconn != NULL);
- servconn->disconnect_cb = disconnect_cb;
-msn_servconn_set_destroy_cb(MsnServConn *servconn,
- void (*destroy_cb)(MsnServConn *))
- g_return_if_fail(servconn != NULL);
- servconn->destroy_cb = destroy_cb;
-failed_io(MsnServConn *servconn)
- g_return_if_fail(servconn != NULL);
- msn_servconn_disconnect(servconn);
msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len)
@@ -297,14 +287,16 @@
ret = write(servconn->fd, buf, len);
ret = write(servconn->fd, &buf, sizeof(len));
ret = write(servconn->fd, buf, len);
ret = write(servconn->fd, buf, len);
@@ -317,8 +309,7 @@
- servconn->cmdproc->error = MSN_ERROR_WRITE;
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); @@ -340,9 +331,7 @@
- servconn->cmdproc->error = MSN_ERROR_READ;
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); --- a/src/protocols/msn/session.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/session.c Thu Jan 06 21:48:07 2005 -0500
@@ -28,8 +28,7 @@
-msn_session_new(GaimAccount *account, const char *host, int port,
+msn_session_new(GaimAccount *account) @@ -37,15 +36,14 @@
session = g_new0(MsnSession, 1);
- session->account = account;
- session->dispatch_host = g_strdup(host);
- session->dispatch_port = port;
- session->http_method = http_method;
+ session->account = account; session->notification = msn_notification_new(session);
session->userlist = msn_userlist_new(session);
session->sync_userlist = msn_userlist_new(session);
+ session->user = msn_user_new(session->userlist, + gaim_account_get_username(account), NULL); session->protocol_ver = 9;
@@ -61,9 +59,6 @@
msn_session_disconnect(session);
- if (session->dispatch_host != NULL)
- g_free(session->dispatch_host);
if (session->notification != NULL)
msn_notification_destroy(session->notification);
@@ -102,16 +97,21 @@
if (session->nexus != NULL)
msn_nexus_destroy(session->nexus);
+ if (session->user != NULL) + msn_user_destroy(session->user); -msn_session_connect(MsnSession *session)
+msn_session_connect(MsnSession *session, const char *host, int port, g_return_val_if_fail(session != NULL, FALSE);
g_return_val_if_fail(!session->connected, TRUE);
session->connected = TRUE;
+ session->http_method = http_method; if (session->notification == NULL)
@@ -119,9 +119,7 @@
g_return_val_if_reached(FALSE);
- if (msn_notification_connect(session->notification,
- session->dispatch_host,
- session->dispatch_port))
+ if (msn_notification_connect(session->notification, host, port)) @@ -135,13 +133,13 @@
g_return_if_fail(session != NULL);
g_return_if_fail(session->connected);
+ session->connected = FALSE; while (session->switches != NULL)
msn_switchboard_close(session->switches->data);
if (session->notification != NULL)
msn_notification_close(session->notification);
- session->connected = FALSE;
/* TODO: This must go away when conversation is redesigned */
@@ -280,6 +278,86 @@
+msn_session_set_error(MsnSession *session, MsnErrorType error, + gc = session->account->gc; + case MSN_ERROR_SERVCONN: + case MSN_ERROR_UNSUPORTED_PROTOCOL: + msg = g_strdup(_("Our protocol is not supported by the " + case MSN_ERROR_HTTP_MALFORMED: + msg = g_strdup(_("Error parsing HTTP.")); + case MSN_ERROR_SIGN_OTHER: + gc->wants_to_die = TRUE; + msg = g_strdup(_("You have signed on from another location.")); + case MSN_ERROR_SERV_DOWN: + msg = g_strdup(_("The MSN servers are going down " + msg = g_strdup_printf(_("Unable to authenticate: %s"), + _("Unknown error") : info); + case MSN_ERROR_BAD_BLIST: + msg = g_strdup(_("Your MSN buddy list is temporarily " + "unavailable. Please wait and try " + msg = g_strdup(_("Unknown error.")); + msn_session_disconnect(session); + gaim_connection_error(gc, msg); +get_login_step_text(MsnSession *session) + const char *steps_text[] = { + _("Starting authentication"), + _("Retrieving buddy list") + return steps_text[session->login_step]; +msn_session_set_login_step(MsnSession *session, MsnLoginStep step) + gc = session->account->gc; + session->login_step = step; + gaim_connection_update_progress(gc, get_login_step_text(session), step, msn_session_finish_login(MsnSession *session)
--- a/src/protocols/msn/session.h Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/session.h Thu Jan 06 21:48:07 2005 -0500
@@ -40,6 +40,40 @@
+ MSN_ERROR_UNSUPORTED_PROTOCOL, + MSN_ERROR_HTTP_MALFORMED, + MSN_LOGIN_STEP_HANDSHAKE, + MSN_LOGIN_STEP_TRANSFER, + MSN_LOGIN_STEP_AUTH_START, + MSN_LOGIN_STEP_GET_COOKIE, + MSN_LOGIN_STEP_AUTH_END, +#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END @@ -48,18 +82,16 @@
+ MsnLoginStep login_step; /**< The current step in the login process. */ gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */
gboolean destroying; /**< A flag that states if the session is being destroyed. */
MsnNotification *notification;
MsnUserList *sync_userlist;
@@ -67,8 +99,9 @@
int servconns_count; /**< The count of server connections. */
GList *switches; /**< The list of all the switchboards. */
GList *directconns; /**< The list of all the directconnections. */
+ GList *slplinks; /**< The list of all the slplinks. */
+ int conv_seq; /**< The current conversation sequence number. */ @@ -81,27 +114,16 @@
- /* You have no idea how much I hate all that is below. */
* Creates an MSN session.
* @param account The account.
- * @param host The dispatch server host.
- * @param port The dispatch server port.
* @return The new MSN session.
-MsnSession *msn_session_new(GaimAccount *account,
- const char *host, int port,
+MsnSession *msn_session_new(GaimAccount *account); * Destroys an MSN session.
@@ -113,11 +135,16 @@
* Connects to and initiates an MSN session.
- * @param session The MSN session.
+ * @param session The MSN session. + * @param host The dispatch server host. + * @param port The dispatch server port. + * @param http_method Whether to use or not http_method. * @return @c TRUE on success, @c FALSE on failure.
-gboolean msn_session_connect(MsnSession *session);
+gboolean msn_session_connect(MsnSession *session, + const char *host, int port, * Disconnects from an MSN session.
@@ -142,6 +169,29 @@
MsnSwitchBoard *msn_session_get_swboard(MsnSession *session,
+ * Sets an error for the MSN session. + * @param session The MSN session. + * @param error The error. + * @param info Extra information. +void msn_session_set_error(MsnSession *session, MsnErrorType error, + * Sets the current step in the login proccess. + * @param session The MSN session. + * @param step The current step. +void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); + * Finish the login proccess. + * @param session The MSN session. void msn_session_finish_login(MsnSession *session);
#endif /* _MSN_SESSION_H_ */
--- a/src/protocols/msn/switchboard.c Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/switchboard.c Thu Jan 06 21:48:07 2005 -0500
@@ -35,8 +35,9 @@
/**************************************************************************
**************************************************************************/
msn_switchboard_new(MsnSession *session)
@@ -48,10 +49,10 @@
swboard = g_new0(MsnSwitchBoard, 1);
swboard->session = session;
- swboard->servconn = servconn = msn_servconn_new(session, MSN_SERVER_SB);
+ swboard->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_SB); swboard->cmdproc = servconn->cmdproc;
- swboard->im_queue = g_queue_new();
+ swboard->msg_queue = g_queue_new(); swboard->cmdproc->data = swboard;
@@ -71,17 +72,12 @@
g_return_if_fail(swboard != NULL);
- if (swboard->destroying)
- swboard->destroying = TRUE;
/* If it linked us is because its looking for trouble */
if (swboard->slplink != NULL)
msn_slplink_destroy(swboard->slplink);
/* Destroy the message queue */
- while ((msg = g_queue_pop_head(swboard->im_queue)) != NULL)
+ while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) if (swboard->error != MSN_SB_ERROR_NONE)
@@ -92,7 +88,7 @@
- g_queue_free(swboard->im_queue);
+ g_queue_free(swboard->msg_queue); for (l = swboard->ack_list; l != NULL; l = l->next)
msn_message_unref(l->data);
@@ -112,8 +108,17 @@
session = swboard->session;
session->switches = g_list_remove(session->switches, swboard);
+ /* This should never happen or we are in trouble. */ if (swboard->servconn != NULL)
msn_servconn_destroy(swboard->servconn);
+ swboard->cmdproc->data = NULL; + msn_servconn_set_disconnect_cb(swboard->servconn, NULL); + msn_servconn_destroy(swboard->servconn); @@ -172,8 +177,9 @@
/**************************************************************************
**************************************************************************/
send_clientcaps(MsnSwitchBoard *swboard)
@@ -184,7 +190,7 @@
msn_message_set_flag(msg, 'U');
msn_message_set_bin_data(msg, MSN_CLIENTINFO, strlen(MSN_CLIENTINFO));
- msn_switchboard_send_msg(swboard, msg);
+ msn_switchboard_send_msg(swboard, msg, TRUE); msn_message_destroy(msg);
@@ -421,8 +427,165 @@
/**************************************************************************
+ **************************************************************************/ +/** Called when a message times out. */ +msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) + msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); +/** Called when we receive an error of a message. */ +msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) + msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN); +/** Called when we receive an ack of a special message. */ +msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd) + msg = cmd->trans->data; + if (msg->ack_cb != NULL) + msg->ack_cb(msg->ack_data); + msn_message_unref(msg); +/** Called when we receive a nak of a special message. */ +msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd) + msg = cmd->trans->data; + msn_message_unref(msg); +release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) + g_return_if_fail(swboard != NULL); + g_return_if_fail(msg != NULL); + cmdproc = swboard->cmdproc; + payload = msn_message_gen_payload(msg, &payload_len); + /* msn_message_show_readable(msg, "SB SEND", FALSE); */ + trans = msn_transaction_new(cmdproc, "MSG", "%c %d", + msn_message_get_flag(msg), payload_len); + /* Data for callbacks */ + msn_transaction_set_data(trans, msg); + if (msg->type == MSN_MSG_TEXT) + swboard->ack_list = g_list_append(swboard->ack_list, msg); + msn_transaction_set_timeout_cb(trans, msg_timeout); + else if (msg->type == MSN_MSG_SLP) + swboard->ack_list = g_list_append(swboard->ack_list, msg); + msn_transaction_set_timeout_cb(trans, msg_timeout); + if (msg->ack_cb != NULL) + msn_transaction_add_cb(trans, "ACK", msg_ack); + msn_transaction_add_cb(trans, "NAK", msg_nak); + trans->payload = payload; + trans->payload_len = payload_len; + msn_cmdproc_send_trans(cmdproc, trans); +queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) + g_return_if_fail(swboard != NULL); + g_return_if_fail(msg != NULL); + gaim_debug_info("msn", "Appending message to queue.\n"); + g_queue_push_tail(swboard->msg_queue, msg); +process_queue(MsnSwitchBoard *swboard) + g_return_if_fail(swboard != NULL); + gaim_debug_info("msn", "Processing queue\n"); + while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) + gaim_debug_info("msn", "Sending message\n"); + release_msg(swboard, msg); + msn_message_unref(msg); +msn_switchboard_can_send(MsnSwitchBoard *swboard) + g_return_val_if_fail(swboard != NULL, FALSE); + if (swboard->empty || !g_queue_is_empty(swboard->msg_queue)) +msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, + g_return_if_fail(swboard != NULL); + g_return_if_fail(msg != NULL); + if (msn_switchboard_can_send(swboard)) + release_msg(swboard, msg); + queue_msg(swboard, msg); +/************************************************************************** **************************************************************************/
ans_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -528,7 +691,7 @@
msn_switchboard_add_user(swboard, passport);
- msn_switchboard_process_queue(swboard);
+ process_queue(swboard); if (!session->http_method)
send_clientcaps(swboard);
@@ -735,137 +898,6 @@
/**************************************************************************
- **************************************************************************/
-/** Called when a message times out. */
-msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans)
- msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT);
-/** Called when we receive an error of a message. */
-msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
- msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN);
-/** Called when we receive an ack of a special message. */
-msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd)
- msg = cmd->trans->data;
- if (msg->ack_cb != NULL)
- msg->ack_cb(msg->ack_data);
- msn_message_unref(msg);
-/** Called when we receive a nak of a special message. */
-msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd)
- msg = cmd->trans->data;
- msn_message_unref(msg);
-msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg)
- g_return_if_fail(swboard != NULL);
- g_return_if_fail(msg != NULL);
- cmdproc = swboard->cmdproc;
- payload = msn_message_gen_payload(msg, &payload_len);
- /* msn_message_show_readable(msg, "SB SEND", FALSE); */
- trans = msn_transaction_new(cmdproc, "MSG", "%c %d",
- msn_message_get_flag(msg), payload_len);
- /* Data for callbacks */
- msn_transaction_set_data(trans, msg);
- if (msg->type == MSN_MSG_TEXT)
- swboard->ack_list = g_list_append(swboard->ack_list, msg);
- msn_transaction_set_timeout_cb(trans, msg_timeout);
- else if (msg->type == MSN_MSG_SLP)
- swboard->ack_list = g_list_append(swboard->ack_list, msg);
- msn_transaction_set_timeout_cb(trans, msg_timeout);
- if (msg->ack_cb != NULL)
- msn_transaction_add_cb(trans, "ACK", msg_ack);
- msn_transaction_add_cb(trans, "NAK", msg_nak);
- trans->payload = payload;
- trans->payload_len = payload_len;
- msn_cmdproc_send_trans(cmdproc, trans);
-msn_switchboard_queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg)
- g_return_if_fail(swboard != NULL);
- g_return_if_fail(msg != NULL);
- gaim_debug_info("msn", "Appending message to queue.\n");
- g_queue_push_tail(swboard->im_queue, msg);
-msn_switchboard_process_queue(MsnSwitchBoard *swboard)
- g_return_if_fail(swboard != NULL);
- gaim_debug_info("msn", "Processing queue\n");
- while ((msg = g_queue_pop_head(swboard->im_queue)) != NULL)
- gaim_debug_info("msn", "Sending message\n");
- msn_switchboard_send_msg(swboard, msg);
- msn_message_unref(msg);
-/**************************************************************************
**************************************************************************/
@@ -878,8 +910,6 @@
cmdproc = servconn->cmdproc;
g_return_if_fail(cmdproc != NULL);
account = cmdproc->session->account;
g_return_if_fail(swboard != NULL);
@@ -908,6 +938,8 @@
swboard = servconn->cmdproc->data;
g_return_if_fail(swboard != NULL);
+ msn_servconn_set_disconnect_cb(swboard->servconn, NULL); msn_switchboard_destroy(swboard);
@@ -999,6 +1031,7 @@
/**************************************************************************
* Create & Transfer stuff
**************************************************************************/
got_swboard(MsnCmdProc *cmdproc, MsnCommand *cmd)
@@ -1058,23 +1091,29 @@
g_return_if_fail(swboard != NULL);
- if (g_queue_is_empty(swboard->im_queue))
+ if (swboard->error != MSN_SB_ERROR_NONE) + msn_switchboard_destroy(swboard); + else if (g_queue_is_empty(swboard->msg_queue) || + !swboard->session->connected)
cmdproc = swboard->cmdproc;
msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL);
msn_switchboard_destroy(swboard);
/**************************************************************************
**************************************************************************/
msn_switchboard_init(void)
--- a/src/protocols/msn/switchboard.h Tue Jan 04 22:30:50 2005 -0500
+++ b/src/protocols/msn/switchboard.h Thu Jan 06 21:48:07 2005 -0500
@@ -35,8 +35,8 @@
@@ -49,9 +49,10 @@
- * A switchboard A place where a bunch of users send messages to the rest
+ * A place where a bunch of users send messages to the rest of the users. @@ -71,8 +72,6 @@
gboolean invited; /**< A flag that states if we were invited to the
- gboolean destroying; /**< A flag that states if the switchboard is on
- the process of being destroyed. */
gboolean ready; /**< A flag that states if this switchboard is
gboolean closed; /**< A flag that states if the switchboard has
@@ -84,7 +83,7 @@
- GQueue *im_queue; /**< Queue of messages to send. */
+ GQueue *msg_queue; /**< Queue of messages to send. */ GList *ack_list; /**< List of messages waiting for an ack. */
MsnSBErrorType error; /**< The error that occurred in this switchboard
@@ -197,9 +196,28 @@
void msn_switchboard_close(MsnSwitchBoard *swboard);
-void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg);
-void msn_switchboard_queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg);
-void msn_switchboard_process_queue(MsnSwitchBoard *swboard);
+ * Returns whether or not we currently can send a message through this + * @param swboard The switchboard. + * @return @c TRUE if a message can be sent, @c FALSE otherwise. +gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard); + * Sends a message through this switchboard. + * @param swboard The switchboard. + * @param msg The message. + * @param queue A flag that states if we want this message to be queued (in + * the case it cannot currently be sent). + * @return @c TRUE if a message can be sent, @c FALSE otherwise. +void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard);
gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who);
@@ -208,13 +226,27 @@
void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user);
- * Processes application/x-msnmsgrp2p messages.
+ * Processes peer to peer messages. * @param cmdproc The command processor.
* @param msg The message.
void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
+ * Processes emoticon messages. + * @param cmdproc The command processor. + * @param msg The message. void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
+ * Processes INVITE messages. + * @param cmdproc The command processor. + * @param msg The message. void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
#endif /* _MSN_SWITCHBOARD_H_ */