# HG changeset patch # User Mark Doliner # Date 1137989396 0 # Node ID 46ba853a76b5e77a1ed864a92e7cb070387377c5 # Parent e19c59a6ff11cf849296f286641403b71d0c0c21 [gaim-migrate @ 15360] A few oscar fixes: * Show the available message in the buddy info box * ICQ accounts can view available messages * AIM accounts can view the DND/extended away/occupied statuses of ICQ buddies committer: Tailor Script diff -r e19c59a6ff11 -r 46ba853a76b5 src/protocols/oscar/locate.c --- a/src/protocols/oscar/locate.c Mon Jan 23 04:03:26 2006 +0000 +++ b/src/protocols/oscar/locate.c Mon Jan 23 04:09:56 2006 +0000 @@ -255,6 +255,21 @@ cur->info_len = userinfo->info_len; } + if (userinfo->status != NULL) { + free(cur->status); + free(cur->status_encoding); + if (userinfo->status_len > 0) { + cur->status = (char *)malloc(userinfo->status_len); + memcpy(cur->status, userinfo->status, userinfo->status_len); + } else + cur->status = NULL; + if (userinfo->status_encoding != NULL) + cur->status_encoding = strdup(userinfo->status_encoding); + else + cur->status_encoding = NULL; + cur->status_len = userinfo->status_len; + } + if (userinfo->away != NULL) { free(cur->away); free(cur->away_encoding); @@ -757,7 +772,7 @@ aim_bstream_advance(bs, length2); } break; - case 0x0002: { /* An status/available message */ + case 0x0002: { /* A status/available message */ free(outinfo->status); free(outinfo->status_encoding); if (length2 >= 4) { diff -r e19c59a6ff11 -r 46ba853a76b5 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Mon Jan 23 04:03:26 2006 +0000 +++ b/src/protocols/oscar/oscar.c Mon Jan 23 04:09:56 2006 +0000 @@ -5178,11 +5178,19 @@ oscar_string_append_info(gc, str, "\n
", NULL, userinfo); - /* - * TODO: Need to duplicate what oscar_tooltip_text() does here so that - * we show the available message in the buddy info. - */ - + /* Available message */ + // QQQQQQQQQQ +printf(" userinfo->status=%s\n", userinfo->status); + if ((userinfo->status != NULL) && !(userinfo->flags & AIM_FLAG_AWAY)) + { + if (userinfo->status[0] != '\0') + tmp = oscar_encoding_to_utf8(userinfo->status_encoding, + userinfo->status, userinfo->status_len); + oscar_string_append(gc->account, str, "\n
", _("Available Message"), tmp); + g_free(tmp); + } + + /* Away message */ if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { tmp = oscar_encoding_extract(userinfo->away_encoding); away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len); @@ -5193,6 +5201,7 @@ } } + /* Info */ if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { tmp = oscar_encoding_extract(userinfo->info_encoding); info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len); @@ -7957,31 +7966,22 @@ g_return_val_if_fail(account != NULL, NULL); + /* Used to flag some statuses as "user settable" or not */ is_icq = aim_sn_is_icq(gaim_account_get_username(account)); - /* Oscar-common status types */ - if (is_icq) - { - type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, - OSCAR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, - OSCAR_STATUS_ID_FREE4CHAT, - _("Free For Chat"), TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - } - else - { - type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, - OSCAR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - gaim_value_new(GAIM_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); - } - + /* Common status types */ + /* Really the available message should only be settable for AIM accounts */ + type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, + OSCAR_STATUS_ID_AVAILABLE, + NULL, TRUE, TRUE, FALSE, + "message", _("Message"), + gaim_value_new(GAIM_TYPE_STRING), NULL); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, + OSCAR_STATUS_ID_FREE4CHAT, + _("Free For Chat"), TRUE, is_icq, FALSE); + status_types = g_list_append(status_types, type); type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, OSCAR_STATUS_ID_AWAY, @@ -7996,23 +7996,20 @@ status_types = g_list_append(status_types, type); /* ICQ-specific status types */ - if (is_icq) - { - type = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE, - OSCAR_STATUS_ID_OCCUPIED, - _("Occupied"), TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, - OSCAR_STATUS_ID_DND, - _("Do Not Disturb"), TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, - OSCAR_STATUS_ID_NA, - _("Not Available"), TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - } + type = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE, + OSCAR_STATUS_ID_OCCUPIED, + _("Occupied"), TRUE, is_icq, FALSE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, + OSCAR_STATUS_ID_DND, + _("Do Not Disturb"), TRUE, is_icq, FALSE); + status_types = g_list_append(status_types, type); + + type = gaim_status_type_new_full(GAIM_STATUS_EXTENDED_AWAY, + OSCAR_STATUS_ID_NA, + _("Not Available"), TRUE, is_icq, FALSE); + status_types = g_list_append(status_types, type); type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, OSCAR_STATUS_ID_OFFLINE,