示例#1
0
文件: nexus.c 项目: felipec/msn-pecan
void
msn_nexus_connect(MsnNexus *nexus)
{
    PnSslConn *ssl_conn;
    PnNode *conn;

    ssl_conn = pn_ssl_conn_new("nexus", PN_NODE_NULL);

    conn = PN_NODE(ssl_conn);
    conn->session = nexus->session;

    nexus->parser = pn_parser_new(conn);
    pn_ssl_conn_set_read_cb(ssl_conn, nexus_read_cb, nexus);

    nexus->conn = conn;
    nexus->open_handler = g_signal_connect(conn, "open", G_CALLBACK(nexus_open_cb), nexus);
    nexus->error_handler = g_signal_connect(conn, "error", G_CALLBACK(close_cb), nexus);

    pn_node_connect(conn, "nexus.passport.com", 443);
}
示例#2
0
static void auth_cb (PnAuth *auth, void *data)
{
    PnSslConn *ssl_conn;
    PnNode *conn;
    RoamingRequest *roaming_request = data;

    ssl_conn = pn_ssl_conn_new ("ab_roaming", PN_NODE_NULL);

    conn = PN_NODE (ssl_conn);
    conn->session = roaming_request->roaming_session->session;

    roaming_request->parser = pn_parser_new (conn);
    pn_ssl_conn_set_read_cb (ssl_conn, read_cb, roaming_request);

    if (!roaming_request->roaming_session->hostname)
        pn_node_connect (conn, "tkrdr.storage.msn.com", 443);
    else
        pn_node_connect (conn, roaming_request->roaming_session->hostname, 443);

    roaming_request->conn = conn;
    roaming_request->open_sig_handler = g_signal_connect (conn, "open", G_CALLBACK (open_cb), roaming_request);
}
示例#3
0
文件: nexus.c 项目: felipec/msn-pecan
static void
nexus_read_cb(PnNode *conn,
              gpointer data)
{
    MsnNexus *nexus = data;
    GIOStatus status = G_IO_STATUS_NORMAL;
    gchar *str = NULL;

    while (nexus->parser_state == 0) {
        gsize terminator_pos;

        status = pn_parser_read_line(nexus->parser, &str, NULL, &terminator_pos, NULL);

        if (status == G_IO_STATUS_AGAIN)
            return;

        if (status != G_IO_STATUS_NORMAL) {
            msn_session_set_error(nexus->session, MSN_ERROR_AUTH,
                                  _("nexus stream error"));
            return;
        }

        if (str) {
            char *field;
            str[terminator_pos] = '\0';

            if ((field = get_field(str, "PassportURLs: "))) {
                char *da_login;

                da_login = strstr(field, "DALogin="******"DALogin="******"msnia.login.live.com");
#endif
                }
            }

            g_free(str);

            if (nexus->login_host) {
                PnSslConn *ssl_conn;
                PnNode *conn;

                ssl_conn = pn_ssl_conn_new("login", PN_NODE_NULL);

                conn = PN_NODE(ssl_conn);
                conn->session = nexus->session;

                if (nexus->error_handler)
                    g_signal_handler_disconnect(nexus->conn, nexus->error_handler);
                if (nexus->open_handler)
                    g_signal_handler_disconnect(nexus->conn, nexus->open_handler);
                g_object_unref(nexus->conn);
                pn_parser_free(nexus->parser);
                nexus->parser_state = 0;

                nexus->parser = pn_parser_new(conn);
                pn_ssl_conn_set_read_cb(ssl_conn, login_read_cb, nexus);

                nexus->conn = conn;
                nexus->open_handler = g_signal_connect(conn, "open", G_CALLBACK(login_open_cb), nexus);
                nexus->error_handler = g_signal_connect(conn, "error", G_CALLBACK(close_cb), nexus);

                pn_node_connect(conn, nexus->login_host, 443);

                return;
            }
        }
    }
}