Mercurial > pidgin.yaz
comparison src/protocols/yahoo/yahoo_profile.c @ 9220:f0488214826f
[gaim-migrate @ 10016]
wing made yahoo profiles even better. They now include all the tooltip
info, and also include a link to the profile, so you can open it in your
browser with just a click.
He also says:
Note: I added _() to some "<b>%s:</b> %s" sort of
strings, because otherwise the display would be very ugly.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sun, 06 Jun 2004 18:01:32 +0000 |
parents | 76125b842b23 |
children | 8054855f2bb9 |
comparison
equal
deleted
inserted
replaced
9219:ec2a51abcc71 | 9220:f0488214826f |
---|---|
623 GString *s; | 623 GString *s; |
624 int stripped_len; | 624 int stripped_len; |
625 const char *last_updated_string = NULL; | 625 const char *last_updated_string = NULL; |
626 char *last_updated_utf8_string; | 626 char *last_updated_utf8_string; |
627 int lang, strid; | 627 int lang, strid; |
628 GaimBuddy *b; | |
628 | 629 |
629 gaim_debug_info("yahoo", "In yahoo_got_info\n"); | 630 gaim_debug_info("yahoo", "In yahoo_got_info\n"); |
630 | 631 |
631 /* we failed to grab the profile URL */ | 632 /* we failed to grab the profile URL. this should never happen */ |
632 if (url_text == NULL || strcmp(url_text, "") == 0) { | 633 if (url_text == NULL || strcmp(url_text, "") == 0) { |
633 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL, | 634 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL, |
634 _("<html><body><b>Error retrieving profile</b></body></html>"), | 635 _("<html><body><b>Error retrieving profile</b></body></html>"), |
635 NULL, NULL); | 636 NULL, NULL); |
636 | 637 |
675 if (profile_strings[strid].lang == profile_langs[lang].lang) break; | 676 if (profile_strings[strid].lang == profile_langs[lang].lang) break; |
676 } | 677 } |
677 gaim_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang); | 678 gaim_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang); |
678 } | 679 } |
679 | 680 |
680 /* At the moment we don't support profile pages with languages other than | 681 /* Every user may choose his/her own profile language, and this language |
681 * English. The problem is, that every user may choose his/her own profile | 682 * has nothing to do with the preferences of the user which looks at the |
682 * language. This language has nothing to do with the preferences of the | 683 * profile. We try to support all languages, but nothing is guaranteed. |
683 * user which looks at the profile | |
684 */ | 684 */ |
685 if (!p || profile_strings[strid].lang == XX) { | 685 if (!p || profile_strings[strid].lang == XX) { |
686 if (strstr(url_text, "was not found on this server.") == NULL && strstr(url_text, "Yahoo! Member Directory - User not found") == NULL) { | 686 if (strstr(url_text, "was not found on this server.") == NULL && strstr(url_text, "Yahoo! Member Directory - User not found") == NULL) { |
687 g_snprintf(buf, 1024, "<html><body>%s%s<a href=\"%s%s\">%s%s</a></body></html>", | 687 g_snprintf(buf, 1024, "<html><body>%s%s<a href=\"%s%s\">%s%s</a></body></html>", |
688 _("<b>Sorry, non-English profiles are not supported at this time.</b><br><br>\n"), | 688 _("<b>Sorry, this profile seems to be in a language " |
689 "that is not supported at this time.</b><br><br>\n"), | |
689 _("If you wish to view this profile, you will need to visit this link in your web browser<br>"), | 690 _("If you wish to view this profile, you will need to visit this link in your web browser<br>"), |
690 YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name); | 691 YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name); |
691 } else { | 692 } else { |
692 g_snprintf(buf, 1024, "<html><body><b>Error retrieving profile</b></body></html>"); | 693 g_snprintf(buf, 1024, "<html><body><b>Error retrieving profile</b></body></html>"); |
693 } | 694 } |
757 | 758 |
758 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as | 759 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as |
759 * true, since the Yahoo! ID will always be there */ | 760 * true, since the Yahoo! ID will always be there */ |
760 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, profile_strings[strid].yahoo_id_string, 2, "\n", 0, | 761 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, profile_strings[strid].yahoo_id_string, 2, "\n", 0, |
761 NULL, _("Yahoo! ID"), 0, NULL)) | 762 NULL, _("Yahoo! ID"), 0, NULL)) |
762 g_string_append_printf(s, "<b>%s:</b> %s<br>", _("Yahoo! ID"), info_data->name); | 763 g_string_append_printf(s, _("<b>%s:</b> %s<br>"), _("Yahoo! ID"), info_data->name); |
763 | 764 |
765 /* Display the alias, idle time, and status message below the Yahoo! ID */ | |
766 b = gaim_find_buddy(gaim_connection_get_account(info_data->gc), info_data->name); | |
767 if (b) { | |
768 char *statustext = yahoo_tooltip_text(b); | |
769 if(b->alias && b->alias[0]) { | |
770 char *aliastext = g_markup_escape_text(b->alias, -1); | |
771 g_string_append_printf(s, _("<b>Alias:</b> %s<br>"), aliastext); | |
772 g_free(aliastext); | |
773 } | |
774 if (b->idle > 0) { | |
775 char *idletime = gaim_str_seconds_to_string(time(NULL) - b->idle); | |
776 g_string_append_printf(s, _("<b>%s:</b> %s<br>"), _("Idle"), idletime); | |
777 g_free(idletime); | |
778 } | |
779 if (statustext) { | |
780 g_string_append_printf(s, "%s<br>", statustext); | |
781 g_free(statustext); | |
782 } | |
783 } | |
764 | 784 |
765 /* extract their Email address and put it in */ | 785 /* extract their Email address and put it in */ |
766 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, profile_strings[strid].my_email_string, 5, "\n", 0, | 786 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, profile_strings[strid].my_email_string, 5, "\n", 0, |
767 profile_strings[strid].private_string, _("Email"), 0, NULL); | 787 profile_strings[strid].private_string, _("Email"), 0, NULL); |
768 | 788 |
843 _("Home Page"), 1, NULL); | 863 _("Home Page"), 1, NULL); |
844 } | 864 } |
845 } | 865 } |
846 | 866 |
847 /* Cool Link {1,2,3} is also different. If "No cool link specified" exists, | 867 /* Cool Link {1,2,3} is also different. If "No cool link specified" exists, |
848 * then we have none. If we have one however, we'll need to check and see if | 868 * then we have none. If we have one however, we'll need to check and see |
849 * we have a second one. If we have a second one, we have to check to see if | 869 * if we have a second one. If we have a second one, we have to check to |
850 * we have a third one. | 870 * see if we have a third one. |
851 */ | 871 */ |
852 p = !profile_strings[strid].no_cool_link_specified_string? NULL: | 872 p = !profile_strings[strid].no_cool_link_specified_string? NULL: |
853 strstr(stripped,profile_strings[strid].no_cool_link_specified_string); | 873 strstr(stripped,profile_strings[strid].no_cool_link_specified_string); |
854 if (!p) | 874 if (!p) |
855 { | 875 { |
870 | 890 |
871 /* extract the Last Updated date and put it in */ | 891 /* extract the Last Updated date and put it in */ |
872 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, last_updated_utf8_string, 0, "\n", '\n', NULL, | 892 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, last_updated_utf8_string, 0, "\n", '\n', NULL, |
873 _("Last Updated"), 0, NULL); | 893 _("Last Updated"), 0, NULL); |
874 | 894 |
895 /* put a link to the actual profile URL */ | |
896 g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL")); | |
897 g_string_append_printf(s, "<a href=\"%s%s\">%s%s</a><br>", | |
898 YAHOO_PROFILE_URL, info_data->name, | |
899 YAHOO_PROFILE_URL, info_data->name); | |
900 | |
875 /* finish off the html */ | 901 /* finish off the html */ |
876 g_string_append(s, "</body></html>\n"); | 902 g_string_append(s, "</body></html>\n"); |
877 g_free(stripped); | 903 g_free(stripped); |
878 | 904 |
879 if(found) | 905 if(found) |