libpurple/protocols/myspace/myspace.c

branch
soc.2007.msimprpl
changeset 19163
c96b3c02a849
parent 19162
184ae953539f
child 19164
1fd7022f57eb
equal deleted inserted replaced
19162:184ae953539f 19163:c96b3c02a849
2322 MsimMessage *body; 2322 MsimMessage *body;
2323 2323
2324 g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); 2324 g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE);
2325 g_return_val_if_fail(msg != NULL, FALSE); 2325 g_return_val_if_fail(msg != NULL, FALSE);
2326 2326
2327 purple_connection_update_progress(session->gc, _("Connected"), 3, 4);
2328 purple_connection_set_state(session->gc, PURPLE_CONNECTED);
2329
2330 session->sesskey = msim_msg_get_integer(msg, "sesskey"); 2327 session->sesskey = msim_msg_get_integer(msg, "sesskey");
2331 purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey); 2328 purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey);
2332 2329
2333 /* What is proof? Used to be uid, but now is 52 base64'd bytes... */ 2330 /* What is proof? Used to be uid, but now is 52 base64'd bytes... */
2334 2331
2344 2341
2345 /* We now know are our own username, only after we're logged in.. 2342 /* We now know are our own username, only after we're logged in..
2346 * which is weird, but happens because you login with your email 2343 * which is weird, but happens because you login with your email
2347 * address and not username. Will be freed in msim_session_destroy(). */ 2344 * address and not username. Will be freed in msim_session_destroy(). */
2348 session->username = msim_msg_get_string(msg, "uniquenick"); 2345 session->username = msim_msg_get_string(msg, "uniquenick");
2346
2347 /* The session is now set up, ready to be connected. This emits the
2348 * signedOn signal, so clients can now do anything with msimprpl, and
2349 * we're ready for it (session key, userid, username all setup). */
2350 purple_connection_update_progress(session->gc, _("Connected"), 3, 4);
2351 purple_connection_set_state(session->gc, PURPLE_CONNECTED);
2352
2353
2354 /* Additional post-connect operations */
2355
2349 2356
2350 if (msim_msg_get_integer(msg, "uniquenick") == session->userid) { 2357 if (msim_msg_get_integer(msg, "uniquenick") == session->userid) {
2351 purple_debug_info("msim_we_are_logged_on", "TODO: pick username"); 2358 purple_debug_info("msim_we_are_logged_on", "TODO: pick username");
2352 } 2359 }
2353 2360
2668 full_errmsg = g_strdup_printf(_("Protocol error, code %d: %s"), err, 2675 full_errmsg = g_strdup_printf(_("Protocol error, code %d: %s"), err,
2669 errmsg ? errmsg : "no 'errmsg' given"); 2676 errmsg ? errmsg : "no 'errmsg' given");
2670 2677
2671 g_free(errmsg); 2678 g_free(errmsg);
2672 2679
2673 purple_debug_info("msim", "msim_error: %s\n", full_errmsg); 2680 purple_debug_info("msim", "msim_error (sesskey=%d): %s\n",
2681 session->sesskey, full_errmsg);
2674 2682
2675 purple_notify_error(session->account, g_strdup(_("MySpaceIM Error")), 2683 purple_notify_error(session->account, g_strdup(_("MySpaceIM Error")),
2676 full_errmsg, NULL); 2684 full_errmsg, NULL);
2677 2685
2678 /* Destroy session if fatal. */ 2686 /* Destroy session if fatal. */
3151 g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */ 3159 g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */
3152 3160
3153 gc = (PurpleConnection *)(gc_uncasted); 3161 gc = (PurpleConnection *)(gc_uncasted);
3154 account = purple_connection_get_account(gc); 3162 account = purple_connection_get_account(gc);
3155 session = gc->proto_data; 3163 session = gc->proto_data;
3164
3165 /* libpurple/eventloop.h only defines these two */
3166 if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) {
3167 purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond);
3168 purple_connection_error(gc, _("Invalid input condition"));
3169 return;
3170 }
3156 3171
3157 g_return_if_fail(cond == PURPLE_INPUT_READ); 3172 g_return_if_fail(cond == PURPLE_INPUT_READ);
3158 g_return_if_fail(MSIM_SESSION_VALID(session)); 3173 g_return_if_fail(MSIM_SESSION_VALID(session));
3159 3174
3160 /* Mark down that we got data, so don't timeout. */ 3175 /* Mark down that we got data, so don't timeout. */

mercurial