9162
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Gaim is the legal property of its developers, whose names are too numerous
|
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
6 * source distribution.
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 *
|
|
22 */
|
|
23
|
9242
|
24 #define PHOTO_SUPPORT 1
|
|
25
|
9162
|
26 #include "internal.h"
|
|
27 #include "debug.h"
|
|
28 #include "notify.h"
|
|
29 #include "util.h"
|
9242
|
30 #if PHOTO_SUPPORT
|
|
31 #include "imgstore.h"
|
|
32 #endif
|
9162
|
33
|
|
34 #include "yahoo.h"
|
9281
|
35 #include "yahoo_friend.h"
|
9162
|
36
|
9510
|
37
|
9162
|
38 typedef struct {
|
|
39 GaimConnection *gc;
|
|
40 char *name;
|
|
41 } YahooGetInfoData;
|
|
42
|
|
43
|
|
44 typedef enum profile_lang_id {
|
|
45 XX, DA, DE, EL,
|
|
46 EN, EN_GB,
|
|
47 ES_AR, ES_ES, ES_MX, ES_US,
|
|
48 FR_CA, FR_FR,
|
|
49 IT, JA, KO, NO, PT, SV,
|
|
50 ZH_CN, ZH_HK, ZH_TW, ZH_US
|
|
51 } profile_lang_id_t;
|
|
52
|
|
53 typedef struct profile_lang_node {
|
|
54 profile_lang_id_t lang;
|
|
55 char *last_updated_string;
|
|
56 char *det;
|
|
57 } profile_lang_node_t;
|
|
58
|
|
59 typedef struct profile_strings_node {
|
|
60 profile_lang_id_t lang;
|
|
61 char *lang_string; /* Only to make debugging output saner */
|
|
62 char *charset;
|
|
63 char *yahoo_id_string;
|
|
64 char *private_string;
|
|
65 char *no_answer_string;
|
|
66 char *my_email_string;
|
|
67 char *realname_string;
|
|
68 char *location_string;
|
|
69 char *age_string;
|
|
70 char *maritalstatus_string;
|
|
71 char *gender_string;
|
|
72 char *occupation_string;
|
|
73 char *hobbies_string;
|
|
74 char *latest_news_string;
|
|
75 char *favorite_quote_string;
|
|
76 char *links_string;
|
|
77 char *no_home_page_specified_string;
|
|
78 char *home_page_string;
|
|
79 char *no_cool_link_specified_string;
|
|
80 char *cool_link_1_string;
|
|
81 char *cool_link_2_string;
|
|
82 char *cool_link_3_string;
|
|
83 char *dummy;
|
|
84 } profile_strings_node_t;
|
|
85
|
9242
|
86
|
9510
|
87 typedef enum profile_state {
|
|
88 PROFILE_STATE_DEFAULT,
|
|
89 PROFILE_STATE_NOT_FOUND,
|
|
90 PROFILE_STATE_UNKNOWN_LANGUAGE
|
|
91 } profile_state_t;
|
|
92
|
|
93
|
9242
|
94 typedef struct {
|
|
95 YahooGetInfoData *info_data;
|
|
96 char *url_buffer;
|
|
97 GString *s;
|
|
98 char *photo_url_text;
|
|
99 char *profile_url_text;
|
|
100 char *tooltip_text;
|
|
101 const profile_strings_node_t *strings;
|
|
102 const char *last_updated_string;
|
9510
|
103 const char *title;
|
|
104 profile_state_t profile_state;
|
9242
|
105 } YahooGetInfoStepTwoData;
|
|
106
|
|
107
|
9162
|
108 /* Strings to determine the profile "language" (more accurately "locale").
|
|
109 * Strings in this list must be in the original charset in the profile.
|
|
110 * The "Last Updated" string is used, but sometimes is not sufficient to
|
|
111 * distinguish 2 locales with this (e.g., ES_ES from ES_US, or FR_CA from
|
|
112 * FR_FR, or EL from EN_GB), in which case a second string is added and
|
|
113 * such special cases must be placed before the more general case.
|
|
114 */
|
|
115 static const profile_lang_node_t profile_langs[] = {
|
|
116 { DA, "Opdateret sidste gang ", NULL },
|
|
117 { DE, "Letzter Update ", NULL },
|
|
118 { EL, "Last Updated:", "http://gr.profiles.yahoo.com" },
|
|
119 { EN_GB, "Last Updated ", "Favourite Quote" },
|
|
120 { EN, "Last Updated:", NULL },
|
|
121 { EN, "Last Updated ", NULL },
|
|
122 { ES_AR, "\332ltima actualizaci\363n ", NULL },
|
|
123 { ES_ES, "Actualizada el ", "http://es.profiles.yahoo.com" },
|
|
124 { ES_MX, "Actualizada el ", "http://mx.profiles.yahoo.com" },
|
|
125 { ES_US, "Actualizada el ", NULL },
|
|
126 { FR_CA, "Derni\xe8re mise \xe0 jour", "http://cf.profiles.yahoo.com" },
|
|
127 { FR_FR, "Derni\xe8re mise \xe0 jour", NULL },
|
|
128 { IT, "Ultimo aggiornamento ", NULL },
|
|
129 { JA, "\xba\xc7\xbd\xaa\xb9\xb9\xbf\xb7\xc6\xfc\xa1\xa7", NULL },
|
|
130 { KO, "\xb0\xbb\xbd\xc5\x20\xb3\xaf\xc2\xa5 ", NULL },
|
|
131 { NO, "Sist oppdatert ", NULL },
|
|
132 { PT, "\332ltima atualiza\347\343o ", NULL },
|
|
133 { SV, "Senast uppdaterad ", NULL },
|
|
134 { ZH_CN, "\xd7\xee\xba\xf3\xd0\xde\xb8\xc4\xc8\xd5\xc6\xda", NULL },
|
|
135 { ZH_HK, "\xb3\xcc\xaa\xf1\xa7\xf3\xb7\x73\xae\xc9\xb6\xa1", NULL },
|
|
136 { ZH_US, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", "http://chinese.profiles.yahoo.com" },
|
|
137 { ZH_TW, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", NULL },
|
|
138 { XX, NULL, NULL }
|
|
139 };
|
|
140
|
|
141 /* Strings in this list must be in UTF-8; 's should be specified as spaces. */
|
|
142 static const profile_strings_node_t profile_strings[] = {
|
|
143 { DA, "da", "ISO-8859-1",
|
|
144 "Yahoo! ID:",
|
|
145 "Privat",
|
|
146 "Intet svar",
|
|
147 "Min Email",
|
|
148 "Rigtige navn:",
|
|
149 "Opholdssted:",
|
|
150 "Alder:",
|
|
151 "Ægteskabelig status:",
|
|
152 "Køn:",
|
|
153 "Erhverv:",
|
|
154 "Hobbyer:",
|
|
155 "Sidste nyt:",
|
|
156 "Favoritcitat",
|
|
157 "Links",
|
|
158 "Ingen hjemmeside specificeret",
|
|
159 "Forside:",
|
|
160 "Intet cool link specificeret",
|
|
161 "Cool link 1:",
|
|
162 "Cool link 2:",
|
|
163 "Cool link 3:",
|
|
164 NULL
|
|
165 },
|
|
166 { DE, "de", "ISO-8859-1",
|
|
167 "Yahoo!-ID:",
|
|
168 "Privat",
|
|
169 "Keine Antwort",
|
|
170 "Meine E-Mail",
|
|
171 "Realer Name:",
|
|
172 "Ort:",
|
|
173 "Alter:",
|
|
174 "Familienstand:",
|
|
175 "Geschlecht:",
|
|
176 "Beruf:",
|
|
177 "Hobbys:",
|
|
178 "Neuste Nachrichten:",
|
|
179 "Mein Lieblingsspruch",
|
|
180 "Links",
|
|
181 "Keine Homepage angegeben",
|
|
182 "Homepage:",
|
|
183 "Keinen coolen Link angegeben",
|
|
184 "Cooler Link 1:",
|
|
185 "Cooler Link 2:",
|
|
186 "Cooler Link 3:",
|
|
187 NULL
|
|
188 },
|
|
189 { EL, "el", "ISO-8859-7", /* EL is identical to EN, except no_answer_string */
|
|
190 "Yahoo! ID:",
|
|
191 "Private",
|
|
192 "Καμία απάντηση",
|
|
193 "My Email",
|
|
194 "Real Name:",
|
|
195 "Location:",
|
|
196 "Age:",
|
|
197 "Marital Status:",
|
|
198 "Gender:",
|
|
199 "Occupation:",
|
|
200 "Hobbies:",
|
|
201 "Latest News",
|
|
202 "Favorite Quote",
|
|
203 "Links",
|
|
204 "No home page specified",
|
|
205 "Home Page:",
|
|
206 "No cool link specified",
|
|
207 "Cool Link 1:",
|
|
208 "Cool Link 2:",
|
|
209 "Cool Link 3:",
|
|
210 NULL
|
|
211 },
|
|
212 { EN, "en", "ISO-8859-1",
|
|
213 "Yahoo! ID:",
|
|
214 "Private",
|
|
215 "No Answer",
|
|
216 "My Email",
|
|
217 "Real Name:",
|
|
218 "Location:",
|
|
219 "Age:",
|
|
220 "Marital Status:",
|
|
221 "Gender:",
|
|
222 "Occupation:",
|
|
223 "Hobbies:",
|
|
224 "Latest News",
|
|
225 "Favorite Quote",
|
|
226 "Links",
|
|
227 "No home page specified",
|
|
228 "Home Page:",
|
|
229 "No cool link specified",
|
|
230 "Cool Link 1:",
|
|
231 "Cool Link 2:",
|
|
232 "Cool Link 3:",
|
|
233 NULL
|
|
234 },
|
|
235 { EN_GB, "en_GB", "ISO-8859-1", /* Same as EN except spelling of "Favourite" */
|
|
236 "Yahoo! ID:",
|
|
237 "Private",
|
|
238 "No Answer",
|
|
239 "My Email",
|
|
240 "Real Name:",
|
|
241 "Location:",
|
|
242 "Age:",
|
|
243 "Marital Status:",
|
|
244 "Gender:",
|
|
245 "Occupation:",
|
|
246 "Hobbies:",
|
|
247 "Latest News",
|
|
248 "Favourite Quote",
|
|
249 "Links",
|
|
250 "No home page specified",
|
|
251 "Home Page:",
|
|
252 "No cool link specified",
|
|
253 "Cool Link 1:",
|
|
254 "Cool Link 2:",
|
|
255 "Cool Link 3:",
|
|
256 NULL
|
|
257 },
|
|
258 { ES_AR, "es_AR", "ISO-8859-1",
|
|
259 "Usuario de Yahoo!:",
|
|
260 "Privado",
|
|
261 "No introdujiste una respuesta",
|
|
262 "Mi dirección de correo electrónico",
|
|
263 "Nombre real:",
|
|
264 "Ubicación:",
|
|
265 "Edad:",
|
|
266 "Estado civil:",
|
|
267 "Sexo:",
|
|
268 "Ocupación:",
|
|
269 "Pasatiempos:",
|
|
270 "Últimas noticias:",
|
|
271 "Tu cita favorita",
|
|
272 "Enlaces",
|
|
273 "Ninguna página de inicio especificada",
|
|
274 "Página de inicio:",
|
|
275 "Ningún enlace preferido",
|
|
276 "Enlace genial 1:",
|
|
277 "Enlace genial 2:",
|
|
278 "Enlace genial 3:",
|
|
279 NULL
|
|
280 },
|
|
281 { ES_ES, "es_ES", "ISO-8859-1",
|
|
282 "ID de Yahoo!:",
|
|
283 "Privado",
|
|
284 "Sin respuesta",
|
|
285 "Mi correo-e",
|
|
286 "Nombre verdadero:",
|
|
287 "Lugar:",
|
|
288 "Edad:",
|
|
289 "Estado civil:",
|
|
290 "Sexo:",
|
|
291 "Ocupación:",
|
|
292 "Aficiones:",
|
|
293 "Ultimas Noticias:",
|
|
294 "Tu cita Favorita",
|
|
295 "Enlace",
|
|
296 "Ninguna página personal especificada",
|
|
297 "Página de Inicio:",
|
|
298 "Ningún enlace preferido",
|
|
299 "Enlaces Preferidos 1:",
|
|
300 "Enlaces Preferidos 2:",
|
|
301 "Enlaces Preferidos 3:",
|
|
302 NULL
|
|
303 },
|
|
304 { ES_MX, "es_MX", "ISO-8859-1",
|
|
305 "ID de Yahoo!:",
|
|
306 "Privado",
|
|
307 "Sin responder",
|
|
308 "Mi Dirección de correo-e",
|
|
309 "Nombre real:",
|
|
310 "Ubicación:",
|
|
311 "Edad:",
|
|
312 "Estado civil:",
|
|
313 "Sexo:",
|
|
314 "Ocupación:",
|
|
315 "Pasatiempos:",
|
|
316 "Ultimas Noticias:",
|
|
317 "Su cita favorita",
|
|
318 "Enlaces",
|
|
319 "Ninguna Página predefinida",
|
|
320 "Página web:",
|
|
321 "Ningún Enlace preferido",
|
|
322 "Enlaces Preferidos 1:",
|
|
323 "Enlaces Preferidos 2:",
|
|
324 "Enlaces Preferidos 3:",
|
|
325 NULL
|
|
326 },
|
|
327 { ES_US, "es_US", "ISO-8859-1",
|
|
328 "ID de Yahoo!:",
|
|
329 "Privado",
|
|
330 "No introdujo una respuesta",
|
|
331 "Mi Dirección de correo-e",
|
|
332 "Nombre real:",
|
|
333 "Localidad:",
|
|
334 "Edad:",
|
|
335 "Estado civil:",
|
|
336 "Sexo:",
|
|
337 "Ocupación:",
|
|
338 "Pasatiempos:",
|
|
339 "Ultimas Noticias:",
|
|
340 "Su cita Favorita",
|
|
341 "Enlaces",
|
|
342 "Ninguna Página de inicio predefinida",
|
|
343 "Página de inicio:",
|
|
344 "Ningún Enlace preferido",
|
|
345 "Enlaces Preferidos 1:",
|
|
346 "Enlaces Preferidos 2:",
|
|
347 "Enlaces Preferidos 3:",
|
|
348 NULL
|
|
349 },
|
|
350 { FR_CA, "fr_CA", "ISO-8859-1",
|
|
351 "Compte Yahoo!:",
|
|
352 "Privé",
|
|
353 "Sans réponse",
|
|
354 "Mon courriel",
|
|
355 "Nom réel:",
|
|
356 "Lieu:",
|
|
357 "Âge:",
|
|
358 "État civil:",
|
|
359 "Sexe:",
|
|
360 "Profession:",
|
|
361 "Passe-temps:",
|
|
362 "Actualités:",
|
|
363 "Citation préférée",
|
|
364 "Liens",
|
|
365 "Pas de mention d'une page personnelle",
|
|
366 "Page personnelle:",
|
|
367 "Pas de mention d'un lien favori",
|
|
368 "Lien préféré 1:",
|
|
369 "Lien préféré 2:",
|
|
370 "Lien préféré 3:",
|
|
371 NULL
|
|
372 },
|
|
373 { FR_FR, "fr_FR", "ISO-8859-1",
|
|
374 "Compte Yahoo!:",
|
|
375 "Privé",
|
|
376 "Sans réponse",
|
|
377 "Mon E-mail",
|
|
378 "Nom réel:",
|
|
379 "Lieu:",
|
|
380 "Âge:",
|
|
381 "Situation de famille:",
|
|
382 "Sexe:",
|
|
383 "Profession:",
|
|
384 "Centres d'intérêts:",
|
|
385 "Actualités:",
|
|
386 "Citation préférée",
|
|
387 "Liens",
|
|
388 "Pas de mention d'une page perso",
|
|
389 "Page perso:",
|
|
390 "Pas de mention d'un lien favori",
|
|
391 "Lien préféré 1:",
|
|
392 "Lien préféré 2:",
|
|
393 "Lien préféré 3:",
|
|
394 NULL
|
|
395 },
|
|
396 { IT, "it", "ISO-8859-1",
|
|
397 "ID Yahoo!:",
|
|
398 "Non pubblica",
|
|
399 "Nessuna risposta",
|
|
400 "La mia e-mail",
|
|
401 "Nome vero:",
|
|
402 "Località:",
|
|
403 "Eta':",
|
|
404 "Stato civile:",
|
|
405 "Sesso:",
|
|
406 "Occupazione:",
|
|
407 "Hobby:",
|
|
408 "Ultime notizie:",
|
|
409 "Citazione preferita",
|
|
410 "Link",
|
|
411 "Nessuna home page specificata",
|
|
412 "Inizio:",
|
|
413 "Nessun link specificato",
|
|
414 "Link Preferiti 1:",
|
|
415 "Link Preferiti 2:",
|
|
416 "Link Preferiti 3:",
|
|
417 NULL
|
|
418 },
|
|
419 { JA, "ja", "EUC-JP",
|
|
420 "Yahoo! JAPAN ID:",
|
|
421 "非公開",
|
|
422 "無回答",
|
|
423 "メール:",
|
|
424 "名前:",
|
|
425 "住所:",
|
|
426 "年齢:",
|
|
427 "未婚/既婚:",
|
|
428 "性別:",
|
|
429 "職業:",
|
|
430 "趣味:",
|
|
431 "最近の出来事:",
|
|
432 NULL,
|
|
433 #if 0
|
|
434 "おすすめサイト",
|
|
435 #else
|
|
436 "自己PR", /* "Self description" comes before "Links" for yahoo.co.jp */
|
|
437 #endif
|
|
438 NULL,
|
|
439 NULL,
|
|
440 NULL,
|
|
441 "おすすめサイト1:",
|
|
442 "おすすめサイト2:",
|
|
443 "おすすめサイト3:",
|
|
444 NULL
|
|
445 },
|
|
446 { KO, "ko", "EUC-KR",
|
|
447 "야후! ID:",
|
|
448 "비공개",
|
|
449 "비공개",
|
|
450 "My Email",
|
|
451 "실명:",
|
|
452 "거주지:",
|
|
453 "나이:",
|
|
454 "결혼 여부:",
|
|
455 "성별:",
|
|
456 "직업:",
|
|
457 "취미:",
|
|
458 "자기 소개:",
|
|
459 "좋아하는 명언",
|
|
460 "링크",
|
|
461 "홈페이지를 지정하지 않았습니다.",
|
|
462 "홈페이지:",
|
|
463 "추천 사이트가 없습니다.",
|
|
464 "추천 사이트 1:",
|
|
465 "추천 사이트 2:",
|
|
466 "추천 사이트 3:",
|
|
467 NULL
|
|
468 },
|
|
469 { NO, "no", "ISO-8859-1",
|
|
470 "Yahoo! ID:",
|
|
471 "Privat",
|
|
472 "Ikke noe svar",
|
|
473 "Min e-post",
|
|
474 "Virkelig navn:",
|
|
475 "Sted:",
|
|
476 "Alder:",
|
|
477 "Sivilstatus:",
|
|
478 "Kjønn:",
|
|
479 "Yrke:",
|
|
480 "Hobbyer:",
|
|
481 "Siste nytt:",
|
|
482 "Yndlingssitat",
|
|
483 "Lenker",
|
|
484 "Ingen hjemmeside angitt",
|
|
485 "Hjemmeside:",
|
|
486 "No cool link specified",
|
|
487 "Bra lenke 1:",
|
|
488 "Bra lenke 2:",
|
|
489 "Bra lenke 3:",
|
|
490 NULL
|
|
491 },
|
|
492 { PT, "pt", "ISO-8859-1",
|
|
493 "ID Yahoo!:",
|
|
494 "Particular",
|
|
495 "Sem resposta",
|
|
496 "Meu e-mail",
|
|
497 "Nome verdadeiro:",
|
|
498 "Local:",
|
|
499 "Idade:",
|
|
500 "Estado civil:",
|
|
501 "Sexo:",
|
|
502 "Ocupação:",
|
|
503 "Hobbies:",
|
|
504 "Últimas notícias:",
|
|
505 "Frase favorita",
|
|
506 "Links",
|
|
507 "Nenhuma página pessoal especificada",
|
|
508 "Página pessoal:",
|
|
509 "Nenhum site legal especificado",
|
|
510 "Site legal 1:",
|
|
511 "Site legal 2:",
|
|
512 "Site legal 3:",
|
|
513 NULL
|
|
514 },
|
|
515 { SV, "sv", "ISO-8859-1",
|
|
516 "Yahoo!-ID:",
|
|
517 "Privat",
|
|
518 "Inget svar",
|
|
519 "Min mail",
|
|
520 "Riktigt namn:",
|
|
521 "Plats:",
|
|
522 "Ålder:",
|
|
523 "Civilstånd:",
|
|
524 "Kön:",
|
|
525 "Yrke:",
|
|
526 "Hobby:",
|
|
527 "Senaste nytt:",
|
|
528 "Favoritcitat",
|
|
529 "Länkar",
|
|
530 "Ingen hemsida specificerad",
|
|
531 "Hemsida:",
|
|
532 "Ingen cool länk specificerad",
|
|
533 "Coola länkar 1:",
|
|
534 "Coola länkar 2:",
|
|
535 "Coola länkar 3:",
|
|
536 NULL
|
|
537 },
|
|
538 { ZH_CN, "zh_CN", "GB2312",
|
|
539 "Yahoo! ID:",
|
|
540 "没有提供",
|
|
541 "没有回答",
|
|
542 "个人电邮地址",
|
|
543 "真实姓名:",
|
|
544 "所在地点:",
|
|
545 "年龄:",
|
|
546 "婚姻状况:",
|
|
547 "性别:",
|
|
548 "职业:",
|
|
549 "业余爱好:",
|
|
550 "个人近况:",
|
|
551 "喜欢的引言",
|
|
552 "链接",
|
|
553 "没有个人主页",
|
|
554 "个人主页:",
|
|
555 "没有推荐网站链接",
|
|
556 "推荐网站链接 1:",
|
|
557 "推荐网站链接 2:",
|
|
558 "推荐网站链接 3:",
|
|
559 NULL
|
|
560 },
|
|
561 { ZH_HK, "zh_HK", "Big5",
|
|
562 "Yahoo! ID:",
|
|
563 "私人的",
|
|
564 "沒有回答",
|
|
565 "電子信箱",
|
|
566 "真實姓名:",
|
|
567 "地點:",
|
|
568 "年齡:",
|
|
569 "婚姻狀況:",
|
|
570 "性別:",
|
|
571 "職業:",
|
|
572 "嗜好:",
|
|
573 "最新消息:",
|
|
574 "最喜愛的股票叫價", /* [sic] Yahoo!'s translators don't check context */
|
|
575 "連結",
|
|
576 "沒有注明個人網頁", /* [sic] */
|
|
577 "個人網頁:",
|
|
578 "沒有注明 Cool 連結", /* [sic] */
|
|
579 "Cool 連結 1:", /* TODO */
|
|
580 "Cool 連結 2:", /* TODO */
|
|
581 "Cool 連結 3:", /* TODO */
|
|
582 NULL
|
|
583 },
|
|
584 { ZH_TW, "zh_TW", "Big5",
|
|
585 "帳 號:",
|
|
586 "沒有提供",
|
|
587 "沒有回應",
|
|
588 "電子信箱",
|
|
589 "姓名:",
|
|
590 "地點:",
|
|
591 "年齡:",
|
|
592 "婚姻狀態:",
|
|
593 "性別:",
|
|
594 "職業:",
|
|
595 "興趣:",
|
|
596 "個人近況:",
|
|
597 "喜歡的名句",
|
|
598 "連結",
|
|
599 "沒有個人網頁",
|
|
600 "個人網頁:",
|
|
601 "沒有推薦網站連結",
|
|
602 "推薦網站連結 1:",
|
|
603 "推薦網站連結 2:",
|
|
604 "推薦網站連結 3:",
|
|
605 NULL
|
|
606 },
|
|
607 { ZH_US, "zh_US", "Big5", /* ZH_US is like ZH_TW, but also a bit like ZH_HK */
|
|
608 "Yahoo! ID:",
|
|
609 "沒有提供",
|
|
610 "沒有回答",
|
|
611 "個人Email地址",
|
|
612 "真實姓名:",
|
|
613 "地點:",
|
|
614 "年齡:",
|
|
615 "婚姻狀態:",
|
|
616 "性別:",
|
|
617 "職業:",
|
|
618 "嗜好:",
|
|
619 "個人近況:",
|
|
620 "喜歡的名句",
|
|
621 "連結",
|
|
622 "沒有個人網頁",
|
|
623 "個人網頁:",
|
|
624 "沒有推薦網站連結",
|
|
625 "推薦網站連結 1:", /* TODO */
|
|
626 "推薦網站連結 2:", /* TODO */
|
|
627 "推薦網站連結 3:", /* TODO */
|
|
628 NULL
|
|
629 },
|
|
630 { XX, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
631 };
|
|
632
|
|
633 static char *yahoo_remove_nonbreaking_spaces(char *str)
|
|
634 {
|
|
635 char *p;
|
|
636 while ((p = strstr(str, " ")) != NULL) {
|
|
637 *p = ' '; /* Turn 's into ordinary blanks */
|
|
638 p += 1;
|
|
639 memmove(p, p + 5, strlen(p + 5));
|
|
640 str[strlen(str) - 5] = '\0';
|
|
641 }
|
|
642 return str;
|
|
643 }
|
|
644
|
9242
|
645 static char *yahoo_tooltip_info_text(YahooGetInfoData *info_data) {
|
|
646 GString *s = g_string_sized_new(80); /* wild guess */
|
|
647 GaimBuddy *b;
|
9281
|
648 YahooFriend *f;
|
9242
|
649
|
9510
|
650 g_string_printf(s, "<span style=\"font-size: larger\"><b>%s</b></span><br>",
|
|
651 info_data->name);
|
9242
|
652 b = gaim_find_buddy(gaim_connection_get_account(info_data->gc),
|
|
653 info_data->name);
|
|
654
|
|
655 if (b) {
|
|
656 char *statustext = yahoo_tooltip_text(b);
|
|
657 if(b->alias && b->alias[0]) {
|
|
658 char *aliastext = g_markup_escape_text(b->alias, -1);
|
|
659 g_string_append_printf(s, _("<b>Alias:</b> %s<br>"), aliastext);
|
|
660 g_free(aliastext);
|
|
661 }
|
9984
|
662 #if 0
|
9242
|
663 if (b->idle > 0) {
|
|
664 char *idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
|
|
665 g_string_append_printf(s, _("<b>%s:</b> %s<br>"), _("Idle"),
|
|
666 idletime);
|
|
667 g_free(idletime);
|
|
668 }
|
9984
|
669 #endif
|
9242
|
670 if (statustext) {
|
|
671 g_string_append_printf(s, "%s<br>", statustext);
|
|
672 g_free(statustext);
|
|
673 }
|
9281
|
674 if ((f = yahoo_friend_find(info_data->gc, b->name))) {
|
|
675 const char *ip;
|
|
676 if ((ip = yahoo_friend_get_ip(f)))
|
|
677 g_string_append_printf(s, _("<b>IP Address:</b> %s<br>"), ip);
|
|
678 }
|
|
679
|
9242
|
680 }
|
|
681
|
|
682 return g_string_free(s, FALSE);
|
|
683 }
|
|
684
|
|
685 #if PHOTO_SUPPORT
|
|
686
|
|
687 static char *yahoo_get_photo_url(const char *url_text, const char *name) {
|
|
688 GString *s = g_string_sized_new(strlen(name) + 8);
|
|
689 char *p;
|
|
690 char *it = NULL;
|
|
691
|
|
692 g_string_printf(s, " alt=\"%s\">", name);
|
|
693 p = strstr(url_text, s->str);
|
|
694
|
|
695 if (p) {
|
|
696 /* Search backwards for "http://". This is stupid, but it works. */
|
|
697 for (; !it && p > url_text; p -= 1) {
|
|
698 if (strncmp(p, "\"http://", 8) == 0) {
|
|
699 char *q;
|
|
700 p += 1; /* skip only the " */
|
|
701 q = strchr(p, '"');
|
|
702 if (q) {
|
|
703 it = g_strndup(p, q - p);
|
|
704 }
|
|
705 }
|
|
706 }
|
|
707 }
|
|
708
|
|
709 g_string_free(s, TRUE);
|
|
710 return it;
|
|
711 }
|
|
712
|
|
713 static void yahoo_got_photo(void *data, const char *url_text, size_t len);
|
|
714
|
|
715 #endif /* PHOTO_SUPPORT */
|
|
716
|
9162
|
717 static void yahoo_got_info(void *data, const char *url_text, size_t len)
|
|
718 {
|
|
719 YahooGetInfoData *info_data = (YahooGetInfoData *)data;
|
9242
|
720 char *p;
|
9162
|
721 char buf[1024];
|
9242
|
722 #if PHOTO_SUPPORT
|
|
723 YahooGetInfoStepTwoData *info2_data;
|
|
724 char *photo_url_text = NULL;
|
|
725 #else
|
9162
|
726 gboolean found = FALSE;
|
9242
|
727 char *stripped;
|
|
728 int stripped_len;
|
|
729 char *last_updated_utf8_string = NULL;
|
|
730 #endif
|
|
731 const char *last_updated_string = NULL;
|
9162
|
732 char *url_buffer;
|
|
733 GString *s;
|
9242
|
734 char *tooltip_text = NULL;
|
|
735 char *profile_url_text = NULL;
|
9162
|
736 int lang, strid;
|
9221
|
737 struct yahoo_data *yd;
|
9242
|
738 const profile_strings_node_t *strings = NULL;
|
9510
|
739 const char *title;
|
|
740 profile_state_t profile_state = PROFILE_STATE_DEFAULT;
|
9221
|
741
|
|
742 if (!GAIM_CONNECTION_IS_VALID(info_data->gc)) {
|
|
743 g_free(info_data->name);
|
|
744 g_free(info_data);
|
|
745 return;
|
|
746 }
|
9162
|
747
|
|
748 gaim_debug_info("yahoo", "In yahoo_got_info\n");
|
|
749
|
9221
|
750 yd = info_data->gc->proto_data;
|
9510
|
751 title = (yd->jp? _("Yahoo! Japan Profile") :
|
|
752 _("Yahoo! Profile"));
|
9242
|
753
|
|
754 /* Get the tooltip info string */
|
|
755 tooltip_text = yahoo_tooltip_info_text(info_data);
|
9221
|
756
|
9242
|
757 /* We failed to grab the profile URL. This is not expected to actually
|
|
758 * happen except under unusual error conditions, as Yahoo is observed
|
|
759 * to send back HTML, with a 200 status code.
|
|
760 */
|
9162
|
761 if (url_text == NULL || strcmp(url_text, "") == 0) {
|
9242
|
762 g_snprintf(buf, 1024, "<html><body>%s<b>%s</b></body></html>",
|
|
763 tooltip_text, _("Error retrieving profile"));
|
|
764
|
9797
|
765 gaim_notify_userinfo(info_data->gc, info_data->name, NULL, title,
|
|
766 NULL, buf, NULL, NULL);
|
9162
|
767
|
9242
|
768 g_free(profile_url_text);
|
|
769 g_free(tooltip_text);
|
9162
|
770 g_free(info_data->name);
|
|
771 g_free(info_data);
|
|
772 return;
|
|
773 }
|
|
774
|
9242
|
775 /* Construct the correct profile URL */
|
|
776 s = g_string_sized_new(80); /* wild guess */
|
|
777 g_string_printf(s, "%s%s", (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL),
|
|
778 info_data->name);
|
|
779 profile_url_text = g_string_free(s, FALSE);
|
|
780 s = NULL;
|
|
781
|
|
782 /* We don't yet support the multiple link level of the warning page for
|
9162
|
783 * 'adult' profiles, not to mention the fact that yahoo wants you to be
|
9242
|
784 * logged in (on the website) to be able to view an 'adult' profile. For
|
9162
|
785 * now, just tell them that we can't help them, and provide a link to the
|
|
786 * profile if they want to do the web browser thing.
|
|
787 */
|
|
788 p = strstr(url_text, "Adult Profiles Warning Message");
|
9242
|
789 if (!p) {
|
|
790 p = strstr(url_text, "Adult Content Warning"); /* TITLE element */
|
|
791 }
|
9162
|
792 if (p) {
|
9242
|
793 g_snprintf(buf, 1024, "<html><body>%s<b>%s</b><br><br>\n"
|
|
794 "%s<br><a href=\"%s\">%s</a></body></html>",
|
|
795 tooltip_text,
|
|
796 _("Sorry, profiles marked as containing adult content "
|
|
797 "are not supported at this time."),
|
|
798 _("If you wish to view this profile, "
|
|
799 "you will need to visit this link in your web browser"),
|
|
800 profile_url_text, profile_url_text);
|
9162
|
801
|
9797
|
802 gaim_notify_userinfo(info_data->gc, info_data->name, NULL, title,
|
|
803 NULL, buf, NULL, NULL);
|
9162
|
804
|
9242
|
805 g_free(profile_url_text);
|
|
806 g_free(tooltip_text);
|
9162
|
807 g_free(info_data->name);
|
|
808 g_free(info_data);
|
|
809 return;
|
|
810 }
|
|
811
|
|
812 /* Check whether the profile is written in a supported language */
|
|
813 for (lang = 0;; lang += 1) {
|
|
814 last_updated_string = profile_langs[lang].last_updated_string;
|
|
815 if (!last_updated_string) break;
|
|
816 p = strstr(url_text, last_updated_string);
|
|
817 if (p && profile_langs[lang].det && !strstr(url_text, profile_langs[lang].det)) {
|
|
818 p = NULL;
|
|
819 }
|
|
820 if (p) break;
|
|
821 }
|
|
822 if (p) {
|
|
823 for (strid = 0; profile_strings[strid].lang != XX; strid += 1) {
|
9221
|
824 if (profile_strings[strid].lang == profile_langs[lang].lang) break;
|
9162
|
825 }
|
9242
|
826 strings = profile_strings + strid;
|
9162
|
827 gaim_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang);
|
|
828 }
|
|
829
|
9220
|
830 /* Every user may choose his/her own profile language, and this language
|
|
831 * has nothing to do with the preferences of the user which looks at the
|
|
832 * profile. We try to support all languages, but nothing is guaranteed.
|
9242
|
833 * If we cannot determine the language, it means either (1) the profile
|
|
834 * is written in an unsupported language, (2) our language support is
|
|
835 * out of date, or (3) the user is not found.
|
9162
|
836 */
|
9242
|
837 if (!p || strings->lang == XX) {
|
|
838 if (!strstr(url_text, "Yahoo! Member Directory - User not found")
|
|
839 && !strstr(url_text, "was not found on this server.")
|
|
840 && !strstr(url_text, "\xb8\xf8\xb3\xab\xa5\xd7\xa5\xed\xa5\xd5\xa5\xa3\xa1\xbc\xa5\xeb\xa4\xac\xb8\xab\xa4\xc4\xa4\xab\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3")) {
|
9510
|
841 profile_state = PROFILE_STATE_UNKNOWN_LANGUAGE;
|
9162
|
842 } else {
|
9510
|
843 profile_state = PROFILE_STATE_NOT_FOUND;
|
9162
|
844 }
|
|
845 }
|
|
846
|
9242
|
847 #if PHOTO_SUPPORT
|
|
848 photo_url_text = yahoo_get_photo_url(url_text, info_data->name);
|
|
849 #endif
|
|
850
|
9162
|
851 url_buffer = g_strdup(url_text);
|
|
852
|
|
853 /*
|
|
854 * gaim_markup_strip_html() doesn't strip out character entities like
|
|
855 * and ·
|
|
856 */
|
|
857 yahoo_remove_nonbreaking_spaces(url_buffer);
|
|
858 #if 1
|
|
859 while ((p = strstr(url_buffer, "·")) != NULL) {
|
|
860 memmove(p, p + 6, strlen(p + 6));
|
|
861 url_buffer[strlen(url_buffer) - 6] = '\0';
|
|
862 }
|
|
863 #endif
|
|
864
|
|
865 /* nuke the nasty \r's */
|
9242
|
866 gaim_str_strip_cr(url_buffer);
|
|
867
|
|
868 #if PHOTO_SUPPORT
|
|
869
|
|
870 /* Marshall the existing state */
|
|
871 info2_data = g_malloc(sizeof(YahooGetInfoStepTwoData));
|
|
872 info2_data->info_data = info_data;
|
|
873 info2_data->url_buffer = url_buffer;
|
|
874 info2_data->s = s;
|
|
875 info2_data->photo_url_text = photo_url_text;
|
|
876 info2_data->profile_url_text = profile_url_text;
|
|
877 info2_data->tooltip_text = tooltip_text;
|
|
878 info2_data->strings = strings;
|
|
879 info2_data->last_updated_string = last_updated_string;
|
9510
|
880 info2_data->title = title;
|
|
881 info2_data->profile_state = profile_state;
|
9242
|
882
|
|
883 /* Try to put the photo in there too, if there's one */
|
|
884 if (photo_url_text) {
|
|
885 /* User-uploaded photos use a different server that requires the Host
|
|
886 * header, but Yahoo Japan will use the "chunked" content encoding if
|
|
887 * we specify HTTP 1.1. So we have to specify 1.0 & fix gaim_url_fetch
|
|
888 */
|
|
889 gaim_url_fetch(photo_url_text, FALSE, NULL, FALSE, yahoo_got_photo,
|
|
890 info2_data);
|
|
891 } else {
|
|
892 /* Emulate a callback */
|
|
893 yahoo_got_photo(info2_data, NULL, 0);
|
9162
|
894 }
|
9242
|
895 }
|
|
896
|
|
897 static void yahoo_got_photo(void *data, const char *url_text, size_t len)
|
|
898 {
|
|
899 YahooGetInfoStepTwoData *info2_data = (YahooGetInfoStepTwoData *)data;
|
|
900 gboolean found = FALSE;
|
|
901 int id = -1;
|
|
902
|
|
903 /* Temporary variables */
|
|
904 char *p = NULL;
|
|
905 char *stripped;
|
|
906 int stripped_len;
|
|
907 char *last_updated_utf8_string = NULL;
|
|
908
|
|
909 /* Unmarshall the saved state */
|
|
910 YahooGetInfoData *info_data = info2_data->info_data;
|
|
911 char *url_buffer = info2_data->url_buffer;
|
|
912 GString *s = info2_data->s;
|
|
913 char *photo_url_text = info2_data->photo_url_text;
|
|
914 char *profile_url_text = info2_data->profile_url_text;
|
|
915 char *tooltip_text = info2_data->tooltip_text;
|
|
916 const profile_strings_node_t *strings = info2_data->strings;
|
|
917 const char *last_updated_string = info2_data->last_updated_string;
|
9510
|
918 const char *title = info2_data->title;
|
|
919 profile_state_t profile_state = info2_data->profile_state;
|
9242
|
920
|
|
921 /* We continue here from yahoo_got_info, as if nothing has happened */
|
|
922 #endif /* PHOTO_SUPPORT */
|
9162
|
923
|
|
924 /* nuke the html, it's easier than trying to parse the horrid stuff */
|
|
925 stripped = gaim_markup_strip_html(url_buffer);
|
|
926 stripped_len = strlen(stripped);
|
|
927
|
|
928 gaim_debug_misc("yahoo", "stripped = %p\n", stripped);
|
|
929 gaim_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
|
|
930
|
|
931 /* convert to utf8 */
|
9510
|
932 if (strings && strings->charset != XX) {
|
|
933 p = g_convert(stripped, -1, "utf-8", strings->charset,
|
|
934 NULL, NULL, NULL);
|
9162
|
935 if (!p) {
|
9510
|
936 p = g_locale_to_utf8(stripped, -1, NULL, NULL, NULL);
|
|
937 if (!p) {
|
|
938 p = g_convert(stripped, -1, "utf-8", "windows-1252",
|
|
939 NULL, NULL, NULL);
|
|
940 }
|
|
941 }
|
|
942 if (p) {
|
|
943 g_free(stripped);
|
|
944 stripped = gaim_utf8_ncr_decode(p);
|
|
945 stripped_len = strlen(stripped);
|
|
946 g_free(p);
|
9162
|
947 }
|
|
948 }
|
9510
|
949 p = NULL;
|
9162
|
950
|
|
951 /* "Last updated" should also be converted to utf8 and with killed */
|
9510
|
952 if (strings && strings->charset != XX) {
|
|
953 last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8",
|
|
954 strings->charset, NULL, NULL, NULL);
|
|
955 yahoo_remove_nonbreaking_spaces(last_updated_utf8_string);
|
9162
|
956
|
9510
|
957 gaim_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped);
|
|
958 }
|
9162
|
959
|
|
960 /* gonna re-use the memory we've already got for url_buffer */
|
|
961 /* no we're not */
|
|
962 s = g_string_sized_new(strlen(url_buffer));
|
9510
|
963
|
|
964 if (profile_state == PROFILE_STATE_DEFAULT) {
|
9162
|
965
|
9242
|
966 #if 0
|
9162
|
967 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as
|
|
968 * true, since the Yahoo! ID will always be there */
|
9242
|
969 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
970 strings->yahoo_id_string, 2, "\n", 0,
|
9162
|
971 NULL, _("Yahoo! ID"), 0, NULL))
|
9242
|
972 ;
|
|
973 #endif
|
|
974
|
|
975 #if PHOTO_SUPPORT
|
9162
|
976
|
9242
|
977 /* Try to put the photo in there too, if there's one and is readable */
|
|
978 if (data && url_text && len != 0) {
|
|
979 if (strstr(url_text, "400 Bad Request")
|
|
980 || strstr(url_text, "403 Forbidden")
|
|
981 || strstr(url_text, "404 Not Found")) {
|
|
982
|
|
983 gaim_debug_info("yahoo", "Error getting %s: %s\n",
|
|
984 photo_url_text, url_text);
|
|
985 } else {
|
|
986 gaim_debug_info("yahoo", "%s is %d bytes\n", photo_url_text, len);
|
|
987 id = gaim_imgstore_add(url_text, len, NULL);
|
|
988 g_string_append_printf(s, "<img id=\"%d\"><br>", id);
|
9220
|
989 }
|
|
990 }
|
9162
|
991
|
9242
|
992 #endif /* PHOTO_SUPPORT */
|
|
993
|
9162
|
994 /* extract their Email address and put it in */
|
9242
|
995 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
996 strings->my_email_string, 5, "\n", 0,
|
|
997 strings->private_string, _("Email"), 0, NULL);
|
9162
|
998
|
|
999 /* extract the Nickname if it exists */
|
9242
|
1000 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1001 "Nickname:", 1, "\n", '\n',
|
9162
|
1002 NULL, _("Nickname"), 0, NULL);
|
|
1003
|
|
1004 /* extract their RealName and put it in */
|
9242
|
1005 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1006 strings->realname_string, 1, "\n", '\n',
|
9162
|
1007 NULL, _("Realname"), 0, NULL);
|
|
1008
|
|
1009 /* extract their Location and put it in */
|
9242
|
1010 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1011 strings->location_string, 2, "\n", '\n',
|
9162
|
1012 NULL, _("Location"), 0, NULL);
|
|
1013
|
|
1014 /* extract their Age and put it in */
|
9242
|
1015 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1016 strings->age_string, 3, "\n", '\n',
|
9162
|
1017 NULL, _("Age"), 0, NULL);
|
|
1018
|
|
1019 /* extract their MaritalStatus and put it in */
|
9242
|
1020 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1021 strings->maritalstatus_string, 3, "\n", '\n',
|
|
1022 strings->no_answer_string, _("Marital Status"), 0, NULL);
|
9162
|
1023
|
|
1024 /* extract their Gender and put it in */
|
9242
|
1025 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1026 strings->gender_string, 3, "\n", '\n',
|
|
1027 strings->no_answer_string, _("Gender"), 0, NULL);
|
9162
|
1028
|
|
1029 /* extract their Occupation and put it in */
|
9242
|
1030 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1031 strings->occupation_string, 2, "\n", '\n',
|
9162
|
1032 NULL, _("Occupation"), 0, NULL);
|
|
1033
|
9242
|
1034 /* Hobbies, Latest News, and Favorite Quote are a bit different, since
|
|
1035 * the values can contain embedded newlines... but any or all of them
|
|
1036 * can also not appear. The way we delimit them is to successively
|
|
1037 * look for the next one that _could_ appear, and if all else fails,
|
|
1038 * we end the section by looking for the 'Links' heading, which is the
|
|
1039 * next thing to follow this bunch. (For Yahoo Japan, we check for
|
|
1040 * the "Description" ("Self PR") heading instead of "Links".)
|
9162
|
1041 */
|
|
1042
|
9242
|
1043 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1044 strings->hobbies_string, 1, strings->latest_news_string,
|
9162
|
1045 '\n', NULL, _("Hobbies"), 0, NULL))
|
|
1046 {
|
9242
|
1047 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1048 strings->hobbies_string, 1, strings->favorite_quote_string,
|
9162
|
1049 '\n', NULL, _("Hobbies"), 0, NULL))
|
|
1050 {
|
9242
|
1051 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1052 strings->hobbies_string, 1, strings->links_string,
|
9162
|
1053 '\n', NULL, _("Hobbies"), 0, NULL);
|
|
1054 }
|
|
1055 else
|
|
1056 found = TRUE;
|
|
1057 }
|
|
1058 else
|
|
1059 found = TRUE;
|
|
1060
|
9242
|
1061 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1062 strings->latest_news_string, 1, strings->favorite_quote_string,
|
9162
|
1063 '\n', NULL, _("Latest News"), 0, NULL))
|
|
1064 {
|
9242
|
1065 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1066 strings->latest_news_string, 1, strings->links_string,
|
9162
|
1067 '\n', NULL, _("Latest News"), 0, NULL);
|
|
1068 }
|
|
1069 else
|
|
1070 found = TRUE;
|
|
1071
|
9242
|
1072 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1073 strings->favorite_quote_string, 1, strings->links_string,
|
9162
|
1074 '\n', NULL, _("Favorite Quote"), 0, NULL);
|
|
1075
|
|
1076 /* Home Page will either be "No home page specified",
|
|
1077 * or "Home Page: " and a link.
|
9242
|
1078 * For Yahoo! Japan, if there is no home page specified,
|
|
1079 * neither "No home page specified" nor "Home Page:" is shown.
|
9162
|
1080 */
|
9242
|
1081 if (strings->home_page_string) {
|
|
1082 p = !strings->no_home_page_specified_string? NULL:
|
|
1083 strstr(stripped, strings->no_home_page_specified_string);
|
9162
|
1084 if(!p)
|
|
1085 {
|
9242
|
1086 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1087 strings->home_page_string, 1, "\n", 0, NULL,
|
9162
|
1088 _("Home Page"), 1, NULL);
|
|
1089 }
|
|
1090 }
|
|
1091
|
9242
|
1092 /* Cool Link {1,2,3} is also different. If "No cool link specified"
|
|
1093 * exists, then we have none. If we have one however, we'll need to
|
|
1094 * check and see if we have a second one. If we have a second one,
|
|
1095 * we have to check to see if we have a third one.
|
9162
|
1096 */
|
9242
|
1097 p = !strings->no_cool_link_specified_string? NULL:
|
|
1098 strstr(stripped,strings->no_cool_link_specified_string);
|
9162
|
1099 if (!p)
|
|
1100 {
|
9242
|
1101 if (gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1102 strings->cool_link_1_string, 1, "\n", 0, NULL,
|
9162
|
1103 _("Cool Link 1"), 1, NULL))
|
|
1104 {
|
|
1105 found = TRUE;
|
9242
|
1106 if (gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1107 strings->cool_link_2_string, 1, "\n", 0, NULL,
|
9162
|
1108 _("Cool Link 2"), 1, NULL))
|
9242
|
1109 {
|
|
1110 gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1111 strings->cool_link_3_string, 1, "\n", 0, NULL,
|
9162
|
1112 _("Cool Link 3"), 1, NULL);
|
9242
|
1113 }
|
9162
|
1114 }
|
|
1115 }
|
|
1116
|
|
1117 /* see if Member Since is there, and if so, extract it. */
|
9242
|
1118 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1119 "Member Since:", 1, last_updated_utf8_string,
|
9162
|
1120 '\n', NULL, _("Member Since"), 0, NULL);
|
|
1121
|
|
1122 /* extract the Last Updated date and put it in */
|
9242
|
1123 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1124 last_updated_utf8_string, 0, "\n", '\n', NULL,
|
9162
|
1125 _("Last Updated"), 0, NULL);
|
|
1126
|
9510
|
1127 } /* if (profile_state == PROFILE_STATE_DEFAULT) */
|
|
1128
|
|
1129 if(!found)
|
|
1130 {
|
|
1131 g_string_append_printf(s, "<br><b>");
|
|
1132 g_string_append_printf(s, _("User information for %s unavailable"),
|
|
1133 info_data->name);
|
|
1134 g_string_append_printf(s, "</b><br>");
|
|
1135
|
|
1136 if (profile_state == PROFILE_STATE_UNKNOWN_LANGUAGE) {
|
|
1137 g_string_append_printf(s, "%s<br><br>",
|
|
1138 _("Sorry, this profile seems to be in a language "
|
|
1139 "that is not supported at this time."));
|
|
1140
|
|
1141 } else if (profile_state == PROFILE_STATE_NOT_FOUND) {
|
|
1142 GaimBuddy *b = gaim_find_buddy
|
|
1143 (gaim_connection_get_account(info_data->gc),
|
|
1144 info_data->name);
|
|
1145 YahooFriend *f = NULL;
|
|
1146 if (b) {
|
|
1147 /* Someone on the buddy list can be "not on server list",
|
|
1148 * in which case the user may or may not actually exist.
|
|
1149 * Hence this extra step.
|
|
1150 */
|
|
1151 f = yahoo_friend_find(b->account->gc, b->name);
|
|
1152 }
|
|
1153 g_string_append_printf(s, "%s<br><br>",
|
|
1154 f? _("Could not retrieve the user's profile. "
|
|
1155 "This most likely is a temporary server-side problem. "
|
|
1156 "Please try again later."):
|
|
1157 _("Could not retrieve the user's profile. "
|
|
1158 "This most likely means that the user does not exist; "
|
|
1159 "however, Yahoo! sometimes does fail to find a user's "
|
|
1160 "profile. If you know that the user exists, "
|
|
1161 "please try again later."));
|
|
1162
|
|
1163 } else {
|
|
1164 g_string_append_printf(s, "%s<br><br>",
|
|
1165 _("The user's profile is empty."));
|
|
1166 }
|
|
1167 }
|
|
1168
|
9220
|
1169 /* put a link to the actual profile URL */
|
|
1170 g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL"));
|
9242
|
1171 g_string_append_printf(s, "<br><a href=\"%s\">%s</a><br>",
|
|
1172 profile_url_text, profile_url_text);
|
9220
|
1173
|
9510
|
1174 /* finish off the html at the end */
|
9162
|
1175 g_string_append(s, "</body></html>\n");
|
|
1176 g_free(stripped);
|
|
1177
|
9510
|
1178 /* Put the Yahoo! ID, nickname, idle time, and status message in */
|
|
1179 g_string_prepend(s, tooltip_text);
|
|
1180
|
|
1181 /* finish off the html at the beginning */
|
|
1182 g_string_prepend(s, "<html><body>\n");
|
|
1183
|
|
1184 /* show it to the user */
|
9797
|
1185 gaim_notify_userinfo(info_data->gc, info_data->name, NULL, title,
|
|
1186 NULL, s->str, NULL, NULL);
|
9162
|
1187
|
|
1188 g_free(last_updated_utf8_string);
|
|
1189 g_free(url_buffer);
|
|
1190 g_string_free(s, TRUE);
|
9242
|
1191 g_free(profile_url_text);
|
|
1192 g_free(tooltip_text);
|
9162
|
1193 g_free(info_data->name);
|
|
1194 g_free(info_data);
|
9242
|
1195
|
|
1196 #if PHOTO_SUPPORT
|
|
1197 g_free(photo_url_text);
|
|
1198 g_free(info2_data);
|
|
1199 if (id != -1)
|
|
1200 gaim_imgstore_unref(id);
|
|
1201 #endif
|
9162
|
1202 }
|
|
1203
|
|
1204 void yahoo_get_info(GaimConnection *gc, const char *name)
|
|
1205 {
|
9164
|
1206 struct yahoo_data *yd = gc->proto_data;
|
9162
|
1207 YahooGetInfoData *data;
|
|
1208 char *url;
|
|
1209
|
|
1210 data = g_new0(YahooGetInfoData, 1);
|
|
1211 data->gc = gc;
|
|
1212 data->name = g_strdup(name);
|
|
1213
|
9221
|
1214 url = g_strdup_printf("%s%s",
|
|
1215 (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), name);
|
9162
|
1216
|
10604
|
1217 gaim_url_fetch(url, TRUE, NULL, FALSE, yahoo_got_info, data);
|
9162
|
1218
|
|
1219 g_free(url);
|
|
1220 }
|