diff -r fceab4d6f658 -r 0561de0af1c6 src/protocols/yahoo/yahoo.c
--- a/src/protocols/yahoo/yahoo.c Tue Jun 01 19:16:34 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c Wed Jun 02 00:44:51 2004 +0000
@@ -43,13 +43,6 @@
extern char *yahoo_crypt(const char *, const char *);
-typedef struct
-{
- GaimConnection *gc;
- char *name;
-} YahooGetInfoData;
-
-
/* #define YAHOO_DEBUG */
static void yahoo_add_buddy(GaimConnection *gc, const char *who, GaimGroup *);
@@ -3016,257 +3009,6 @@
return TRUE;
}
-static void yahoo_got_info(void *data, const char *url_text, size_t len)
-{
- YahooGetInfoData *info_data = (YahooGetInfoData *)data;
- char *stripped, *p;
- char buf[1024];
- gboolean found = FALSE;
- char *url_buffer;
- GString *s;
- int stripped_len;
-
- gaim_debug_info("yahoo", "In yahoo_got_info\n");
-
- /* we failed to grab the profile URL */
- if (url_text == NULL || strcmp(url_text, "") == 0) {
- gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
- _("
Error retrieving profile"),
- NULL, NULL);
-
- g_free(info_data->name);
- g_free(info_data);
- return;
- }
-
- /* we don't yet support the multiple link level of the warning page for
- * 'adult' profiles, not to mention the fact that yahoo wants you to be
- * logged in (on the website) to be able to view an 'adult' profile. for
- * now, just tell them that we can't help them, and provide a link to the
- * profile if they want to do the web browser thing.
- */
- p = strstr(url_text, "Adult Profiles Warning Message");
- if (p) {
- g_snprintf(buf, 1024, "%s%s%s%s",
- _("Sorry, profiles marked as containing adult content are not supported at this time.
\n"),
- _("If you wish to view this profile, you will need to visit this link in your web browser
"),
- YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name);
-
- gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
- buf, NULL, NULL);
-
- g_free(info_data->name);
- g_free(info_data);
- return;
- }
-
- /* at the moment we don't support profile pages with languages other than
- * english. the problem is, that every user may choose his/her own profile
- * language. this language has nothing to do with the preferences of the
- * user which looks at the profile
- */
- p = strstr(url_text, "Last Updated:");
- if (!p) {
- p = strstr(url_text, "Last Updated ");
- }
- if (!p) {
- g_snprintf(buf, 1024, "%s%s%s%s",
- _("Sorry, non-English profiles are not supported at this time.
\n"),
- _("If you wish to view this profile, you will need to visit this link in your web browser
"),
- YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name);
-
- gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
- buf, NULL, NULL);
-
- g_free(info_data->name);
- g_free(info_data);
- return;
- }
-
- url_buffer = g_strdup(url_text);
-
- /*
- * gaim_markup_strip_html() doesn't strip out character entities like
- * and ·
- */
- while ((p = strstr(url_buffer, " ")) != NULL) {
- memmove(p, p + 6, strlen(p + 6));
- url_buffer[strlen(url_buffer) - 6] = '\0';
- }
- while ((p = strstr(url_buffer, "·")) != NULL) {
- memmove(p, p + 6, strlen(p + 6));
- url_buffer[strlen(url_buffer) - 6] = '\0';
- }
-
- /* nuke the nasty \r's */
- while ((p = strchr(url_buffer, '\r')) != NULL) {
- memmove(p, p + 1, strlen(p + 1));
- url_buffer[strlen(url_buffer) - 1] = '\0';
- }
-
- /* nuke the html, it's easier than trying to parse the horrid stuff */
- stripped = gaim_markup_strip_html(url_buffer);
- stripped_len = strlen(stripped);
-
- gaim_debug_misc("yahoo", "stripped = %p\n", stripped);
- gaim_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
-
- /* gonna re-use the memory we've already got for url_buffer */
- /* no we're not */
- s = g_string_sized_new(strlen(url_buffer));
- g_string_append(s, "\n");
-
- /* extract their Yahoo! ID and put it in. Don't bother marking has_info as
- * true, since the Yahoo! ID will always be there */
- if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Yahoo! ID:", 2, "\n", 0,
- NULL, _("Yahoo! ID"), 0, NULL))
- g_string_append_printf(s, "%s: %s
", _("Yahoo! ID"), info_data->name);
-
-
- /* extract their Email address and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "My Email", 5, "\n", 0,
- "Private", _("Email"), 0, NULL);
-
- /* extract the Nickname if it exists */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Nickname:", 1, "\n", '\n',
- NULL, _("Nickname"), 0, NULL);
-
- /* extract their RealName and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "RealName:", 1, "\n", '\n',
- NULL, _("Realname"), 0, NULL);
-
- /* extract their Location and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Location:", 2, "\n", '\n',
- NULL, _("Location"), 0, NULL);
-
- /* extract their Age and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Age:", 3, "\n", '\n',
- NULL, _("Age"), 0, NULL);
-
- /* extract their MaritalStatus and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "MaritalStatus:", 3, "\n", '\n',
- "No Answer", _("Marital Status"), 0, NULL);
-
- /* extract their Gender and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Gender:", 3, "\n", '\n',
- "No Answer", _("Gender"), 0, NULL);
-
- /* extract their Occupation and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Occupation:", 2, "\n", '\n',
- NULL, _("Occupation"), 0, NULL);
-
- /* Hobbies, Latest News, and Favorite Quote are a bit different, since the
- * values can contain embedded newlines... but any or all of them can also
- * not appear. The way we delimit them is to successively look for the next
- * one that _could_ appear, and if all else fails, we end the section by
- * looking for the 'Links' heading, which is the next thing to follow this
- * bunch.
- */
-
- if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Latest News",
- '\n', NULL, _("Hobbies"), 0, NULL))
- {
- if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Favorite Quote",
- '\n', NULL, _("Hobbies"), 0, NULL))
- {
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Links",
- '\n', NULL, _("Hobbies"), 0, NULL);
- }
- else
- found = TRUE;
- }
- else
- found = TRUE;
-
- if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Latest News:", 1, "Favorite Quote",
- '\n', NULL, _("Latest News"), 0, NULL))
- {
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Latest News:", 1, "Links",
- '\n', NULL, _("Latest News"), 0, NULL);
- }
- else
- found = TRUE;
-
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Favorite Quote:", 0, "Links",
- '\n', NULL, _("Favorite Quote"), 0, NULL);
-
- /* Home Page will either be "No home page specified",
- * or "Home Page: " and a link. */
- p = strstr(stripped, "No home page specified");
- if(!p)
- {
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Home Page:", 1, " ", 0, NULL,
- _("Home Page"), 1, NULL);
- }
-
- /* Cool Link {1,2,3} is also different. If "No cool link specified" exists,
- * then we have none. If we have one however, we'll need to check and see if
- * we have a second one. If we have a second one, we have to check to see if
- * we have a third one.
- */
- p = strstr(stripped,"No cool link specified");
- if (!p)
- {
- if (gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 1:", 1, " ", 0, NULL,
- _("Cool Link 1"), 1, NULL))
- {
- found = TRUE;
- if (gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 2:", 1, " ", 0, NULL,
- _("Cool Link 2"), 1, NULL))
- gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 3:", 1, " ", 0, NULL,
- _("Cool Link 3"), 1, NULL);
- }
- }
-
- /* see if Member Since is there, and if so, extract it. */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Member Since:", 1, "Last Updated:",
- '\n', NULL, _("Member Since"), 0, NULL);
-
- /* extract the Last Updated date and put it in */
- found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Last Updated:", 1, "\n", '\n', NULL,
- _("Last Updated"), 0, NULL);
-
- /* finish off the html */
- g_string_append(s, "\n");
- g_free(stripped);
-
- if(found)
- {
- /* show it to the user */
- gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
- s->str, NULL, NULL);
- }
- else
- {
- char *primary;
- primary = g_strdup_printf(_("User information for %s unavailable"), info_data->name);
- gaim_notify_error(info_data->gc, NULL, primary,
- _("The user's profile is empty."));
- g_free(primary);
- }
-
- g_free(url_buffer);
- g_string_free(s, TRUE);
- g_free(info_data->name);
- g_free(info_data);
-}
-
-static void yahoo_get_info(GaimConnection *gc, const char *name)
-{
- YahooGetInfoData *data;
- char *url;
-
- data = g_new0(YahooGetInfoData, 1);
- data->gc = gc;
- data->name = g_strdup(name);
-
- url = g_strdup_printf("%s%s", YAHOO_PROFILE_URL, name);
-
- gaim_url_fetch(url, FALSE, NULL, FALSE, yahoo_got_info, data);
-
- g_free(url);
-}
-
static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
const char *old_group, const char *new_group)
{