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