comparison libpurple/protocols/myspace/user.c @ 24781:8e75a1525156

Grab the "Who can contact me? Only people on my buddy list?" and the "Who can see when I'm online? Only people on my buddy list?" settings from the server and activate your privacy setting so that the values that you've set using the official myspace IM client will also apply when you're logged in with Pidgin. I really don't think this should be necessary at a protocol level. It's just stupid. Why wouldn't the server do this for us?
author Mark Doliner <mark@kingant.net>
date Tue, 16 Dec 2008 23:39:03 +0000
parents 5f8e8b89b143
children c044eb54b7ac 138c729f8c9a
comparison
equal deleted inserted replaced
24780:d7fad2c0cf7c 24781:8e75a1525156
399 body = msim_msg_get_dictionary(msg, "body"); 399 body = msim_msg_get_dictionary(msg, "body");
400 if (!body) { 400 if (!body) {
401 return FALSE; 401 return FALSE;
402 } 402 }
403 403
404 if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN &&
405 msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) {
406 /*
407 * Some of this info will be available on the buddy list if the
408 * has themselves as their own buddy.
409 *
410 * Much of the info is already available in MsimSession,
411 * stored in msim_we_are_logged_on().
412 */
413 gchar *tmpstr;
414
415 tmpstr = msim_msg_get_string(body, "ShowOnlyToList");
416 if (tmpstr != NULL) {
417 session->show_only_to_list = g_str_equal(tmpstr, "True");
418 g_free(tmpstr);
419 }
420
421 session->privacy_mode = msim_msg_get_integer(body, "PrivacyMode");
422 session->offline_message_mode = msim_msg_get_integer(body, "OfflineMessageMode");
423
424 msim_send(session,
425 "blocklist", MSIM_TYPE_BOOLEAN, TRUE,
426 "sesskey", MSIM_TYPE_INTEGER, session->sesskey,
427 "idlist", MSIM_TYPE_STRING,
428 g_strdup_printf("w%d|c%d",
429 session->show_only_to_list ? 1 : 0,
430 session->privacy_mode),
431 NULL);
432 } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN &&
433 msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) {
434 /* TODO: same as above, but for MySpace info. */
435 }
436
404 username = msim_msg_get_string(body, "UserName"); 437 username = msim_msg_get_string(body, "UserName");
405 438
406 if (!username) { 439 if (!username) {
407 purple_debug_info("msim", 440 purple_debug_info("msim",
408 "msim_process_reply: not caching body, no UserName\n"); 441 "msim_process_reply: not caching body, no UserName\n");
433 elem = (MsimMessageElement *)body_node->data; 466 elem = (MsimMessageElement *)body_node->data;
434 key_str = elem->name; 467 key_str = elem->name;
435 468
436 value_str = msim_msg_get_string_from_element(elem); 469 value_str = msim_msg_get_string_from_element(elem);
437 msim_store_user_info_each(key_str, value_str, user); 470 msim_store_user_info_each(key_str, value_str, user);
438 }
439
440 if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN &&
441 msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) {
442 /* TODO: do something with our own IM info, if we need it for some
443 * specific purpose. Otherwise it is available on the buddy list,
444 * if the user has themselves as their own buddy.
445 *
446 * However, much of the info is already available in MsimSession,
447 * stored in msim_we_are_logged_on(). */
448 } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN &&
449 msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) {
450 /* TODO: same as above, but for MySpace info. */
451 } 471 }
452 472
453 msim_msg_free(body); 473 msim_msg_free(body);
454 g_free(username); 474 g_free(username);
455 475