diff options
author | dequis <dx@dxzone.com.ar> | 2015-11-28 15:32:21 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-11-28 15:32:21 -0300 |
commit | e61f9d1c91c42220da92822113fb953eb8d030bf (patch) | |
tree | 763e4e250b7478cc3fcc8b5a0616cc80daa2900f | |
parent | 4e4616aa427fb5185b1540014c8d5130c18c790d (diff) |
msn: Send VER/CVR/USR together in the first request for faster login
-rw-r--r-- | protocols/msn/ns.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index b7006bf2..3b2ae552 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -109,6 +109,9 @@ static gboolean msn_ns_connected(gpointer data, gint source, b_input_condition c struct msn_data *md = data; struct im_connection *ic = md->ic; + /* this should be taken from XFR, but hardcoding it for now. it also prevents more redirects. */ + const char *redir_data = "VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDINCklzR2VvWGZyOiB0cnVlDQo="; + if (source == -1 && !md->is_http) { imcb_error(ic, "Could not connect to server"); imc_logout(ic, TRUE); @@ -134,7 +137,13 @@ static gboolean msn_ns_connected(gpointer data, gint source, b_input_condition c memcpy(md->uuid, "b171be3e", 8); /* :-P */ } - if (msn_ns_write(ic, source, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER)) { + /* Having to handle potential errors in each write sure makes these ifs awkward...*/ + + if (msn_ns_write(ic, source, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER) && + msn_ns_write(ic, source, "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s %s\r\n", + ++md->trId, ic->acc->user, redir_data) && + msn_ns_write(ic, md->fd, "USR %d SSO I %s\r\n", ++md->trId, ic->acc->user)) { + if (!md->is_http) { md->inpa = b_input_add(md->fd, B_EV_IO_READ, msn_ns_callback, md); } @@ -207,11 +216,8 @@ int msn_ns_command(struct msn_data *md, char **cmd, int num_parts) return(0); } - return(msn_ns_write(ic, md->fd, "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDINClhmclNlbnRVVENUaW1lOiA2MzU2MTQ3OTU5NzgzOTAwMDANCklzR2VvWGZyOiB0cnVlDQo=\r\n", - ++md->trId, ic->acc->user)); } else if (strcmp(cmd[0], "CVR") == 0) { /* We don't give a damn about the information we just received */ - return msn_ns_write(ic, md->fd, "USR %d SSO I %s\r\n", ++md->trId, ic->acc->user); } else if (strcmp(cmd[0], "XFR") == 0) { char *server; int port; |