# HG changeset patch # User Stu Tomlinson # Date 1180805902 0 # Node ID 02abb6713cf247b64f8de24f4c76618aefe36b0e # Parent 83f10ac192d963a22bead87fd91ea6a29dc78fbe Improve parsing user info for MSN, Fixes #690 diff -r 83f10ac192d9 -r 02abb6713cf2 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Sat Jun 02 16:37:22 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Sat Jun 02 17:38:22 2007 +0000 @@ -1423,6 +1423,22 @@ if (found) \ sect_info = TRUE; +#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \ + found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ + "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \ + if (found) \ + sect_info = TRUE; + +static char * +msn_info_strip_search_link(const char *field, size_t len) +{ + const char *c; + if ((c = strstr(field, " (http://spaces.live.com/default.aspx?page=searchresults")) == NULL && + (c = strstr(field, " (http://spaces.msn.com/default.aspx?page=searchresults")) == NULL) + return g_strndup(field, len); + return g_strndup(field, c - field); +} + static void msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, const gchar *url_text, size_t len, const gchar *error_message) @@ -1538,10 +1554,10 @@ /* General */ MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname")); - MSN_GOT_INFO_GET_FIELD("Age", _("Age")); - MSN_GOT_INFO_GET_FIELD("Gender", _("Gender")); - MSN_GOT_INFO_GET_FIELD("Occupation", _("Occupation")); - MSN_GOT_INFO_GET_FIELD("Location", _("Location")); + MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age")); + MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Gender", _("Gender")); + MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Occupation", _("Occupation")); + MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Location", _("Location")); /* Extract their Interests and put it in */ found = purple_markup_extract_info_field(stripped, stripped_len, user_info, @@ -1802,7 +1818,10 @@ /* This doesn't work with the new spaces profiles - Stu 3/2/06 char *p = strstr(url_buffer, "Unknown Member "); * This might not work for long either ... */ + /* Nope, it failed some time before 5/2/07 :( char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); + * Let's see how long this one holds out for ... */ + char *p = strstr(url_buffer, "
gc), info_data->name); purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), diff -r 83f10ac192d9 -r 02abb6713cf2 libpurple/protocols/msn/msn.h --- a/libpurple/protocols/msn/msn.h Sat Jun 02 16:37:22 2007 +0000 +++ b/libpurple/protocols/msn/msn.h Sat Jun 02 17:38:22 2007 +0000 @@ -67,7 +67,7 @@ #define HOTMAIL_URL "http://www.hotmail.com/cgi-bin/folders" #define PASSPORT_URL "http://lc1.law13.hotmail.passport.com/cgi-bin/dologin?login=" -#define PROFILE_URL "http://spaces.msn.com/profile.aspx?mem=" +#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem=" #define USEROPT_HOTMAIL 0