Mercurial > pidgin.yaz
comparison libpurple/protocols/yahoo/yahoo_profile.c @ 25467:be098f796b32
yaz patch has been applied.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 25 Apr 2007 07:57:26 +0000 |
parents | 32c366eeeb99 |
children | fd6c3dc4641f |
comparison
equal
deleted
inserted
replaced
25466:46a28577399d | 25467:be098f796b32 |
---|---|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #define PHOTO_SUPPORT 1 | 24 #define PHOTO_SUPPORT 1 |
25 //original is 1 --yaz | |
25 | 26 |
26 #include "internal.h" | 27 #include "internal.h" |
27 #include "debug.h" | 28 #include "debug.h" |
28 #include "notify.h" | 29 #include "notify.h" |
29 #include "util.h" | 30 #include "util.h" |
735 yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, | 736 yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, |
736 const gchar *url_text, size_t len, const gchar *error_message); | 737 const gchar *url_text, size_t len, const gchar *error_message); |
737 | 738 |
738 #endif /* PHOTO_SUPPORT */ | 739 #endif /* PHOTO_SUPPORT */ |
739 | 740 |
741 #define PROF_LEN (1024 * 10) | |
740 static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, | 742 static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
741 const gchar *url_text, size_t len, const gchar *error_message) | 743 const gchar *url_text, size_t len, const gchar *error_message) |
742 { | 744 { |
743 YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; | 745 YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; |
744 PurpleNotifyUserInfo *user_info; | 746 PurpleNotifyUserInfo *user_info; |
985 } | 987 } |
986 if (p) { | 988 if (p) { |
987 g_free(stripped); | 989 g_free(stripped); |
988 stripped = purple_utf8_ncr_decode(p); | 990 stripped = purple_utf8_ncr_decode(p); |
989 stripped_len = strlen(stripped); | 991 stripped_len = strlen(stripped); |
992 | |
993 purple_debug_misc("yahoo", "after utf8 conversion: stripped@1 = (%s)\n", | |
994 stripped); //payload --yaz | |
990 g_free(p); | 995 g_free(p); |
991 } | 996 } |
992 } | 997 } |
993 p = NULL; | 998 p = NULL; |
994 | 999 |
996 if (strings && strings->charset != XX) { | 1001 if (strings && strings->charset != XX) { |
997 last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8", | 1002 last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8", |
998 strings->charset, NULL, NULL, NULL); | 1003 strings->charset, NULL, NULL, NULL); |
999 yahoo_remove_nonbreaking_spaces(last_updated_utf8_string); | 1004 yahoo_remove_nonbreaking_spaces(last_updated_utf8_string); |
1000 | 1005 |
1001 purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); | 1006 purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); //payload --yaz |
1002 } | 1007 } |
1003 | 1008 |
1004 if (profile_state == PROFILE_STATE_DEFAULT) { | 1009 if (profile_state == PROFILE_STATE_DEFAULT) { |
1005 #if 0 | 1010 #if 0 |
1006 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as | 1011 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as |
1028 purple_notify_user_info_add_pair(user_info, NULL, tmp); | 1033 purple_notify_user_info_add_pair(user_info, NULL, tmp); |
1029 g_free(tmp); | 1034 g_free(tmp); |
1030 } | 1035 } |
1031 } | 1036 } |
1032 #endif /* PHOTO_SUPPORT */ | 1037 #endif /* PHOTO_SUPPORT */ |
1038 purple_debug_info("yahoo", "email = %s\n", strings->my_email_string); | |
1033 | 1039 |
1034 /* extract their Email address and put it in */ | 1040 /* extract their Email address and put it in */ |
1035 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1041 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1036 strings->my_email_string, (yd->jp ? 4 : 1), " ", 0, | 1042 strings->my_email_string, (yd->jp ? 4 : 1), " ", 0, |
1037 strings->private_string, _("E-Mail"), 0, NULL, NULL); | 1043 strings->private_string, _("E-Mail"), 0, NULL, NULL); |
1038 | 1044 #if 0 |
1039 /* extract the Nickname if it exists */ | 1045 /* extract the Nickname if it exists */ |
1040 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1046 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1041 "Nickname:", 1, "\n", '\n', | 1047 "Nickname:", 1, "\n", '\n', |
1042 NULL, _("Nickname"), 0, NULL, NULL); | 1048 NULL, _("Nickname"), 0, NULL, NULL); |
1043 | 1049 |
1044 /* extract their RealName and put it in */ | 1050 /* extract their RealName and put it in */ |
1045 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1051 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1046 strings->realname_string, (yd->jp ? 3 : 1), "\n", '\n', | 1052 strings->realname_string, (yd->jp ? 3 : 1), "\n", '\n', |
1047 NULL, _("Real Name"), 0, NULL, NULL); | 1053 NULL, _("Real Name"), 0, NULL, NULL); |
1048 | 1054 |
1049 /* extract their Location and put it in */ | 1055 /* extract their Location and put it in */ |
1050 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1056 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1051 strings->location_string, (yd->jp ? 4 : 2), "\n", '\n', | 1057 strings->location_string, (yd->jp ? 4 : 2), "\n", '\n', |
1052 NULL, _("Location"), 0, NULL, NULL); | 1058 NULL, _("Location"), 0, NULL, NULL); |
1053 | 1059 |
1054 /* extract their Age and put it in */ | 1060 /* extract their Age and put it in */ |
1055 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1061 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1056 strings->age_string, (yd->jp ? 2 : 3), "\n", '\n', | 1062 strings->age_string, (yd->jp ? 2 : 3), "\n", '\n', |
1057 NULL, _("Age"), 0, NULL, NULL); | 1063 NULL, _("Age"), 0, NULL, NULL); |
1058 | 1064 |
1059 /* extract their MaritalStatus and put it in */ | 1065 /* extract their MaritalStatus and put it in */ |
1060 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1066 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1061 strings->maritalstatus_string, (yd->jp ? 2 : 3), "\n", '\n', | 1067 strings->maritalstatus_string, (yd->jp ? 2 : 3), "\n", '\n', |
1062 strings->no_answer_string, _("Marital Status"), 0, NULL, NULL); | 1068 strings->no_answer_string, _("Marital Status"), 0, NULL, NULL); |
1063 | 1069 |
1064 /* extract their Gender and put it in */ | 1070 /* extract their Gender and put it in */ |
1065 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1071 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1066 strings->gender_string, (yd->jp ? 2 : 3), "\n", '\n', | 1072 strings->gender_string, (yd->jp ? 2 : 3), "\n", '\n', |
1067 strings->no_answer_string, _("Gender"), 0, NULL, NULL); | 1073 strings->no_answer_string, _("Gender"), 0, NULL, NULL); |
1068 | 1074 |
1069 /* extract their Occupation and put it in */ | 1075 /* extract their Occupation and put it in */ |
1070 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1076 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1071 strings->occupation_string, 2, "\n", '\n', | 1077 strings->occupation_string, 2, "\n", '\n', |
1072 NULL, _("Occupation"), 0, NULL, NULL); | 1078 NULL, _("Occupation"), 0, NULL, NULL); |
1073 | 1079 #endif |
1074 /* Hobbies, Latest News, and Favorite Quote are a bit different, since | 1080 /* Hobbies, Latest News, and Favorite Quote are a bit different, since |
1075 * the values can contain embedded newlines... but any or all of them | 1081 * the values can contain embedded newlines... but any or all of them |
1076 * can also not appear. The way we delimit them is to successively | 1082 * can also not appear. The way we delimit them is to successively |
1077 * look for the next one that _could_ appear, and if all else fails, | 1083 * look for the next one that _could_ appear, and if all else fails, |
1078 * we end the section by looking for the 'Links' heading, which is the | 1084 * we end the section by looking for the 'Links' heading, which is the |
1079 * next thing to follow this bunch. (For Yahoo Japan, we check for | 1085 * next thing to follow this bunch. (For Yahoo Japan, we check for |
1080 * the "Description" ("Self PR") heading instead of "Links".) | 1086 * the "Description" ("Self PR") heading instead of "Links".) |
1081 */ | 1087 */ |
1082 | 1088 #if 0 |
1083 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1089 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1084 strings->hobbies_string, (yd->jp ? 3 : 1), strings->latest_news_string, | 1090 strings->hobbies_string, (yd->jp ? 3 : 1), strings->latest_news_string, |
1085 '\n', "\n", _("Hobbies"), 0, NULL, NULL)) | 1091 '\n', "\n", _("Hobbies"), 0, NULL, NULL)) |
1086 { | 1092 { |
1087 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1093 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1088 strings->hobbies_string, 1, strings->favorite_quote_string, | 1094 strings->hobbies_string, 1, strings->favorite_quote_string, |
1089 '\n', "\n", _("Hobbies"), 0, NULL, NULL)) | 1095 '\n', "\n", _("Hobbies"), 0, NULL, NULL)) |
1090 { | 1096 { |
1091 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1097 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1092 strings->hobbies_string, 1, strings->links_string, | 1098 strings->hobbies_string, 1, strings->links_string, |
1093 '\n', "\n", _("Hobbies"), 0, NULL, NULL); | 1099 '\n', "\n", _("Hobbies"), 0, NULL, NULL); |
1094 } | 1100 } |
1095 else | 1101 else |
1096 found = TRUE; | 1102 found = TRUE; |
1097 } | 1103 } |
1098 else | 1104 else |
1099 found = TRUE; | 1105 found = TRUE; |
1100 | 1106 |
1101 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1107 if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1102 strings->latest_news_string, 1, strings->favorite_quote_string, | 1108 strings->latest_news_string, 1, strings->favorite_quote_string, |
1103 '\n', "\n", _("Latest News"), 0, NULL, NULL)) | 1109 '\n', "\n", _("Latest News"), 0, NULL, NULL)) |
1104 { | 1110 { |
1105 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1111 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1106 strings->latest_news_string, (yd->jp ? 2 : 1), strings->links_string, | 1112 strings->latest_news_string, (yd->jp ? 2 : 1), strings->links_string, |
1107 '\n', "\n", _("Latest News"), 0, NULL, NULL); | 1113 '\n', "\n", _("Latest News"), 0, NULL, NULL); |
1108 } | 1114 } |
1109 else | 1115 else |
1110 found = TRUE; | 1116 found = TRUE; |
1111 | 1117 |
1112 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1118 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1113 strings->favorite_quote_string, 1, strings->links_string, | 1119 strings->favorite_quote_string, 1, strings->links_string, |
1114 '\n', "\n", _("Favorite Quote"), 0, NULL, NULL); | 1120 '\n', "\n", _("Favorite Quote"), 0, NULL, NULL); |
1115 | 1121 |
1116 /* Home Page will either be "No home page specified", | 1122 /* Home Page will either be "No home page specified", |
1117 * or "Home Page: " and a link. | 1123 * or "Home Page: " and a link. |
1118 * For Yahoo! Japan, if there is no home page specified, | 1124 * For Yahoo! Japan, if there is no home page specified, |
1119 * neither "No home page specified" nor "Home Page:" is shown. | 1125 * neither "No home page specified" nor "Home Page:" is shown. |
1123 strstr(stripped, strings->no_home_page_specified_string); | 1129 strstr(stripped, strings->no_home_page_specified_string); |
1124 if(!p) | 1130 if(!p) |
1125 { | 1131 { |
1126 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1132 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1127 strings->home_page_string, 1, "\n", 0, NULL, | 1133 strings->home_page_string, 1, "\n", 0, NULL, |
1128 _("Home Page"), 1, NULL, NULL); | 1134 _("Home Page"), 1, NULL, NULL); |
1129 } | 1135 } |
1130 } | 1136 } |
1131 | 1137 |
1132 /* Cool Link {1,2,3} is also different. If "No cool link specified" | 1138 /* Cool Link {1,2,3} is also different. If "No cool link specified" |
1133 * exists, then we have none. If we have one however, we'll need to | 1139 * exists, then we have none. If we have one however, we'll need to |
1138 strstr(stripped,strings->no_cool_link_specified_string); | 1144 strstr(stripped,strings->no_cool_link_specified_string); |
1139 if (!p) | 1145 if (!p) |
1140 { | 1146 { |
1141 if (purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1147 if (purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1142 strings->cool_link_1_string, 1, "\n", 0, NULL, | 1148 strings->cool_link_1_string, 1, "\n", 0, NULL, |
1143 _("Cool Link 1"), 1, NULL, NULL)) | 1149 _("Cool Link 1"), 1, NULL, NULL)) |
1144 { | 1150 { |
1145 found = TRUE; | 1151 found = TRUE; |
1146 if (purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1152 if (purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1147 strings->cool_link_2_string, 1, "\n", 0, NULL, | 1153 strings->cool_link_2_string, 1, "\n", 0, NULL, |
1148 _("Cool Link 2"), 1, NULL, NULL)) | 1154 _("Cool Link 2"), 1, NULL, NULL)) |
1156 | 1162 |
1157 if (last_updated_utf8_string != NULL) { | 1163 if (last_updated_utf8_string != NULL) { |
1158 /* see if Member Since is there, and if so, extract it. */ | 1164 /* see if Member Since is there, and if so, extract it. */ |
1159 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1165 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1160 "Member Since:", 1, last_updated_utf8_string, | 1166 "Member Since:", 1, last_updated_utf8_string, |
1161 '\n', NULL, _("Member Since"), 0, NULL, yahoo_info_date_reformat); | 1167 '\n', NULL, _("Member Since"), 0, NULL, yahoo_info_date_reformat); |
1162 | 1168 |
1163 /* extract the Last Updated date and put it in */ | 1169 /* extract the Last Updated date and put it in */ |
1164 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, | 1170 found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, |
1165 last_updated_utf8_string, (yd->jp ? 2 : 1), (yd->jp ? "\n" : " "), (yd->jp ? 0 : '\n'), NULL, | 1171 last_updated_utf8_string, (yd->jp ? 2 : 1), (yd->jp ? "\n" : " "), (yd->jp ? 0 : '\n'), NULL, |
1166 _("Last Update"), 0, NULL, (yd->jp ? NULL : yahoo_info_date_reformat)); | 1172 _("Last Update"), 0, NULL, (yd->jp ? NULL : yahoo_info_date_reformat)); |
1167 } | 1173 } |
1174 #endif | |
1168 } /* if (profile_state == PROFILE_STATE_DEFAULT) */ | 1175 } /* if (profile_state == PROFILE_STATE_DEFAULT) */ |
1169 | 1176 |
1170 if(!found) | 1177 if(!found) |
1171 { | 1178 { |
1172 GString *str = g_string_new(""); | 1179 GString *str = g_string_new(""); |