| 53 } |
53 } |
| 54 |
54 |
| 55 if (create && !buddy->proto_data) { |
55 if (create && !buddy->proto_data) { |
| 56 /* No MsimUser for this buddy; make one. */ |
56 /* No MsimUser for this buddy; make one. */ |
| 57 |
57 |
| 58 /* TODO: where is this freed? */ |
|
| 59 user = g_new0(MsimUser, 1); |
58 user = g_new0(MsimUser, 1); |
| 60 user->buddy = buddy; |
59 user->buddy = buddy; |
| 61 user->id = purple_blist_node_get_int(&buddy->node, "UserID"); |
60 user->id = purple_blist_node_get_int((PurpleBlistNode*)buddy, "UserID"); |
| 62 buddy->proto_data = (gpointer)user; |
61 buddy->proto_data = (gpointer)user; |
| 63 } else { |
62 } else { |
| 64 user = (MsimUser *)(buddy->proto_data); |
63 user = (MsimUser *)(buddy->proto_data); |
| 65 } |
64 } |
| 66 |
65 |
| 67 return user; |
66 return user; |
| |
67 } |
| |
68 |
| |
69 void msim_user_free(MsimUser *user) |
| |
70 { |
| |
71 if (!user) |
| |
72 return; |
| |
73 |
| |
74 g_free(user->client_info); |
| |
75 g_free(user->gender); |
| |
76 g_free(user->location); |
| |
77 g_free(user->headline); |
| |
78 g_free(user->display_name); |
| |
79 g_free(user->username); |
| |
80 g_free(user->band_name); |
| |
81 g_free(user->song_name); |
| |
82 g_free(user->image_url); |
| |
83 g_free(user); |
| 68 } |
84 } |
| 69 |
85 |
| 70 /** |
86 /** |
| 71 * Find and return an MsimUser * representing a user on the buddy list, or NULL. |
87 * Find and return an MsimUser * representing a user on the buddy list, or NULL. |
| 72 */ |
88 */ |
| 404 if (!body) { |
420 if (!body) { |
| 405 return FALSE; |
421 return FALSE; |
| 406 } |
422 } |
| 407 |
423 |
| 408 if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && |
424 if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && |
| 409 msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) { |
425 msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) |
| |
426 { |
| 410 /* |
427 /* |
| 411 * Some of this info will be available on the buddy list if the |
428 * Some of this info will be available on the buddy list if the |
| 412 * has themselves as their own buddy. |
429 * user has themselves as their own buddy. |
| 413 * |
430 * |
| 414 * Much of the info is already available in MsimSession, |
431 * Much of the info is already available in MsimSession, |
| 415 * stored in msim_we_are_logged_on(). |
432 * stored in msim_we_are_logged_on(). |
| 416 */ |
433 */ |
| 417 gchar *tmpstr; |
434 gchar *tmpstr; |
| 429 "blocklist", MSIM_TYPE_BOOLEAN, TRUE, |
446 "blocklist", MSIM_TYPE_BOOLEAN, TRUE, |
| 430 "sesskey", MSIM_TYPE_INTEGER, session->sesskey, |
447 "sesskey", MSIM_TYPE_INTEGER, session->sesskey, |
| 431 "idlist", MSIM_TYPE_STRING, |
448 "idlist", MSIM_TYPE_STRING, |
| 432 g_strdup_printf("w%d|c%d", |
449 g_strdup_printf("w%d|c%d", |
| 433 session->show_only_to_list ? 1 : 0, |
450 session->show_only_to_list ? 1 : 0, |
| 434 session->privacy_mode), |
451 session->privacy_mode & 1), |
| 435 NULL); |
452 NULL); |
| 436 } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && |
453 } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && |
| 437 msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) { |
454 msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) { |
| 438 /* TODO: same as above, but for MySpace info. */ |
455 /* TODO: same as above, but for MySpace info. */ |
| 439 } |
456 } |