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 }
|
|
662 if (b->idle > 0) {
|
|
663 char *idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
|
|
664 g_string_append_printf(s, _("<b>%s:</b> %s<br>"), _("Idle"),
|
|
665 idletime);
|
|
666 g_free(idletime);
|
|
667 }
|
|
668 if (statustext) {
|
|
669 g_string_append_printf(s, "%s<br>", statustext);
|
|
670 g_free(statustext);
|
|
671 }
|
9281
|
672 if ((f = yahoo_friend_find(info_data->gc, b->name))) {
|
|
673 const char *ip;
|
|
674 if ((ip = yahoo_friend_get_ip(f)))
|
|
675 g_string_append_printf(s, _("<b>IP Address:</b> %s<br>"), ip);
|
|
676 }
|
|
677
|
9242
|
678 }
|
|
679
|
|
680 return g_string_free(s, FALSE);
|
|
681 }
|
|
682
|
|
683 #if PHOTO_SUPPORT
|
|
684
|
|
685 static char *yahoo_get_photo_url(const char *url_text, const char *name) {
|
|
686 GString *s = g_string_sized_new(strlen(name) + 8);
|
|
687 char *p;
|
|
688 char *it = NULL;
|
|
689
|
|
690 g_string_printf(s, " alt=\"%s\">", name);
|
|
691 p = strstr(url_text, s->str);
|
|
692
|
|
693 if (p) {
|
|
694 /* Search backwards for "http://". This is stupid, but it works. */
|
|
695 for (; !it && p > url_text; p -= 1) {
|
|
696 if (strncmp(p, "\"http://", 8) == 0) {
|
|
697 char *q;
|
|
698 p += 1; /* skip only the " */
|
|
699 q = strchr(p, '"');
|
|
700 if (q) {
|
|
701 it = g_strndup(p, q - p);
|
|
702 }
|
|
703 }
|
|
704 }
|
|
705 }
|
|
706
|
|
707 g_string_free(s, TRUE);
|
|
708 return it;
|
|
709 }
|
|
710
|
|
711 static void yahoo_got_photo(void *data, const char *url_text, size_t len);
|
|
712
|
|
713 #endif /* PHOTO_SUPPORT */
|
|
714
|
9162
|
715 static void yahoo_got_info(void *data, const char *url_text, size_t len)
|
|
716 {
|
|
717 YahooGetInfoData *info_data = (YahooGetInfoData *)data;
|
9242
|
718 char *p;
|
9162
|
719 char buf[1024];
|
9242
|
720 #if PHOTO_SUPPORT
|
|
721 YahooGetInfoStepTwoData *info2_data;
|
|
722 char *photo_url_text = NULL;
|
|
723 #else
|
9162
|
724 gboolean found = FALSE;
|
9242
|
725 char *stripped;
|
|
726 int stripped_len;
|
|
727 char *last_updated_utf8_string = NULL;
|
|
728 #endif
|
|
729 const char *last_updated_string = NULL;
|
9162
|
730 char *url_buffer;
|
|
731 GString *s;
|
9242
|
732 char *tooltip_text = NULL;
|
|
733 char *profile_url_text = NULL;
|
9162
|
734 int lang, strid;
|
9221
|
735 struct yahoo_data *yd;
|
9242
|
736 const profile_strings_node_t *strings = NULL;
|
9510
|
737 const char *title;
|
|
738 profile_state_t profile_state = PROFILE_STATE_DEFAULT;
|
9221
|
739
|
|
740 if (!GAIM_CONNECTION_IS_VALID(info_data->gc)) {
|
|
741 g_free(info_data->name);
|
|
742 g_free(info_data);
|
|
743 return;
|
|
744 }
|
9162
|
745
|
|
746 gaim_debug_info("yahoo", "In yahoo_got_info\n");
|
|
747
|
9221
|
748 yd = info_data->gc->proto_data;
|
9510
|
749 title = (yd->jp? _("Yahoo! Japan Profile") :
|
|
750 _("Yahoo! Profile"));
|
9242
|
751
|
|
752 /* Get the tooltip info string */
|
|
753 tooltip_text = yahoo_tooltip_info_text(info_data);
|
9221
|
754
|
9242
|
755 /* We failed to grab the profile URL. This is not expected to actually
|
|
756 * happen except under unusual error conditions, as Yahoo is observed
|
|
757 * to send back HTML, with a 200 status code.
|
|
758 */
|
9162
|
759 if (url_text == NULL || strcmp(url_text, "") == 0) {
|
9242
|
760 g_snprintf(buf, 1024, "<html><body>%s<b>%s</b></body></html>",
|
|
761 tooltip_text, _("Error retrieving profile"));
|
|
762
|
9510
|
763 gaim_notify_formatted(info_data->gc, NULL, title, NULL,
|
9242
|
764 buf, NULL, NULL);
|
9162
|
765
|
9242
|
766 g_free(profile_url_text);
|
|
767 g_free(tooltip_text);
|
9162
|
768 g_free(info_data->name);
|
|
769 g_free(info_data);
|
|
770 return;
|
|
771 }
|
|
772
|
9242
|
773 /* Construct the correct profile URL */
|
|
774 s = g_string_sized_new(80); /* wild guess */
|
|
775 g_string_printf(s, "%s%s", (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL),
|
|
776 info_data->name);
|
|
777 profile_url_text = g_string_free(s, FALSE);
|
|
778 s = NULL;
|
|
779
|
|
780 /* We don't yet support the multiple link level of the warning page for
|
9162
|
781 * 'adult' profiles, not to mention the fact that yahoo wants you to be
|
9242
|
782 * logged in (on the website) to be able to view an 'adult' profile. For
|
9162
|
783 * now, just tell them that we can't help them, and provide a link to the
|
|
784 * profile if they want to do the web browser thing.
|
|
785 */
|
|
786 p = strstr(url_text, "Adult Profiles Warning Message");
|
9242
|
787 if (!p) {
|
|
788 p = strstr(url_text, "Adult Content Warning"); /* TITLE element */
|
|
789 }
|
9162
|
790 if (p) {
|
9242
|
791 g_snprintf(buf, 1024, "<html><body>%s<b>%s</b><br><br>\n"
|
|
792 "%s<br><a href=\"%s\">%s</a></body></html>",
|
|
793 tooltip_text,
|
|
794 _("Sorry, profiles marked as containing adult content "
|
|
795 "are not supported at this time."),
|
|
796 _("If you wish to view this profile, "
|
|
797 "you will need to visit this link in your web browser"),
|
|
798 profile_url_text, profile_url_text);
|
9162
|
799
|
9510
|
800 gaim_notify_formatted(info_data->gc, NULL, title, NULL,
|
9162
|
801 buf, NULL, NULL);
|
|
802
|
9242
|
803 g_free(profile_url_text);
|
|
804 g_free(tooltip_text);
|
9162
|
805 g_free(info_data->name);
|
|
806 g_free(info_data);
|
|
807 return;
|
|
808 }
|
|
809
|
|
810 /* Check whether the profile is written in a supported language */
|
|
811 for (lang = 0;; lang += 1) {
|
|
812 last_updated_string = profile_langs[lang].last_updated_string;
|
|
813 if (!last_updated_string) break;
|
|
814 p = strstr(url_text, last_updated_string);
|
|
815 if (p && profile_langs[lang].det && !strstr(url_text, profile_langs[lang].det)) {
|
|
816 p = NULL;
|
|
817 }
|
|
818 if (p) break;
|
|
819 }
|
|
820 if (p) {
|
|
821 for (strid = 0; profile_strings[strid].lang != XX; strid += 1) {
|
9221
|
822 if (profile_strings[strid].lang == profile_langs[lang].lang) break;
|
9162
|
823 }
|
9242
|
824 strings = profile_strings + strid;
|
9162
|
825 gaim_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang);
|
|
826 }
|
|
827
|
9220
|
828 /* Every user may choose his/her own profile language, and this language
|
|
829 * has nothing to do with the preferences of the user which looks at the
|
|
830 * profile. We try to support all languages, but nothing is guaranteed.
|
9242
|
831 * If we cannot determine the language, it means either (1) the profile
|
|
832 * is written in an unsupported language, (2) our language support is
|
|
833 * out of date, or (3) the user is not found.
|
9162
|
834 */
|
9242
|
835 if (!p || strings->lang == XX) {
|
|
836 if (!strstr(url_text, "Yahoo! Member Directory - User not found")
|
|
837 && !strstr(url_text, "was not found on this server.")
|
|
838 && !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
|
839 profile_state = PROFILE_STATE_UNKNOWN_LANGUAGE;
|
9162
|
840 } else {
|
9510
|
841 profile_state = PROFILE_STATE_NOT_FOUND;
|
9162
|
842 }
|
|
843 }
|
|
844
|
9242
|
845 #if PHOTO_SUPPORT
|
|
846 photo_url_text = yahoo_get_photo_url(url_text, info_data->name);
|
|
847 #endif
|
|
848
|
9162
|
849 url_buffer = g_strdup(url_text);
|
|
850
|
|
851 /*
|
|
852 * gaim_markup_strip_html() doesn't strip out character entities like
|
|
853 * and ·
|
|
854 */
|
|
855 yahoo_remove_nonbreaking_spaces(url_buffer);
|
|
856 #if 1
|
|
857 while ((p = strstr(url_buffer, "·")) != NULL) {
|
|
858 memmove(p, p + 6, strlen(p + 6));
|
|
859 url_buffer[strlen(url_buffer) - 6] = '\0';
|
|
860 }
|
|
861 #endif
|
|
862
|
|
863 /* nuke the nasty \r's */
|
9242
|
864 gaim_str_strip_cr(url_buffer);
|
|
865
|
|
866 #if PHOTO_SUPPORT
|
|
867
|
|
868 /* Marshall the existing state */
|
|
869 info2_data = g_malloc(sizeof(YahooGetInfoStepTwoData));
|
|
870 info2_data->info_data = info_data;
|
|
871 info2_data->url_buffer = url_buffer;
|
|
872 info2_data->s = s;
|
|
873 info2_data->photo_url_text = photo_url_text;
|
|
874 info2_data->profile_url_text = profile_url_text;
|
|
875 info2_data->tooltip_text = tooltip_text;
|
|
876 info2_data->strings = strings;
|
|
877 info2_data->last_updated_string = last_updated_string;
|
9510
|
878 info2_data->title = title;
|
|
879 info2_data->profile_state = profile_state;
|
9242
|
880
|
|
881 /* Try to put the photo in there too, if there's one */
|
|
882 if (photo_url_text) {
|
|
883 /* User-uploaded photos use a different server that requires the Host
|
|
884 * header, but Yahoo Japan will use the "chunked" content encoding if
|
|
885 * we specify HTTP 1.1. So we have to specify 1.0 & fix gaim_url_fetch
|
|
886 */
|
|
887 gaim_url_fetch(photo_url_text, FALSE, NULL, FALSE, yahoo_got_photo,
|
|
888 info2_data);
|
|
889 } else {
|
|
890 /* Emulate a callback */
|
|
891 yahoo_got_photo(info2_data, NULL, 0);
|
9162
|
892 }
|
9242
|
893 }
|
|
894
|
|
895 static void yahoo_got_photo(void *data, const char *url_text, size_t len)
|
|
896 {
|
|
897 YahooGetInfoStepTwoData *info2_data = (YahooGetInfoStepTwoData *)data;
|
|
898 gboolean found = FALSE;
|
|
899 int id = -1;
|
|
900
|
|
901 /* Temporary variables */
|
|
902 char *p = NULL;
|
|
903 char *stripped;
|
|
904 int stripped_len;
|
|
905 char *last_updated_utf8_string = NULL;
|
|
906
|
|
907 /* Unmarshall the saved state */
|
|
908 YahooGetInfoData *info_data = info2_data->info_data;
|
|
909 char *url_buffer = info2_data->url_buffer;
|
|
910 GString *s = info2_data->s;
|
|
911 char *photo_url_text = info2_data->photo_url_text;
|
|
912 char *profile_url_text = info2_data->profile_url_text;
|
|
913 char *tooltip_text = info2_data->tooltip_text;
|
|
914 const profile_strings_node_t *strings = info2_data->strings;
|
|
915 const char *last_updated_string = info2_data->last_updated_string;
|
9510
|
916 const char *title = info2_data->title;
|
|
917 profile_state_t profile_state = info2_data->profile_state;
|
9242
|
918
|
|
919 /* We continue here from yahoo_got_info, as if nothing has happened */
|
|
920 #endif /* PHOTO_SUPPORT */
|
9162
|
921
|
|
922 /* nuke the html, it's easier than trying to parse the horrid stuff */
|
|
923 stripped = gaim_markup_strip_html(url_buffer);
|
|
924 stripped_len = strlen(stripped);
|
|
925
|
|
926 gaim_debug_misc("yahoo", "stripped = %p\n", stripped);
|
|
927 gaim_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
|
|
928
|
|
929 /* convert to utf8 */
|
9510
|
930 if (strings && strings->charset != XX) {
|
|
931 p = g_convert(stripped, -1, "utf-8", strings->charset,
|
|
932 NULL, NULL, NULL);
|
9162
|
933 if (!p) {
|
9510
|
934 p = g_locale_to_utf8(stripped, -1, NULL, NULL, NULL);
|
|
935 if (!p) {
|
|
936 p = g_convert(stripped, -1, "utf-8", "windows-1252",
|
|
937 NULL, NULL, NULL);
|
|
938 }
|
|
939 }
|
|
940 if (p) {
|
|
941 g_free(stripped);
|
|
942 stripped = gaim_utf8_ncr_decode(p);
|
|
943 stripped_len = strlen(stripped);
|
|
944 g_free(p);
|
9162
|
945 }
|
|
946 }
|
9510
|
947 p = NULL;
|
9162
|
948
|
|
949 /* "Last updated" should also be converted to utf8 and with killed */
|
9510
|
950 if (strings && strings->charset != XX) {
|
|
951 last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8",
|
|
952 strings->charset, NULL, NULL, NULL);
|
|
953 yahoo_remove_nonbreaking_spaces(last_updated_utf8_string);
|
9162
|
954
|
9510
|
955 gaim_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped);
|
|
956 }
|
9162
|
957
|
|
958 /* gonna re-use the memory we've already got for url_buffer */
|
|
959 /* no we're not */
|
|
960 s = g_string_sized_new(strlen(url_buffer));
|
9510
|
961
|
|
962 if (profile_state == PROFILE_STATE_DEFAULT) {
|
9162
|
963
|
9242
|
964 #if 0
|
9162
|
965 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as
|
|
966 * true, since the Yahoo! ID will always be there */
|
9242
|
967 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
968 strings->yahoo_id_string, 2, "\n", 0,
|
9162
|
969 NULL, _("Yahoo! ID"), 0, NULL))
|
9242
|
970 ;
|
|
971 #endif
|
|
972
|
|
973 #if PHOTO_SUPPORT
|
9162
|
974
|
9242
|
975 /* Try to put the photo in there too, if there's one and is readable */
|
|
976 if (data && url_text && len != 0) {
|
|
977 if (strstr(url_text, "400 Bad Request")
|
|
978 || strstr(url_text, "403 Forbidden")
|
|
979 || strstr(url_text, "404 Not Found")) {
|
|
980
|
|
981 gaim_debug_info("yahoo", "Error getting %s: %s\n",
|
|
982 photo_url_text, url_text);
|
|
983 } else {
|
|
984 gaim_debug_info("yahoo", "%s is %d bytes\n", photo_url_text, len);
|
|
985 id = gaim_imgstore_add(url_text, len, NULL);
|
|
986 g_string_append_printf(s, "<img id=\"%d\"><br>", id);
|
9220
|
987 }
|
|
988 }
|
9162
|
989
|
9242
|
990 #endif /* PHOTO_SUPPORT */
|
|
991
|
9162
|
992 /* extract their Email address and put it in */
|
9242
|
993 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
994 strings->my_email_string, 5, "\n", 0,
|
|
995 strings->private_string, _("Email"), 0, NULL);
|
9162
|
996
|
|
997 /* extract the Nickname if it exists */
|
9242
|
998 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
999 "Nickname:", 1, "\n", '\n',
|
9162
|
1000 NULL, _("Nickname"), 0, NULL);
|
|
1001
|
|
1002 /* extract their RealName and put it in */
|
9242
|
1003 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1004 strings->realname_string, 1, "\n", '\n',
|
9162
|
1005 NULL, _("Realname"), 0, NULL);
|
|
1006
|
|
1007 /* extract their Location and put it in */
|
9242
|
1008 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1009 strings->location_string, 2, "\n", '\n',
|
9162
|
1010 NULL, _("Location"), 0, NULL);
|
|
1011
|
|
1012 /* extract their Age and put it in */
|
9242
|
1013 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1014 strings->age_string, 3, "\n", '\n',
|
9162
|
1015 NULL, _("Age"), 0, NULL);
|
|
1016
|
|
1017 /* extract their MaritalStatus and put it in */
|
9242
|
1018 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1019 strings->maritalstatus_string, 3, "\n", '\n',
|
|
1020 strings->no_answer_string, _("Marital Status"), 0, NULL);
|
9162
|
1021
|
|
1022 /* extract their Gender and put it in */
|
9242
|
1023 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1024 strings->gender_string, 3, "\n", '\n',
|
|
1025 strings->no_answer_string, _("Gender"), 0, NULL);
|
9162
|
1026
|
|
1027 /* extract their Occupation and put it in */
|
9242
|
1028 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1029 strings->occupation_string, 2, "\n", '\n',
|
9162
|
1030 NULL, _("Occupation"), 0, NULL);
|
|
1031
|
9242
|
1032 /* Hobbies, Latest News, and Favorite Quote are a bit different, since
|
|
1033 * the values can contain embedded newlines... but any or all of them
|
|
1034 * can also not appear. The way we delimit them is to successively
|
|
1035 * look for the next one that _could_ appear, and if all else fails,
|
|
1036 * we end the section by looking for the 'Links' heading, which is the
|
|
1037 * next thing to follow this bunch. (For Yahoo Japan, we check for
|
|
1038 * the "Description" ("Self PR") heading instead of "Links".)
|
9162
|
1039 */
|
|
1040
|
9242
|
1041 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1042 strings->hobbies_string, 1, strings->latest_news_string,
|
9162
|
1043 '\n', NULL, _("Hobbies"), 0, NULL))
|
|
1044 {
|
9242
|
1045 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1046 strings->hobbies_string, 1, strings->favorite_quote_string,
|
9162
|
1047 '\n', NULL, _("Hobbies"), 0, NULL))
|
|
1048 {
|
9242
|
1049 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1050 strings->hobbies_string, 1, strings->links_string,
|
9162
|
1051 '\n', NULL, _("Hobbies"), 0, NULL);
|
|
1052 }
|
|
1053 else
|
|
1054 found = TRUE;
|
|
1055 }
|
|
1056 else
|
|
1057 found = TRUE;
|
|
1058
|
9242
|
1059 if (!gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1060 strings->latest_news_string, 1, strings->favorite_quote_string,
|
9162
|
1061 '\n', NULL, _("Latest News"), 0, NULL))
|
|
1062 {
|
9242
|
1063 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1064 strings->latest_news_string, 1, strings->links_string,
|
9162
|
1065 '\n', NULL, _("Latest News"), 0, NULL);
|
|
1066 }
|
|
1067 else
|
|
1068 found = TRUE;
|
|
1069
|
9242
|
1070 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1071 strings->favorite_quote_string, 1, strings->links_string,
|
9162
|
1072 '\n', NULL, _("Favorite Quote"), 0, NULL);
|
|
1073
|
|
1074 /* Home Page will either be "No home page specified",
|
|
1075 * or "Home Page: " and a link.
|
9242
|
1076 * For Yahoo! Japan, if there is no home page specified,
|
|
1077 * neither "No home page specified" nor "Home Page:" is shown.
|
9162
|
1078 */
|
9242
|
1079 if (strings->home_page_string) {
|
|
1080 p = !strings->no_home_page_specified_string? NULL:
|
|
1081 strstr(stripped, strings->no_home_page_specified_string);
|
9162
|
1082 if(!p)
|
|
1083 {
|
9242
|
1084 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1085 strings->home_page_string, 1, "\n", 0, NULL,
|
9162
|
1086 _("Home Page"), 1, NULL);
|
|
1087 }
|
|
1088 }
|
|
1089
|
9242
|
1090 /* Cool Link {1,2,3} is also different. If "No cool link specified"
|
|
1091 * exists, then we have none. If we have one however, we'll need to
|
|
1092 * check and see if we have a second one. If we have a second one,
|
|
1093 * we have to check to see if we have a third one.
|
9162
|
1094 */
|
9242
|
1095 p = !strings->no_cool_link_specified_string? NULL:
|
|
1096 strstr(stripped,strings->no_cool_link_specified_string);
|
9162
|
1097 if (!p)
|
|
1098 {
|
9242
|
1099 if (gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1100 strings->cool_link_1_string, 1, "\n", 0, NULL,
|
9162
|
1101 _("Cool Link 1"), 1, NULL))
|
|
1102 {
|
|
1103 found = TRUE;
|
9242
|
1104 if (gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1105 strings->cool_link_2_string, 1, "\n", 0, NULL,
|
9162
|
1106 _("Cool Link 2"), 1, NULL))
|
9242
|
1107 {
|
|
1108 gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1109 strings->cool_link_3_string, 1, "\n", 0, NULL,
|
9162
|
1110 _("Cool Link 3"), 1, NULL);
|
9242
|
1111 }
|
9162
|
1112 }
|
|
1113 }
|
|
1114
|
|
1115 /* see if Member Since is there, and if so, extract it. */
|
9242
|
1116 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1117 "Member Since:", 1, last_updated_utf8_string,
|
9162
|
1118 '\n', NULL, _("Member Since"), 0, NULL);
|
|
1119
|
|
1120 /* extract the Last Updated date and put it in */
|
9242
|
1121 found |= gaim_markup_extract_info_field(stripped, stripped_len, s,
|
|
1122 last_updated_utf8_string, 0, "\n", '\n', NULL,
|
9162
|
1123 _("Last Updated"), 0, NULL);
|
|
1124
|
9510
|
1125 } /* if (profile_state == PROFILE_STATE_DEFAULT) */
|
|
1126
|
|
1127 if(!found)
|
|
1128 {
|
|
1129 g_string_append_printf(s, "<br><b>");
|
|
1130 g_string_append_printf(s, _("User information for %s unavailable"),
|
|
1131 info_data->name);
|
|
1132 g_string_append_printf(s, "</b><br>");
|
|
1133
|
|
1134 if (profile_state == PROFILE_STATE_UNKNOWN_LANGUAGE) {
|
|
1135 g_string_append_printf(s, "%s<br><br>",
|
|
1136 _("Sorry, this profile seems to be in a language "
|
|
1137 "that is not supported at this time."));
|
|
1138
|
|
1139 } else if (profile_state == PROFILE_STATE_NOT_FOUND) {
|
|
1140 GaimBuddy *b = gaim_find_buddy
|
|
1141 (gaim_connection_get_account(info_data->gc),
|
|
1142 info_data->name);
|
|
1143 YahooFriend *f = NULL;
|
|
1144 if (b) {
|
|
1145 /* Someone on the buddy list can be "not on server list",
|
|
1146 * in which case the user may or may not actually exist.
|
|
1147 * Hence this extra step.
|
|
1148 */
|
|
1149 f = yahoo_friend_find(b->account->gc, b->name);
|
|
1150 }
|
|
1151 g_string_append_printf(s, "%s<br><br>",
|
|
1152 f? _("Could not retrieve the user's profile. "
|
|
1153 "This most likely is a temporary server-side problem. "
|
|
1154 "Please try again later."):
|
|
1155 _("Could not retrieve the user's profile. "
|
|
1156 "This most likely means that the user does not exist; "
|
|
1157 "however, Yahoo! sometimes does fail to find a user's "
|
|
1158 "profile. If you know that the user exists, "
|
|
1159 "please try again later."));
|
|
1160
|
|
1161 } else {
|
|
1162 g_string_append_printf(s, "%s<br><br>",
|
|
1163 _("The user's profile is empty."));
|
|
1164 }
|
|
1165 }
|
|
1166
|
9220
|
1167 /* put a link to the actual profile URL */
|
|
1168 g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL"));
|
9242
|
1169 g_string_append_printf(s, "<br><a href=\"%s\">%s</a><br>",
|
|
1170 profile_url_text, profile_url_text);
|
9220
|
1171
|
9510
|
1172 /* finish off the html at the end */
|
9162
|
1173 g_string_append(s, "</body></html>\n");
|
|
1174 g_free(stripped);
|
|
1175
|
9510
|
1176 /* Put the Yahoo! ID, nickname, idle time, and status message in */
|
|
1177 g_string_prepend(s, tooltip_text);
|
|
1178
|
|
1179 /* finish off the html at the beginning */
|
|
1180 g_string_prepend(s, "<html><body>\n");
|
|
1181
|
|
1182 /* show it to the user */
|
|
1183 gaim_notify_formatted(info_data->gc, NULL, title, NULL,
|
|
1184 s->str, NULL, NULL);
|
9162
|
1185
|
|
1186 g_free(last_updated_utf8_string);
|
|
1187 g_free(url_buffer);
|
|
1188 g_string_free(s, TRUE);
|
9242
|
1189 g_free(profile_url_text);
|
|
1190 g_free(tooltip_text);
|
9162
|
1191 g_free(info_data->name);
|
|
1192 g_free(info_data);
|
9242
|
1193
|
|
1194 #if PHOTO_SUPPORT
|
|
1195 g_free(photo_url_text);
|
|
1196 g_free(info2_data);
|
|
1197 if (id != -1)
|
|
1198 gaim_imgstore_unref(id);
|
|
1199 #endif
|
9162
|
1200 }
|
|
1201
|
|
1202 void yahoo_get_info(GaimConnection *gc, const char *name)
|
|
1203 {
|
9164
|
1204 struct yahoo_data *yd = gc->proto_data;
|
9162
|
1205 YahooGetInfoData *data;
|
|
1206 char *url;
|
|
1207
|
|
1208 data = g_new0(YahooGetInfoData, 1);
|
|
1209 data->gc = gc;
|
|
1210 data->name = g_strdup(name);
|
|
1211
|
9221
|
1212 url = g_strdup_printf("%s%s",
|
|
1213 (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), name);
|
9162
|
1214
|
|
1215 gaim_url_fetch(url, FALSE, NULL, FALSE, yahoo_got_info, data);
|
|
1216
|
|
1217 g_free(url);
|
|
1218 }
|