comparison libpurple/protocols/oscar/oscar.c @ 31427:873cd5e068c4

I tested with AIM 7.2.6.1 and ICQ 7.2 build 3159 and both of them send no status message to indicate that the status message has been cleared. So it really seems like this comment and this behavior is incorrect. This fixes #12988. I haven't noticed any side effects yet. The side effect I'm worried about is that maybe we'll clear someone's status message when we shouldn't (because we receive a userinfo packet without a status message for whatever reason)
author Mark Doliner <mark@kingant.net>
date Thu, 02 Dec 2010 02:35:52 +0000
parents 04ffd3b52283
children 4635d84e3292 e358c09cd765
comparison
equal deleted inserted replaced
31426:1203778744d0 31427:873cd5e068c4
1364 int type = 0; 1364 int type = 0;
1365 gboolean buddy_is_away = FALSE; 1365 gboolean buddy_is_away = FALSE;
1366 const char *status_id; 1366 const char *status_id;
1367 va_list ap; 1367 va_list ap;
1368 aim_userinfo_t *info; 1368 aim_userinfo_t *info;
1369 char *message = NULL; 1369 char *message;
1370 char *itmsurl = NULL; 1370 char *itmsurl = NULL;
1371 1371
1372 gc = od->gc; 1372 gc = od->gc;
1373 account = purple_connection_get_account(gc); 1373 account = purple_connection_get_account(gc);
1374 1374
1451 purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_MOBILE, NULL); 1451 purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_MOBILE, NULL);
1452 } else { 1452 } else {
1453 purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); 1453 purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE);
1454 } 1454 }
1455 1455
1456 /* Empty status means we should unset the status message. NULL status means we should keep it from the previous active status. 1456 message = (info->status && info->status_len > 0)
1457 * Same goes for itmsurl (which is available only for the "available" status). 1457 ? oscar_encoding_to_utf8(info->status_encoding, info->status, info->status_len)
1458 */ 1458 : NULL;
1459 if (info->status != NULL) {
1460 message = (info->status_len > 0) ? oscar_encoding_to_utf8(info->status_encoding, info->status, info->status_len) : NULL;
1461 } else if (previous_status != NULL) {
1462 message = g_strdup(purple_status_get_attr_string(previous_status, "message"));
1463 }
1464 1459
1465 if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) { 1460 if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) {
1461 /* TODO: If itmsurl is NULL, does that mean the URL has been
1462 cleared? Or does it mean the URL should remain unchanged? */
1466 if (info->itmsurl != NULL) { 1463 if (info->itmsurl != NULL) {
1467 itmsurl = (info->itmsurl_len > 0) ? oscar_encoding_to_utf8(info->itmsurl_encoding, info->itmsurl, info->itmsurl_len) : NULL; 1464 itmsurl = (info->itmsurl_len > 0) ? oscar_encoding_to_utf8(info->itmsurl_encoding, info->itmsurl, info->itmsurl_len) : NULL;
1468 } else if (previous_status != NULL && purple_status_is_available(previous_status)) { 1465 } else if (previous_status != NULL && purple_status_is_available(previous_status)) {
1469 itmsurl = g_strdup(purple_status_get_attr_string(previous_status, "itmsurl")); 1466 itmsurl = g_strdup(purple_status_get_attr_string(previous_status, "itmsurl"));
1470 } 1467 }