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