Mercurial > pidgin
comparison libpurple/protocols/yahoo/yahoo.c @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 12778e2f7282 |
children | e058328dc954 |
comparison
equal
deleted
inserted
replaced
15821:84b0f9b23ede | 15822:32c366eeeb99 |
---|---|
1 /* | 1 /* |
2 * gaim | 2 * purple |
3 * | 3 * |
4 * Gaim is the legal property of its developers, whose names are too numerous | 4 * Purple 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 | 5 * to list here. Please refer to the COPYRIGHT file distributed with this |
6 * source distribution. | 6 * source distribution. |
7 * | 7 * |
8 * This program is free software; you can redistribute it and/or modify | 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 | 9 * it under the terms of the GNU General Public License as published by |
52 | 52 |
53 /* #define YAHOO_DEBUG */ | 53 /* #define YAHOO_DEBUG */ |
54 | 54 |
55 /* #define TRY_WEBMESSENGER_LOGIN 0 */ | 55 /* #define TRY_WEBMESSENGER_LOGIN 0 */ |
56 | 56 |
57 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *, GaimGroup *); | 57 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *, PurpleGroup *); |
58 #ifdef TRY_WEBMESSENGER_LOGIN | 58 #ifdef TRY_WEBMESSENGER_LOGIN |
59 static void yahoo_login_page_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); | 59 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
60 #endif | 60 #endif |
61 static void yahoo_set_status(GaimAccount *account, GaimStatus *status); | 61 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); |
62 | 62 |
63 static void | 63 static void |
64 yahoo_add_permit(GaimConnection *gc, const char *who) | 64 yahoo_add_permit(PurpleConnection *gc, const char *who) |
65 { | 65 { |
66 gaim_debug_info("yahoo", | 66 purple_debug_info("yahoo", |
67 "Permitting ID %s local contact rights for account %s\n", who, gc->account); | 67 "Permitting ID %s local contact rights for account %s\n", who, gc->account); |
68 gaim_privacy_permit_add(gc->account,who,TRUE); | 68 purple_privacy_permit_add(gc->account,who,TRUE); |
69 } | 69 } |
70 | 70 |
71 static void | 71 static void |
72 yahoo_rem_permit(GaimConnection *gc, const char *who) | 72 yahoo_rem_permit(PurpleConnection *gc, const char *who) |
73 { | 73 { |
74 gaim_debug_info("yahoo", | 74 purple_debug_info("yahoo", |
75 "Denying ID %s local contact rights for account %s\n", who, gc->account); | 75 "Denying ID %s local contact rights for account %s\n", who, gc->account); |
76 gaim_privacy_permit_remove(gc->account,who,TRUE); | 76 purple_privacy_permit_remove(gc->account,who,TRUE); |
77 } | 77 } |
78 | 78 |
79 gboolean yahoo_privacy_check(GaimConnection *gc, const char *who) | 79 gboolean yahoo_privacy_check(PurpleConnection *gc, const char *who) |
80 { | 80 { |
81 /* returns TRUE if allowed through, FALSE otherwise */ | 81 /* returns TRUE if allowed through, FALSE otherwise */ |
82 gboolean permitted; | 82 gboolean permitted; |
83 | 83 |
84 permitted = gaim_privacy_check(gc->account, who); | 84 permitted = purple_privacy_check(gc->account, who); |
85 | 85 |
86 /* print some debug info */ | 86 /* print some debug info */ |
87 if (!permitted) { | 87 if (!permitted) { |
88 char *deb = NULL; | 88 char *deb = NULL; |
89 switch (gc->account->perm_deny) | 89 switch (gc->account->perm_deny) |
90 { | 90 { |
91 case GAIM_PRIVACY_DENY_ALL: | 91 case PURPLE_PRIVACY_DENY_ALL: |
92 deb = "GAIM_PRIVACY_DENY_ALL"; | 92 deb = "PURPLE_PRIVACY_DENY_ALL"; |
93 break; | 93 break; |
94 case GAIM_PRIVACY_DENY_USERS: | 94 case PURPLE_PRIVACY_DENY_USERS: |
95 deb = "GAIM_PRIVACY_DENY_USERS"; | 95 deb = "PURPLE_PRIVACY_DENY_USERS"; |
96 break; | 96 break; |
97 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | 97 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
98 deb = "GAIM_PRIVACY_ALLOW_BUDDYLIST"; | 98 deb = "PURPLE_PRIVACY_ALLOW_BUDDYLIST"; |
99 break; | 99 break; |
100 } | 100 } |
101 if(deb) | 101 if(deb) |
102 gaim_debug_info("yahoo", | 102 purple_debug_info("yahoo", |
103 "%s blocked data received from %s (%s)\n", | 103 "%s blocked data received from %s (%s)\n", |
104 gc->account->username,who, deb); | 104 gc->account->username,who, deb); |
105 } else if (gc->account->perm_deny == GAIM_PRIVACY_ALLOW_USERS) { | 105 } else if (gc->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { |
106 gaim_debug_info("yahoo", | 106 purple_debug_info("yahoo", |
107 "%s allowed data received from %s (GAIM_PRIVACY_ALLOW_USERS)\n", | 107 "%s allowed data received from %s (PURPLE_PRIVACY_ALLOW_USERS)\n", |
108 gc->account->username,who); | 108 gc->account->username,who); |
109 } | 109 } |
110 | 110 |
111 return permitted; | 111 return permitted; |
112 } | 112 } |
113 | 113 |
114 static void yahoo_update_status(GaimConnection *gc, const char *name, YahooFriend *f) | 114 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) |
115 { | 115 { |
116 char *status = NULL; | 116 char *status = NULL; |
117 | 117 |
118 if (!gc || !name || !f || !gaim_find_buddy(gaim_connection_get_account(gc), name)) | 118 if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) |
119 return; | 119 return; |
120 | 120 |
121 if (f->status == YAHOO_STATUS_OFFLINE) | 121 if (f->status == YAHOO_STATUS_OFFLINE) |
122 { | 122 { |
123 return; | 123 return; |
163 status = YAHOO_STATUS_TYPE_AVAILABLE; | 163 status = YAHOO_STATUS_TYPE_AVAILABLE; |
164 else | 164 else |
165 status = YAHOO_STATUS_TYPE_AWAY; | 165 status = YAHOO_STATUS_TYPE_AWAY; |
166 break; | 166 break; |
167 default: | 167 default: |
168 gaim_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); | 168 purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); |
169 break; | 169 break; |
170 } | 170 } |
171 | 171 |
172 if (status) { | 172 if (status) { |
173 if (f->status == YAHOO_STATUS_CUSTOM) | 173 if (f->status == YAHOO_STATUS_CUSTOM) |
174 gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, status, "message", | 174 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", |
175 yahoo_friend_get_status_message(f), NULL); | 175 yahoo_friend_get_status_message(f), NULL); |
176 else | 176 else |
177 gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, status, NULL); | 177 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); |
178 } | 178 } |
179 | 179 |
180 if (f->idle != 0) | 180 if (f->idle != 0) |
181 gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, TRUE, f->idle); | 181 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle); |
182 else | 182 else |
183 gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, FALSE, 0); | 183 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); |
184 | 184 |
185 if (f->sms) | 185 if (f->sms) |
186 gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); | 186 purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); |
187 else | 187 else |
188 gaim_prpl_got_user_status_deactive(gaim_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); | 188 purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); |
189 } | 189 } |
190 | 190 |
191 static void yahoo_process_status(GaimConnection *gc, struct yahoo_packet *pkt) | 191 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) |
192 { | 192 { |
193 GaimAccount *account = gaim_connection_get_account(gc); | 193 PurpleAccount *account = purple_connection_get_account(gc); |
194 struct yahoo_data *yd = gc->proto_data; | 194 struct yahoo_data *yd = gc->proto_data; |
195 GSList *l = pkt->hash; | 195 GSList *l = pkt->hash; |
196 YahooFriend *f = NULL; | 196 YahooFriend *f = NULL; |
197 char *name = NULL; | 197 char *name = NULL; |
198 | 198 |
199 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { | 199 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { |
200 gc->wants_to_die = TRUE; | 200 gc->wants_to_die = TRUE; |
201 gaim_connection_error(gc, _("You have signed on from another location.")); | 201 purple_connection_error(gc, _("You have signed on from another location.")); |
202 return; | 202 return; |
203 } | 203 } |
204 | 204 |
205 while (l) { | 205 while (l) { |
206 struct yahoo_pair *pair = l->data; | 206 struct yahoo_pair *pair = l->data; |
208 switch (pair->key) { | 208 switch (pair->key) { |
209 case 0: /* we won't actually do anything with this */ | 209 case 0: /* we won't actually do anything with this */ |
210 break; | 210 break; |
211 case 1: /* we don't get the full buddy list here. */ | 211 case 1: /* we don't get the full buddy list here. */ |
212 if (!yd->logged_in) { | 212 if (!yd->logged_in) { |
213 gaim_connection_set_display_name(gc, pair->value); | 213 purple_connection_set_display_name(gc, pair->value); |
214 gaim_connection_set_state(gc, GAIM_CONNECTED); | 214 purple_connection_set_state(gc, PURPLE_CONNECTED); |
215 yd->logged_in = TRUE; | 215 yd->logged_in = TRUE; |
216 if (yd->picture_upload_todo) { | 216 if (yd->picture_upload_todo) { |
217 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); | 217 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); |
218 yd->picture_upload_todo = NULL; | 218 yd->picture_upload_todo = NULL; |
219 } | 219 } |
220 yahoo_set_status(account, gaim_account_get_active_status(account)); | 220 yahoo_set_status(account, purple_account_get_active_status(account)); |
221 | 221 |
222 /* this requests the list. i have a feeling that this is very evil | 222 /* this requests the list. i have a feeling that this is very evil |
223 * | 223 * |
224 * scs.yahoo.com sends you the list before this packet without it being | 224 * scs.yahoo.com sends you the list before this packet without it being |
225 * requested | 225 * requested |
309 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ | 309 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ |
310 if (strtol(pair->value, NULL, 10) == 0) { | 310 if (strtol(pair->value, NULL, 10) == 0) { |
311 if (f) | 311 if (f) |
312 f->status = YAHOO_STATUS_OFFLINE; | 312 f->status = YAHOO_STATUS_OFFLINE; |
313 if (name) { | 313 if (name) { |
314 gaim_prpl_got_user_status(account, name, "offline", NULL); | 314 purple_prpl_got_user_status(account, name, "offline", NULL); |
315 gaim_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); | 315 purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); |
316 } | 316 } |
317 break; | 317 break; |
318 } | 318 } |
319 break; | 319 break; |
320 case 60: /* SMS */ | 320 case 60: /* SMS */ |
328 guchar *decoded; | 328 guchar *decoded; |
329 char *tmp; | 329 char *tmp; |
330 gsize len; | 330 gsize len; |
331 | 331 |
332 if (pair->value) { | 332 if (pair->value) { |
333 decoded = gaim_base64_decode(pair->value, &len); | 333 decoded = purple_base64_decode(pair->value, &len); |
334 if (len) { | 334 if (len) { |
335 tmp = gaim_str_binary_to_ascii(decoded, len); | 335 tmp = purple_str_binary_to_ascii(decoded, len); |
336 gaim_debug_info("yahoo", "Got key 197, value = %s\n", tmp); | 336 purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); |
337 g_free(tmp); | 337 g_free(tmp); |
338 } | 338 } |
339 g_free(decoded); | 339 g_free(decoded); |
340 } | 340 } |
341 break; | 341 break; |
342 } | 342 } |
343 case 192: /* Pictures, aka Buddy Icons, checksum */ | 343 case 192: /* Pictures, aka Buddy Icons, checksum */ |
344 { | 344 { |
345 int cksum = strtol(pair->value, NULL, 10); | 345 int cksum = strtol(pair->value, NULL, 10); |
346 GaimBuddy *b; | 346 PurpleBuddy *b; |
347 | 347 |
348 if (!name) | 348 if (!name) |
349 break; | 349 break; |
350 | 350 |
351 b = gaim_find_buddy(gc->account, name); | 351 b = purple_find_buddy(gc->account, name); |
352 | 352 |
353 if (!cksum || (cksum == -1)) { | 353 if (!cksum || (cksum == -1)) { |
354 if (f) | 354 if (f) |
355 yahoo_friend_set_buddy_icon_need_request(f, TRUE); | 355 yahoo_friend_set_buddy_icon_need_request(f, TRUE); |
356 gaim_buddy_icons_set_for_user(gc->account, name, NULL, 0); | 356 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0); |
357 if (b) | 357 if (b) |
358 gaim_blist_node_remove_setting((GaimBlistNode *)b, YAHOO_ICON_CHECKSUM_KEY); | 358 purple_blist_node_remove_setting((PurpleBlistNode *)b, YAHOO_ICON_CHECKSUM_KEY); |
359 break; | 359 break; |
360 } | 360 } |
361 | 361 |
362 if (!f) | 362 if (!f) |
363 break; | 363 break; |
364 | 364 |
365 yahoo_friend_set_buddy_icon_need_request(f, FALSE); | 365 yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
366 if (b && cksum != gaim_blist_node_get_int((GaimBlistNode*)b, YAHOO_ICON_CHECKSUM_KEY)) | 366 if (b && cksum != purple_blist_node_get_int((PurpleBlistNode*)b, YAHOO_ICON_CHECKSUM_KEY)) |
367 yahoo_send_picture_request(gc, name); | 367 yahoo_send_picture_request(gc, name); |
368 | 368 |
369 break; | 369 break; |
370 } | 370 } |
371 case 16: /* Custom error message */ | 371 case 16: /* Custom error message */ |
372 { | 372 { |
373 char *tmp = yahoo_string_decode(gc, pair->value, TRUE); | 373 char *tmp = yahoo_string_decode(gc, pair->value, TRUE); |
374 gaim_notify_error(gc, NULL, tmp, NULL); | 374 purple_notify_error(gc, NULL, tmp, NULL); |
375 g_free(tmp); | 375 g_free(tmp); |
376 } | 376 } |
377 break; | 377 break; |
378 default: | 378 default: |
379 gaim_debug(GAIM_DEBUG_ERROR, "yahoo", | 379 purple_debug(PURPLE_DEBUG_ERROR, "yahoo", |
380 "Unknown status key %d\n", pair->key); | 380 "Unknown status key %d\n", pair->key); |
381 break; | 381 break; |
382 } | 382 } |
383 | 383 |
384 l = l->next; | 384 l = l->next; |
386 | 386 |
387 if (name && f) /* update the last buddy */ | 387 if (name && f) /* update the last buddy */ |
388 yahoo_update_status(gc, name, f); | 388 yahoo_update_status(gc, name, f); |
389 } | 389 } |
390 | 390 |
391 static void yahoo_do_group_check(GaimAccount *account, GHashTable *ht, const char *name, const char *group) | 391 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) |
392 { | 392 { |
393 GaimBuddy *b; | 393 PurpleBuddy *b; |
394 GaimGroup *g; | 394 PurpleGroup *g; |
395 GSList *list, *i; | 395 GSList *list, *i; |
396 gboolean onlist = 0; | 396 gboolean onlist = 0; |
397 char *oname = NULL; | 397 char *oname = NULL; |
398 char **oname_p = &oname; | 398 char **oname_p = &oname; |
399 GSList **list_p = &list; | 399 GSList **list_p = &list; |
400 | 400 |
401 if (!g_hash_table_lookup_extended(ht, gaim_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) | 401 if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) |
402 list = gaim_find_buddies(account, name); | 402 list = purple_find_buddies(account, name); |
403 else | 403 else |
404 g_hash_table_steal(ht, name); | 404 g_hash_table_steal(ht, name); |
405 | 405 |
406 for (i = list; i; i = i->next) { | 406 for (i = list; i; i = i->next) { |
407 b = i->data; | 407 b = i->data; |
408 g = gaim_buddy_get_group(b); | 408 g = purple_buddy_get_group(b); |
409 if (!gaim_utf8_strcasecmp(group, g->name)) { | 409 if (!purple_utf8_strcasecmp(group, g->name)) { |
410 gaim_debug(GAIM_DEBUG_MISC, "yahoo", | 410 purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
411 "Oh good, %s is in the right group (%s).\n", name, group); | 411 "Oh good, %s is in the right group (%s).\n", name, group); |
412 list = g_slist_delete_link(list, i); | 412 list = g_slist_delete_link(list, i); |
413 onlist = 1; | 413 onlist = 1; |
414 break; | 414 break; |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 if (!onlist) { | 418 if (!onlist) { |
419 gaim_debug(GAIM_DEBUG_MISC, "yahoo", | 419 purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
420 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); | 420 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); |
421 if (!(g = gaim_find_group(group))) { | 421 if (!(g = purple_find_group(group))) { |
422 g = gaim_group_new(group); | 422 g = purple_group_new(group); |
423 gaim_blist_add_group(g, NULL); | 423 purple_blist_add_group(g, NULL); |
424 } | 424 } |
425 b = gaim_buddy_new(account, name, NULL); | 425 b = purple_buddy_new(account, name, NULL); |
426 gaim_blist_add_buddy(b, NULL, g, NULL); | 426 purple_blist_add_buddy(b, NULL, g, NULL); |
427 } | 427 } |
428 | 428 |
429 if (list) { | 429 if (list) { |
430 if (!oname) | 430 if (!oname) |
431 oname = g_strdup(gaim_normalize(account, name)); | 431 oname = g_strdup(purple_normalize(account, name)); |
432 g_hash_table_insert(ht, oname, list); | 432 g_hash_table_insert(ht, oname, list); |
433 } else if (oname) | 433 } else if (oname) |
434 g_free(oname); | 434 g_free(oname); |
435 } | 435 } |
436 | 436 |
437 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) | 437 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) |
438 { | 438 { |
439 char *name = key; | 439 char *name = key; |
440 GSList *list = value, *i; | 440 GSList *list = value, *i; |
441 GaimBuddy *b; | 441 PurpleBuddy *b; |
442 GaimGroup *g; | 442 PurpleGroup *g; |
443 | 443 |
444 for (i = list; i; i = i->next) { | 444 for (i = list; i; i = i->next) { |
445 b = i->data; | 445 b = i->data; |
446 g = gaim_buddy_get_group(b); | 446 g = purple_buddy_get_group(b); |
447 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name); | 447 purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name); |
448 gaim_blist_remove_buddy(b); | 448 purple_blist_remove_buddy(b); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 static char *_getcookie(char *rawcookie) | 452 static char *_getcookie(char *rawcookie) |
453 { | 453 { |
480 g_free(yd->cookie_t); | 480 g_free(yd->cookie_t); |
481 yd->cookie_t = _getcookie(c); | 481 yd->cookie_t = _getcookie(c); |
482 } | 482 } |
483 } | 483 } |
484 | 484 |
485 static void yahoo_process_list_15(GaimConnection *gc, struct yahoo_packet *pkt) | 485 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
486 { | 486 { |
487 GSList *l = pkt->hash; | 487 GSList *l = pkt->hash; |
488 | 488 |
489 GaimAccount *account = gaim_connection_get_account(gc); | 489 PurpleAccount *account = purple_connection_get_account(gc); |
490 GHashTable *ht; | 490 GHashTable *ht; |
491 char *grp = NULL; | 491 char *grp = NULL; |
492 char *norm_bud = NULL; | 492 char *norm_bud = NULL; |
493 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ | 493 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
494 /* But what if you had no friends? */ | 494 /* But what if you had no friends? */ |
495 GaimBuddy *b; | 495 PurpleBuddy *b; |
496 GaimGroup *g; | 496 PurpleGroup *g; |
497 | 497 |
498 | 498 |
499 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); | 499 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); |
500 | 500 |
501 while (l) { | 501 while (l) { |
524 g_free(grp); | 524 g_free(grp); |
525 grp = yahoo_string_decode(gc, pair->value, FALSE); | 525 grp = yahoo_string_decode(gc, pair->value, FALSE); |
526 break; | 526 break; |
527 case 7: /* buddy's s/n */ | 527 case 7: /* buddy's s/n */ |
528 g_free(norm_bud); | 528 g_free(norm_bud); |
529 norm_bud = g_strdup(gaim_normalize(account, pair->value)); | 529 norm_bud = g_strdup(purple_normalize(account, pair->value)); |
530 | 530 |
531 if (grp) { | 531 if (grp) { |
532 /* This buddy is in a group */ | 532 /* This buddy is in a group */ |
533 f = yahoo_friend_find_or_new(gc, norm_bud); | 533 f = yahoo_friend_find_or_new(gc, norm_bud); |
534 if (!(b = gaim_find_buddy(account, norm_bud))) { | 534 if (!(b = purple_find_buddy(account, norm_bud))) { |
535 if (!(g = gaim_find_group(grp))) { | 535 if (!(g = purple_find_group(grp))) { |
536 g = gaim_group_new(grp); | 536 g = purple_group_new(grp); |
537 gaim_blist_add_group(g, NULL); | 537 purple_blist_add_group(g, NULL); |
538 } | 538 } |
539 b = gaim_buddy_new(account, norm_bud, NULL); | 539 b = purple_buddy_new(account, norm_bud, NULL); |
540 gaim_blist_add_buddy(b, NULL, g, NULL); | 540 purple_blist_add_buddy(b, NULL, g, NULL); |
541 } | 541 } |
542 yahoo_do_group_check(account, ht, norm_bud, grp); | 542 yahoo_do_group_check(account, ht, norm_bud, grp); |
543 | 543 |
544 } else { | 544 } else { |
545 /* This buddy is on the ignore list (and therefore in no group) */ | 545 /* This buddy is on the ignore list (and therefore in no group) */ |
546 gaim_privacy_deny_add(account, norm_bud, 1); | 546 purple_privacy_deny_add(account, norm_bud, 1); |
547 } | 547 } |
548 break; | 548 break; |
549 case 241: /* another protocol user */ | 549 case 241: /* another protocol user */ |
550 if (f) { | 550 if (f) { |
551 f->protocol = strtol(pair->value, NULL, 10); | 551 f->protocol = strtol(pair->value, NULL, 10); |
552 gaim_debug_info("yahoo", "Setting protocol to %d\n", f->protocol); | 552 purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol); |
553 } | 553 } |
554 break; | 554 break; |
555 /* case 242: */ /* this seems related to 241 */ | 555 /* case 242: */ /* this seems related to 241 */ |
556 /* break; */ | 556 /* break; */ |
557 } | 557 } |
561 g_hash_table_destroy(ht); | 561 g_hash_table_destroy(ht); |
562 g_free(grp); | 562 g_free(grp); |
563 g_free(norm_bud); | 563 g_free(norm_bud); |
564 } | 564 } |
565 | 565 |
566 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt) | 566 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) |
567 { | 567 { |
568 GSList *l = pkt->hash; | 568 GSList *l = pkt->hash; |
569 gboolean export = FALSE; | 569 gboolean export = FALSE; |
570 gboolean got_serv_list = FALSE; | 570 gboolean got_serv_list = FALSE; |
571 GaimBuddy *b; | 571 PurpleBuddy *b; |
572 GaimGroup *g; | 572 PurpleGroup *g; |
573 YahooFriend *f = NULL; | 573 YahooFriend *f = NULL; |
574 GaimAccount *account = gaim_connection_get_account(gc); | 574 PurpleAccount *account = purple_connection_get_account(gc); |
575 struct yahoo_data *yd = gc->proto_data; | 575 struct yahoo_data *yd = gc->proto_data; |
576 GHashTable *ht; | 576 GHashTable *ht; |
577 | 577 |
578 char **lines; | 578 char **lines; |
579 char **split; | 579 char **split; |
629 continue; | 629 continue; |
630 } | 630 } |
631 grp = yahoo_string_decode(gc, split[0], FALSE); | 631 grp = yahoo_string_decode(gc, split[0], FALSE); |
632 buddies = g_strsplit(split[1], ",", -1); | 632 buddies = g_strsplit(split[1], ",", -1); |
633 for (bud = buddies; bud && *bud; bud++) { | 633 for (bud = buddies; bud && *bud; bud++) { |
634 norm_bud = g_strdup(gaim_normalize(account, *bud)); | 634 norm_bud = g_strdup(purple_normalize(account, *bud)); |
635 f = yahoo_friend_find_or_new(gc, norm_bud); | 635 f = yahoo_friend_find_or_new(gc, norm_bud); |
636 | 636 |
637 if (!(b = gaim_find_buddy(account, norm_bud))) { | 637 if (!(b = purple_find_buddy(account, norm_bud))) { |
638 if (!(g = gaim_find_group(grp))) { | 638 if (!(g = purple_find_group(grp))) { |
639 g = gaim_group_new(grp); | 639 g = purple_group_new(grp); |
640 gaim_blist_add_group(g, NULL); | 640 purple_blist_add_group(g, NULL); |
641 } | 641 } |
642 b = gaim_buddy_new(account, norm_bud, NULL); | 642 b = purple_buddy_new(account, norm_bud, NULL); |
643 gaim_blist_add_buddy(b, NULL, g, NULL); | 643 purple_blist_add_buddy(b, NULL, g, NULL); |
644 export = TRUE; | 644 export = TRUE; |
645 } | 645 } |
646 | 646 |
647 yahoo_do_group_check(account, ht, norm_bud, grp); | 647 yahoo_do_group_check(account, ht, norm_bud, grp); |
648 g_free(norm_bud); | 648 g_free(norm_bud); |
662 if (yd->tmp_serv_ilist) { | 662 if (yd->tmp_serv_ilist) { |
663 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); | 663 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); |
664 for (bud = buddies; bud && *bud; bud++) { | 664 for (bud = buddies; bud && *bud; bud++) { |
665 /* The server is already ignoring the user */ | 665 /* The server is already ignoring the user */ |
666 got_serv_list = TRUE; | 666 got_serv_list = TRUE; |
667 gaim_privacy_deny_add(gc->account, *bud, 1); | 667 purple_privacy_deny_add(gc->account, *bud, 1); |
668 } | 668 } |
669 g_strfreev(buddies); | 669 g_strfreev(buddies); |
670 | 670 |
671 g_string_free(yd->tmp_serv_ilist, TRUE); | 671 g_string_free(yd->tmp_serv_ilist, TRUE); |
672 yd->tmp_serv_ilist = NULL; | 672 yd->tmp_serv_ilist = NULL; |
673 } | 673 } |
674 | 674 |
675 if (got_serv_list && | 675 if (got_serv_list && |
676 ((gc->account->perm_deny != GAIM_PRIVACY_ALLOW_BUDDYLIST) && | 676 ((gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && |
677 (gc->account->perm_deny != GAIM_PRIVACY_DENY_ALL) && | 677 (gc->account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && |
678 (gc->account->perm_deny != GAIM_PRIVACY_ALLOW_USERS))) | 678 (gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) |
679 { | 679 { |
680 gc->account->perm_deny = GAIM_PRIVACY_DENY_USERS; | 680 gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; |
681 gaim_debug_info("yahoo", "%s privacy defaulting to GAIM_PRIVACY_DENY_USERS.\n", | 681 purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", |
682 gc->account->username); | 682 gc->account->username); |
683 } | 683 } |
684 | 684 |
685 if (yd->tmp_serv_plist) { | 685 if (yd->tmp_serv_plist) { |
686 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); | 686 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); |
687 for (bud = buddies; bud && *bud; bud++) { | 687 for (bud = buddies; bud && *bud; bud++) { |
688 f = yahoo_friend_find(gc, *bud); | 688 f = yahoo_friend_find(gc, *bud); |
689 if (f) { | 689 if (f) { |
690 gaim_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", | 690 purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", |
691 gc->account->username, *bud); | 691 gc->account->username, *bud); |
692 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; | 692 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
693 } | 693 } |
694 } | 694 } |
695 g_strfreev(buddies); | 695 g_strfreev(buddies); |
697 yd->tmp_serv_plist = NULL; | 697 yd->tmp_serv_plist = NULL; |
698 | 698 |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 static void yahoo_process_notify(GaimConnection *gc, struct yahoo_packet *pkt) | 702 static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt) |
703 { | 703 { |
704 char *msg = NULL; | 704 char *msg = NULL; |
705 char *from = NULL; | 705 char *from = NULL; |
706 char *stat = NULL; | 706 char *stat = NULL; |
707 char *game = NULL; | 707 char *game = NULL; |
725 return; | 725 return; |
726 | 726 |
727 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) | 727 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) |
728 && (yahoo_privacy_check(gc, from))) { | 728 && (yahoo_privacy_check(gc, from))) { |
729 if (*stat == '1') | 729 if (*stat == '1') |
730 serv_got_typing(gc, from, 0, GAIM_TYPING); | 730 serv_got_typing(gc, from, 0, PURPLE_TYPING); |
731 else | 731 else |
732 serv_got_typing_stopped(gc, from); | 732 serv_got_typing_stopped(gc, from); |
733 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { | 733 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
734 GaimBuddy *bud = gaim_find_buddy(gc->account, from); | 734 PurpleBuddy *bud = purple_find_buddy(gc->account, from); |
735 | 735 |
736 if (!bud) { | 736 if (!bud) { |
737 gaim_debug(GAIM_DEBUG_WARNING, "yahoo", | 737 purple_debug(PURPLE_DEBUG_WARNING, "yahoo", |
738 "%s is playing a game, and doesn't want " | 738 "%s is playing a game, and doesn't want " |
739 "you to know.\n", from); | 739 "you to know.\n", from); |
740 } | 740 } |
741 | 741 |
742 f = yahoo_friend_find(gc, from); | 742 f = yahoo_friend_find(gc, from); |
760 int utf8; | 760 int utf8; |
761 int buddy_icon; | 761 int buddy_icon; |
762 char *msg; | 762 char *msg; |
763 }; | 763 }; |
764 | 764 |
765 static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt) | 765 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
766 { | 766 { |
767 struct yahoo_data *yd = gc->proto_data; | 767 struct yahoo_data *yd = gc->proto_data; |
768 GSList *l = pkt->hash; | 768 GSList *l = pkt->hash; |
769 GSList *list = NULL; | 769 GSList *list = NULL; |
770 struct _yahoo_im *im = NULL; | 770 struct _yahoo_im *im = NULL; |
799 imv = pair->value; | 799 imv = pair->value; |
800 } | 800 } |
801 l = l->next; | 801 l = l->next; |
802 } | 802 } |
803 } else if (pkt->status == 2) { | 803 } else if (pkt->status == 2) { |
804 gaim_notify_error(gc, NULL, | 804 purple_notify_error(gc, NULL, |
805 _("Your Yahoo! message did not get sent."), NULL); | 805 _("Your Yahoo! message did not get sent."), NULL); |
806 } | 806 } |
807 | 807 |
808 /** TODO: It seems that this check should be per IM, not global */ | 808 /** TODO: It seems that this check should be per IM, not global */ |
809 /* Check for the Doodle IMV */ | 809 /* Check for the Doodle IMV */ |
811 { | 811 { |
812 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); | 812 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); |
813 | 813 |
814 if (strcmp(imv, "doodle;11") == 0) | 814 if (strcmp(imv, "doodle;11") == 0) |
815 { | 815 { |
816 GaimWhiteboard *wb; | 816 PurpleWhiteboard *wb; |
817 | 817 |
818 if (!yahoo_privacy_check(gc, im->from)) { | 818 if (!yahoo_privacy_check(gc, im->from)) { |
819 gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); | 819 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); |
820 return; | 820 return; |
821 } | 821 } |
822 | 822 |
823 wb = gaim_whiteboard_get_session(gc->account, im->from); | 823 wb = purple_whiteboard_get_session(gc->account, im->from); |
824 | 824 |
825 /* If a Doodle session doesn't exist between this user */ | 825 /* If a Doodle session doesn't exist between this user */ |
826 if(wb == NULL) | 826 if(wb == NULL) |
827 { | 827 { |
828 wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); | 828 wb = purple_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); |
829 | 829 |
830 yahoo_doodle_command_send_request(gc, im->from); | 830 yahoo_doodle_command_send_request(gc, im->from); |
831 yahoo_doodle_command_send_ready(gc, im->from); | 831 yahoo_doodle_command_send_ready(gc, im->from); |
832 } | 832 } |
833 } | 833 } |
842 g_free(im); | 842 g_free(im); |
843 continue; | 843 continue; |
844 } | 844 } |
845 | 845 |
846 if (!yahoo_privacy_check(gc, im->from)) { | 846 if (!yahoo_privacy_check(gc, im->from)) { |
847 gaim_debug_info("yahoo", "Message from %s dropped.\n", im->from); | 847 purple_debug_info("yahoo", "Message from %s dropped.\n", im->from); |
848 return; | 848 return; |
849 } | 849 } |
850 | 850 |
851 m = yahoo_string_decode(gc, im->msg, im->utf8); | 851 m = yahoo_string_decode(gc, im->msg, im->utf8); |
852 /* This may actually not be necessary, but it appears | 852 /* This may actually not be necessary, but it appears |
853 * that at least at one point some clients were sending | 853 * that at least at one point some clients were sending |
854 * "\r\n" as line delimiters, so we want to avoid double | 854 * "\r\n" as line delimiters, so we want to avoid double |
855 * lines. */ | 855 * lines. */ |
856 m2 = gaim_strreplace(m, "\r\n", "\n"); | 856 m2 = purple_strreplace(m, "\r\n", "\n"); |
857 g_free(m); | 857 g_free(m); |
858 m = m2; | 858 m = m2; |
859 gaim_util_chrreplace(m, '\r', '\n'); | 859 purple_util_chrreplace(m, '\r', '\n'); |
860 | 860 |
861 if (!strcmp(m, "<ding>")) { | 861 if (!strcmp(m, "<ding>")) { |
862 GaimConversation *c = gaim_conversation_new(GAIM_CONV_TYPE_IM, | 862 PurpleConversation *c = purple_conversation_new(PURPLE_CONV_TYPE_IM, |
863 gaim_connection_get_account(gc), im->from); | 863 purple_connection_get_account(gc), im->from); |
864 gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_RECV, | 864 purple_conv_im_write(PURPLE_CONV_IM(c), "", _("Buzz!!"), PURPLE_MESSAGE_NICK|PURPLE_MESSAGE_RECV, |
865 im->time); | 865 im->time); |
866 g_free(m); | 866 g_free(m); |
867 g_free(im); | 867 g_free(im); |
868 continue; | 868 continue; |
869 } | 869 } |
883 g_free(im); | 883 g_free(im); |
884 } | 884 } |
885 g_slist_free(list); | 885 g_slist_free(list); |
886 } | 886 } |
887 | 887 |
888 static void yahoo_process_sysmessage(GaimConnection *gc, struct yahoo_packet *pkt) | 888 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) |
889 { | 889 { |
890 GSList *l = pkt->hash; | 890 GSList *l = pkt->hash; |
891 char *prim, *me = NULL, *msg = NULL, *escmsg = NULL; | 891 char *prim, *me = NULL, *msg = NULL, *escmsg = NULL; |
892 | 892 |
893 while (l) { | 893 while (l) { |
906 | 906 |
907 /* TODO: Does this really need to be escaped? It seems like it doesn't. */ | 907 /* TODO: Does this really need to be escaped? It seems like it doesn't. */ |
908 escmsg = g_markup_escape_text(msg, -1); | 908 escmsg = g_markup_escape_text(msg, -1); |
909 | 909 |
910 prim = g_strdup_printf(_("Yahoo! system message for %s:"), | 910 prim = g_strdup_printf(_("Yahoo! system message for %s:"), |
911 me?me:gaim_connection_get_display_name(gc)); | 911 me?me:purple_connection_get_display_name(gc)); |
912 gaim_notify_info(NULL, NULL, prim, escmsg); | 912 purple_notify_info(NULL, NULL, prim, escmsg); |
913 g_free(prim); | 913 g_free(prim); |
914 g_free(escmsg); | 914 g_free(escmsg); |
915 } | 915 } |
916 | 916 |
917 struct yahoo_add_request { | 917 struct yahoo_add_request { |
918 GaimConnection *gc; | 918 PurpleConnection *gc; |
919 char *id; | 919 char *id; |
920 char *who; | 920 char *who; |
921 char *msg; | 921 char *msg; |
922 }; | 922 }; |
923 | 923 |
940 | 940 |
941 pkt = yahoo_packet_new(YAHOO_SERVICE_REJECTCONTACT, | 941 pkt = yahoo_packet_new(YAHOO_SERVICE_REJECTCONTACT, |
942 YAHOO_STATUS_AVAILABLE, 0); | 942 YAHOO_STATUS_AVAILABLE, 0); |
943 | 943 |
944 yahoo_packet_hash(pkt, "sss", | 944 yahoo_packet_hash(pkt, "sss", |
945 1, gaim_normalize(add_req->gc->account, | 945 1, purple_normalize(add_req->gc->account, |
946 gaim_account_get_username( | 946 purple_account_get_username( |
947 gaim_connection_get_account( | 947 purple_connection_get_account( |
948 add_req->gc))), | 948 add_req->gc))), |
949 7, add_req->who, | 949 7, add_req->who, |
950 14, encoded_msg ? encoded_msg : ""); | 950 14, encoded_msg ? encoded_msg : ""); |
951 | 951 |
952 yahoo_packet_send_and_free(pkt, yd); | 952 yahoo_packet_send_and_free(pkt, yd); |
965 yahoo_buddy_add_deny_cb(add_req, NULL); | 965 yahoo_buddy_add_deny_cb(add_req, NULL); |
966 } | 966 } |
967 | 967 |
968 static void | 968 static void |
969 yahoo_buddy_add_deny_reason_cb(struct yahoo_add_request *add_req) { | 969 yahoo_buddy_add_deny_reason_cb(struct yahoo_add_request *add_req) { |
970 gaim_request_input(add_req->gc, NULL, _("Authorization denied message:"), | 970 purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), |
971 NULL, _("No reason given."), TRUE, FALSE, NULL, | 971 NULL, _("No reason given."), TRUE, FALSE, NULL, |
972 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), | 972 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), |
973 _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), add_req); | 973 _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), add_req); |
974 } | 974 } |
975 | 975 |
976 static void yahoo_buddy_added_us(GaimConnection *gc, struct yahoo_packet *pkt) { | 976 static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { |
977 struct yahoo_add_request *add_req; | 977 struct yahoo_add_request *add_req; |
978 char *msg = NULL; | 978 char *msg = NULL; |
979 GSList *l = pkt->hash; | 979 GSList *l = pkt->hash; |
980 | 980 |
981 add_req = g_new0(struct yahoo_add_request, 1); | 981 add_req = g_new0(struct yahoo_add_request, 1); |
1005 add_req->msg = yahoo_string_decode(gc, msg, FALSE); | 1005 add_req->msg = yahoo_string_decode(gc, msg, FALSE); |
1006 | 1006 |
1007 /* DONE! this is almost exactly the same as what MSN does, | 1007 /* DONE! this is almost exactly the same as what MSN does, |
1008 * this should probably be moved to the core. | 1008 * this should probably be moved to the core. |
1009 */ | 1009 */ |
1010 gaim_account_request_authorization(gaim_connection_get_account(gc), add_req->who, add_req->id, | 1010 purple_account_request_authorization(purple_connection_get_account(gc), add_req->who, add_req->id, |
1011 NULL, add_req->msg, gaim_find_buddy(gaim_connection_get_account(gc),add_req->who) != NULL, | 1011 NULL, add_req->msg, purple_find_buddy(purple_connection_get_account(gc),add_req->who) != NULL, |
1012 G_CALLBACK(yahoo_buddy_add_authorize_cb), | 1012 G_CALLBACK(yahoo_buddy_add_authorize_cb), |
1013 G_CALLBACK(yahoo_buddy_add_deny_reason_cb), | 1013 G_CALLBACK(yahoo_buddy_add_deny_reason_cb), |
1014 add_req); | 1014 add_req); |
1015 } else { | 1015 } else { |
1016 g_free(add_req->id); | 1016 g_free(add_req->id); |
1018 /*g_free(add_req->msg);*/ | 1018 /*g_free(add_req->msg);*/ |
1019 g_free(add_req); | 1019 g_free(add_req); |
1020 } | 1020 } |
1021 } | 1021 } |
1022 | 1022 |
1023 static void yahoo_buddy_denied_our_add(GaimConnection *gc, struct yahoo_packet *pkt) | 1023 static void yahoo_buddy_denied_our_add(PurpleConnection *gc, struct yahoo_packet *pkt) |
1024 { | 1024 { |
1025 char *who = NULL; | 1025 char *who = NULL; |
1026 char *msg = NULL; | 1026 char *msg = NULL; |
1027 GSList *l = pkt->hash; | 1027 GSList *l = pkt->hash; |
1028 GString *buf = NULL; | 1028 GString *buf = NULL; |
1050 } else { | 1050 } else { |
1051 msg2 = yahoo_string_decode(gc, msg, FALSE); | 1051 msg2 = yahoo_string_decode(gc, msg, FALSE); |
1052 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); | 1052 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); |
1053 g_free(msg2); | 1053 g_free(msg2); |
1054 } | 1054 } |
1055 gaim_notify_info(gc, NULL, _("Add buddy rejected"), buf->str); | 1055 purple_notify_info(gc, NULL, _("Add buddy rejected"), buf->str); |
1056 g_string_free(buf, TRUE); | 1056 g_string_free(buf, TRUE); |
1057 g_hash_table_remove(yd->friends, who); | 1057 g_hash_table_remove(yd->friends, who); |
1058 gaim_prpl_got_user_status(gaim_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ | 1058 purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ |
1059 /* TODO: Shouldn't we remove the buddy from our local list? */ | 1059 /* TODO: Shouldn't we remove the buddy from our local list? */ |
1060 } | 1060 } |
1061 } | 1061 } |
1062 | 1062 |
1063 static void yahoo_process_contact(GaimConnection *gc, struct yahoo_packet *pkt) | 1063 static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) |
1064 { | 1064 { |
1065 switch (pkt->status) { | 1065 switch (pkt->status) { |
1066 case 1: | 1066 case 1: |
1067 yahoo_process_status(gc, pkt); | 1067 yahoo_process_status(gc, pkt); |
1068 return; | 1068 return; |
1128 g_free(new); | 1128 g_free(new); |
1129 | 1129 |
1130 return converted; | 1130 return converted; |
1131 } | 1131 } |
1132 | 1132 |
1133 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt) | 1133 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
1134 { | 1134 { |
1135 GaimAccount *account = gaim_connection_get_account(gc); | 1135 PurpleAccount *account = purple_connection_get_account(gc); |
1136 struct yahoo_data *yd = gc->proto_data; | 1136 struct yahoo_data *yd = gc->proto_data; |
1137 char *who = NULL; | 1137 char *who = NULL; |
1138 char *email = NULL; | 1138 char *email = NULL; |
1139 char *subj = NULL; | 1139 char *subj = NULL; |
1140 char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); | 1140 char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
1141 int count = 0; | 1141 int count = 0; |
1142 GSList *l = pkt->hash; | 1142 GSList *l = pkt->hash; |
1143 | 1143 |
1144 if (!gaim_account_get_check_mail(account)) | 1144 if (!purple_account_get_check_mail(account)) |
1145 return; | 1145 return; |
1146 | 1146 |
1147 while (l) { | 1147 while (l) { |
1148 struct yahoo_pair *pair = l->data; | 1148 struct yahoo_pair *pair = l->data; |
1149 if (pair->key == 9) | 1149 if (pair->key == 9) |
1160 if (who && subj && email && *email) { | 1160 if (who && subj && email && *email) { |
1161 char *dec_who = yahoo_decode(who); | 1161 char *dec_who = yahoo_decode(who); |
1162 char *dec_subj = yahoo_decode(subj); | 1162 char *dec_subj = yahoo_decode(subj); |
1163 char *from = g_strdup_printf("%s (%s)", dec_who, email); | 1163 char *from = g_strdup_printf("%s (%s)", dec_who, email); |
1164 | 1164 |
1165 gaim_notify_email(gc, dec_subj, from, gaim_account_get_username(account), | 1165 purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), |
1166 yahoo_mail_url, NULL, NULL); | 1166 yahoo_mail_url, NULL, NULL); |
1167 | 1167 |
1168 g_free(dec_who); | 1168 g_free(dec_who); |
1169 g_free(dec_subj); | 1169 g_free(dec_subj); |
1170 g_free(from); | 1170 g_free(from); |
1171 } else if (count > 0) { | 1171 } else if (count > 0) { |
1172 const char *to = gaim_account_get_username(account); | 1172 const char *to = purple_account_get_username(account); |
1173 const char *url = yahoo_mail_url; | 1173 const char *url = yahoo_mail_url; |
1174 | 1174 |
1175 gaim_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url, | 1175 purple_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url, |
1176 NULL, NULL); | 1176 NULL, NULL); |
1177 } | 1177 } |
1178 } | 1178 } |
1179 /* This is the y64 alphabet... it's like base64, but has a . and a _ */ | 1179 /* This is the y64 alphabet... it's like base64, but has a . and a _ */ |
1180 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; | 1180 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; |
1205 *out++ = '-'; | 1205 *out++ = '-'; |
1206 } | 1206 } |
1207 *out = '\0'; | 1207 *out = '\0'; |
1208 } | 1208 } |
1209 | 1209 |
1210 static void yahoo_process_auth_old(GaimConnection *gc, const char *seed) | 1210 static void yahoo_process_auth_old(PurpleConnection *gc, const char *seed) |
1211 { | 1211 { |
1212 struct yahoo_packet *pack; | 1212 struct yahoo_packet *pack; |
1213 GaimAccount *account = gaim_connection_get_account(gc); | 1213 PurpleAccount *account = purple_connection_get_account(gc); |
1214 const char *name = gaim_normalize(account, gaim_account_get_username(account)); | 1214 const char *name = purple_normalize(account, purple_account_get_username(account)); |
1215 const char *pass = gaim_connection_get_password(gc); | 1215 const char *pass = purple_connection_get_password(gc); |
1216 struct yahoo_data *yd = gc->proto_data; | 1216 struct yahoo_data *yd = gc->proto_data; |
1217 | 1217 |
1218 /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly | 1218 /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly |
1219 * will soon do so in the rest of the world. | 1219 * will soon do so in the rest of the world. |
1220 * | 1220 * |
1224 * party clients from connecting to their servers. | 1224 * party clients from connecting to their servers. |
1225 * | 1225 * |
1226 * Sorry, Yahoo. | 1226 * Sorry, Yahoo. |
1227 */ | 1227 */ |
1228 | 1228 |
1229 GaimCipher *cipher; | 1229 PurpleCipher *cipher; |
1230 GaimCipherContext *context; | 1230 PurpleCipherContext *context; |
1231 guchar digest[16]; | 1231 guchar digest[16]; |
1232 | 1232 |
1233 char *crypt_result; | 1233 char *crypt_result; |
1234 char password_hash[25]; | 1234 char password_hash[25]; |
1235 char crypt_hash[25]; | 1235 char crypt_hash[25]; |
1244 char result96[25]; | 1244 char result96[25]; |
1245 | 1245 |
1246 sv = seed[15]; | 1246 sv = seed[15]; |
1247 sv = sv % 8; | 1247 sv = sv % 8; |
1248 | 1248 |
1249 cipher = gaim_ciphers_find_cipher("md5"); | 1249 cipher = purple_ciphers_find_cipher("md5"); |
1250 context = gaim_cipher_context_new(cipher, NULL); | 1250 context = purple_cipher_context_new(cipher, NULL); |
1251 | 1251 |
1252 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass)); | 1252 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); |
1253 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1253 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1254 | 1254 |
1255 to_y64(password_hash, digest, 16); | 1255 to_y64(password_hash, digest, 16); |
1256 | 1256 |
1257 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); | 1257 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); |
1258 | 1258 |
1259 gaim_cipher_context_reset(context, NULL); | 1259 purple_cipher_context_reset(context, NULL); |
1260 gaim_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result)); | 1260 purple_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result)); |
1261 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1261 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1262 to_y64(crypt_hash, digest, 16); | 1262 to_y64(crypt_hash, digest, 16); |
1263 | 1263 |
1264 switch (sv) { | 1264 switch (sv) { |
1265 case 1: | 1265 case 1: |
1266 case 6: | 1266 case 6: |
1300 g_snprintf(hash_string_c, strlen(name) + 50, | 1300 g_snprintf(hash_string_c, strlen(name) + 50, |
1301 "%c%s%s%s", checksum, crypt_hash, name, seed); | 1301 "%c%s%s%s", checksum, crypt_hash, name, seed); |
1302 break; | 1302 break; |
1303 } | 1303 } |
1304 | 1304 |
1305 gaim_cipher_context_reset(context, NULL); | 1305 purple_cipher_context_reset(context, NULL); |
1306 gaim_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p)); | 1306 purple_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p)); |
1307 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1307 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1308 to_y64(result6, digest, 16); | 1308 to_y64(result6, digest, 16); |
1309 | 1309 |
1310 gaim_cipher_context_reset(context, NULL); | 1310 purple_cipher_context_reset(context, NULL); |
1311 gaim_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c)); | 1311 purple_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c)); |
1312 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 1312 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
1313 gaim_cipher_context_destroy(context); | 1313 purple_cipher_context_destroy(context); |
1314 to_y64(result96, digest, 16); | 1314 to_y64(result96, digest, 16); |
1315 | 1315 |
1316 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | 1316 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); |
1317 yahoo_packet_hash(pack, "ssss", 0, name, 6, result6, 96, result96, 1, name); | 1317 yahoo_packet_hash(pack, "ssss", 0, name, 6, result6, 96, result96, 1, name); |
1318 yahoo_packet_send_and_free(pack, yd); | 1318 yahoo_packet_send_and_free(pack, yd); |
1322 } | 1322 } |
1323 | 1323 |
1324 /* I'm dishing out some uber-mad props to Cerulean Studios for cracking this | 1324 /* I'm dishing out some uber-mad props to Cerulean Studios for cracking this |
1325 * and sending the fix! Thanks guys. */ | 1325 * and sending the fix! Thanks guys. */ |
1326 | 1326 |
1327 static void yahoo_process_auth_new(GaimConnection *gc, const char *seed) | 1327 static void yahoo_process_auth_new(PurpleConnection *gc, const char *seed) |
1328 { | 1328 { |
1329 struct yahoo_packet *pack = NULL; | 1329 struct yahoo_packet *pack = NULL; |
1330 GaimAccount *account = gaim_connection_get_account(gc); | 1330 PurpleAccount *account = purple_connection_get_account(gc); |
1331 const char *name = gaim_normalize(account, gaim_account_get_username(account)); | 1331 const char *name = purple_normalize(account, purple_account_get_username(account)); |
1332 const char *pass = gaim_connection_get_password(gc); | 1332 const char *pass = purple_connection_get_password(gc); |
1333 char *enc_pass; | 1333 char *enc_pass; |
1334 struct yahoo_data *yd = gc->proto_data; | 1334 struct yahoo_data *yd = gc->proto_data; |
1335 | 1335 |
1336 GaimCipher *md5_cipher; | 1336 PurpleCipher *md5_cipher; |
1337 GaimCipherContext *md5_ctx; | 1337 PurpleCipherContext *md5_ctx; |
1338 guchar md5_digest[16]; | 1338 guchar md5_digest[16]; |
1339 | 1339 |
1340 GaimCipher *sha1_cipher; | 1340 PurpleCipher *sha1_cipher; |
1341 GaimCipherContext *sha1_ctx1; | 1341 PurpleCipherContext *sha1_ctx1; |
1342 GaimCipherContext *sha1_ctx2; | 1342 PurpleCipherContext *sha1_ctx2; |
1343 | 1343 |
1344 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ"; | 1344 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ"; |
1345 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop"; | 1345 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop"; |
1346 | 1346 |
1347 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5"; | 1347 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5"; |
1387 memset(&resp_6, 0, 100); | 1387 memset(&resp_6, 0, 100); |
1388 memset(&resp_96, 0, 100); | 1388 memset(&resp_96, 0, 100); |
1389 memset(&magic_key_char, 0, 4); | 1389 memset(&magic_key_char, 0, 4); |
1390 memset(&comparison_src, 0, 20); | 1390 memset(&comparison_src, 0, 20); |
1391 | 1391 |
1392 md5_cipher = gaim_ciphers_find_cipher("md5"); | 1392 md5_cipher = purple_ciphers_find_cipher("md5"); |
1393 md5_ctx = gaim_cipher_context_new(md5_cipher, NULL); | 1393 md5_ctx = purple_cipher_context_new(md5_cipher, NULL); |
1394 | 1394 |
1395 sha1_cipher = gaim_ciphers_find_cipher("sha1"); | 1395 sha1_cipher = purple_ciphers_find_cipher("sha1"); |
1396 sha1_ctx1 = gaim_cipher_context_new(sha1_cipher, NULL); | 1396 sha1_ctx1 = purple_cipher_context_new(sha1_cipher, NULL); |
1397 sha1_ctx2 = gaim_cipher_context_new(sha1_cipher, NULL); | 1397 sha1_ctx2 = purple_cipher_context_new(sha1_cipher, NULL); |
1398 | 1398 |
1399 /* | 1399 /* |
1400 * Magic: Phase 1. Generate what seems to be a 30 byte value (could change if base64 | 1400 * Magic: Phase 1. Generate what seems to be a 30 byte value (could change if base64 |
1401 * ends up differently? I don't remember and I'm tired, so use a 64 byte buffer. | 1401 * ends up differently? I don't remember and I'm tired, so use a 64 byte buffer. |
1402 */ | 1402 */ |
1528 /* Calculate buffer. */ | 1528 /* Calculate buffer. */ |
1529 test[0] = x; | 1529 test[0] = x; |
1530 test[1] = x >> 8; | 1530 test[1] = x >> 8; |
1531 test[2] = y; | 1531 test[2] = y; |
1532 | 1532 |
1533 gaim_cipher_context_reset(md5_ctx, NULL); | 1533 purple_cipher_context_reset(md5_ctx, NULL); |
1534 gaim_cipher_context_append(md5_ctx, magic_key_char, 4); | 1534 purple_cipher_context_append(md5_ctx, magic_key_char, 4); |
1535 gaim_cipher_context_append(md5_ctx, test, 3); | 1535 purple_cipher_context_append(md5_ctx, test, 3); |
1536 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), | 1536 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), |
1537 md5_digest, NULL); | 1537 md5_digest, NULL); |
1538 | 1538 |
1539 if (!memcmp(md5_digest, comparison_src+4, 16)) { | 1539 if (!memcmp(md5_digest, comparison_src+4, 16)) { |
1540 leave = 1; | 1540 leave = 1; |
1541 break; | 1541 break; |
1563 } | 1563 } |
1564 | 1564 |
1565 enc_pass = yahoo_string_encode(gc, pass, NULL); | 1565 enc_pass = yahoo_string_encode(gc, pass, NULL); |
1566 | 1566 |
1567 /* Get password and crypt hashes as per usual. */ | 1567 /* Get password and crypt hashes as per usual. */ |
1568 gaim_cipher_context_reset(md5_ctx, NULL); | 1568 purple_cipher_context_reset(md5_ctx, NULL); |
1569 gaim_cipher_context_append(md5_ctx, (const guchar *)enc_pass, strlen(enc_pass)); | 1569 purple_cipher_context_append(md5_ctx, (const guchar *)enc_pass, strlen(enc_pass)); |
1570 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), | 1570 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), |
1571 md5_digest, NULL); | 1571 md5_digest, NULL); |
1572 to_y64(password_hash, md5_digest, 16); | 1572 to_y64(password_hash, md5_digest, 16); |
1573 | 1573 |
1574 crypt_result = yahoo_crypt(enc_pass, "$1$_2S43d5f$"); | 1574 crypt_result = yahoo_crypt(enc_pass, "$1$_2S43d5f$"); |
1575 | 1575 |
1576 g_free(enc_pass); | 1576 g_free(enc_pass); |
1577 enc_pass = NULL; | 1577 enc_pass = NULL; |
1578 | 1578 |
1579 gaim_cipher_context_reset(md5_ctx, NULL); | 1579 purple_cipher_context_reset(md5_ctx, NULL); |
1580 gaim_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result)); | 1580 purple_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result)); |
1581 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest), | 1581 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), |
1582 md5_digest, NULL); | 1582 md5_digest, NULL); |
1583 to_y64(crypt_hash, md5_digest, 16); | 1583 to_y64(crypt_hash, md5_digest, 16); |
1584 | 1584 |
1585 /* Our first authentication response is based off of the password hash. */ | 1585 /* Our first authentication response is based off of the password hash. */ |
1586 for (x = 0; x < (int)strlen(password_hash); x++) | 1586 for (x = 0; x < (int)strlen(password_hash); x++) |
1600 /* | 1600 /* |
1601 * The first context gets the password hash XORed with 0x36 plus a magic value | 1601 * The first context gets the password hash XORed with 0x36 plus a magic value |
1602 * which we previously extrapolated from our challenge. | 1602 * which we previously extrapolated from our challenge. |
1603 */ | 1603 */ |
1604 | 1604 |
1605 gaim_cipher_context_append(sha1_ctx1, pass_hash_xor1, 64); | 1605 purple_cipher_context_append(sha1_ctx1, pass_hash_xor1, 64); |
1606 if (y >= 3) | 1606 if (y >= 3) |
1607 gaim_cipher_context_set_option(sha1_ctx1, "sizeLo", GINT_TO_POINTER(0x1ff)); | 1607 purple_cipher_context_set_option(sha1_ctx1, "sizeLo", GINT_TO_POINTER(0x1ff)); |
1608 gaim_cipher_context_append(sha1_ctx1, magic_key_char, 4); | 1608 purple_cipher_context_append(sha1_ctx1, magic_key_char, 4); |
1609 gaim_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); | 1609 purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); |
1610 | 1610 |
1611 /* | 1611 /* |
1612 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest | 1612 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest |
1613 * of the first context. | 1613 * of the first context. |
1614 */ | 1614 */ |
1615 | 1615 |
1616 gaim_cipher_context_append(sha1_ctx2, pass_hash_xor2, 64); | 1616 purple_cipher_context_append(sha1_ctx2, pass_hash_xor2, 64); |
1617 gaim_cipher_context_append(sha1_ctx2, digest1, 20); | 1617 purple_cipher_context_append(sha1_ctx2, digest1, 20); |
1618 gaim_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); | 1618 purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); |
1619 | 1619 |
1620 /* | 1620 /* |
1621 * Now that we have digest2, use it to fetch characters from an alphabet to construct | 1621 * Now that we have digest2, use it to fetch characters from an alphabet to construct |
1622 * our first authentication response. | 1622 * our first authentication response. |
1623 */ | 1623 */ |
1683 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c; | 1683 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c; |
1684 | 1684 |
1685 if (cnt < 64) | 1685 if (cnt < 64) |
1686 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt); | 1686 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt); |
1687 | 1687 |
1688 gaim_cipher_context_reset(sha1_ctx1, NULL); | 1688 purple_cipher_context_reset(sha1_ctx1, NULL); |
1689 gaim_cipher_context_reset(sha1_ctx2, NULL); | 1689 purple_cipher_context_reset(sha1_ctx2, NULL); |
1690 | 1690 |
1691 /* | 1691 /* |
1692 * The first context gets the password hash XORed with 0x36 plus a magic value | 1692 * The first context gets the password hash XORed with 0x36 plus a magic value |
1693 * which we previously extrapolated from our challenge. | 1693 * which we previously extrapolated from our challenge. |
1694 */ | 1694 */ |
1695 | 1695 |
1696 gaim_cipher_context_append(sha1_ctx1, crypt_hash_xor1, 64); | 1696 purple_cipher_context_append(sha1_ctx1, crypt_hash_xor1, 64); |
1697 if (y >= 3) { | 1697 if (y >= 3) { |
1698 gaim_cipher_context_set_option(sha1_ctx1, "sizeLo", | 1698 purple_cipher_context_set_option(sha1_ctx1, "sizeLo", |
1699 GINT_TO_POINTER(0x1ff)); | 1699 GINT_TO_POINTER(0x1ff)); |
1700 } | 1700 } |
1701 gaim_cipher_context_append(sha1_ctx1, magic_key_char, 4); | 1701 purple_cipher_context_append(sha1_ctx1, magic_key_char, 4); |
1702 gaim_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); | 1702 purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); |
1703 | 1703 |
1704 /* | 1704 /* |
1705 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest | 1705 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest |
1706 * of the first context. | 1706 * of the first context. |
1707 */ | 1707 */ |
1708 | 1708 |
1709 gaim_cipher_context_append(sha1_ctx2, crypt_hash_xor2, 64); | 1709 purple_cipher_context_append(sha1_ctx2, crypt_hash_xor2, 64); |
1710 gaim_cipher_context_append(sha1_ctx2, digest1, 20); | 1710 purple_cipher_context_append(sha1_ctx2, digest1, 20); |
1711 gaim_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); | 1711 purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); |
1712 | 1712 |
1713 /* | 1713 /* |
1714 * Now that we have digest2, use it to fetch characters from an alphabet to construct | 1714 * Now that we have digest2, use it to fetch characters from an alphabet to construct |
1715 * our first authentication response. | 1715 * our first authentication response. |
1716 */ | 1716 */ |
1755 if (lookup >= strlen(delimit_lookup)) | 1755 if (lookup >= strlen(delimit_lookup)) |
1756 break; | 1756 break; |
1757 sprintf(byte, "%c", delimit_lookup[lookup]); | 1757 sprintf(byte, "%c", delimit_lookup[lookup]); |
1758 strcat(resp_96, byte); | 1758 strcat(resp_96, byte); |
1759 } | 1759 } |
1760 gaim_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); | 1760 purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); |
1761 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0); | 1761 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0); |
1762 yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1, | 1762 yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1, |
1763 name, 135, "6,0,0,1710"); | 1763 name, 135, "6,0,0,1710"); |
1764 if (yd->picture_checksum) | 1764 if (yd->picture_checksum) |
1765 yahoo_packet_hash_int(pack, 192, yd->picture_checksum); | 1765 yahoo_packet_hash_int(pack, 192, yd->picture_checksum); |
1766 | 1766 |
1767 yahoo_packet_send_and_free(pack, yd); | 1767 yahoo_packet_send_and_free(pack, yd); |
1768 | 1768 |
1769 gaim_cipher_context_destroy(md5_ctx); | 1769 purple_cipher_context_destroy(md5_ctx); |
1770 gaim_cipher_context_destroy(sha1_ctx1); | 1770 purple_cipher_context_destroy(sha1_ctx1); |
1771 gaim_cipher_context_destroy(sha1_ctx2); | 1771 purple_cipher_context_destroy(sha1_ctx2); |
1772 | 1772 |
1773 g_free(password_hash); | 1773 g_free(password_hash); |
1774 g_free(crypt_hash); | 1774 g_free(crypt_hash); |
1775 } | 1775 } |
1776 | 1776 |
1777 static void yahoo_process_auth(GaimConnection *gc, struct yahoo_packet *pkt) | 1777 static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) |
1778 { | 1778 { |
1779 char *seed = NULL; | 1779 char *seed = NULL; |
1780 char *sn = NULL; | 1780 char *sn = NULL; |
1781 GSList *l = pkt->hash; | 1781 GSList *l = pkt->hash; |
1782 int m = 0; | 1782 int m = 0; |
1803 yahoo_process_auth_new(gc, seed); | 1803 yahoo_process_auth_new(gc, seed); |
1804 break; | 1804 break; |
1805 default: | 1805 default: |
1806 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " | 1806 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " |
1807 "authentication method. You will probably not be able " | 1807 "authentication method. You will probably not be able " |
1808 "to successfully sign on to Yahoo. Check %s for updates."), GAIM_WEBSITE); | 1808 "to successfully sign on to Yahoo. Check %s for updates."), PURPLE_WEBSITE); |
1809 gaim_notify_error(gc, "", _("Failed Yahoo! Authentication"), | 1809 purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), |
1810 buf); | 1810 buf); |
1811 g_free(buf); | 1811 g_free(buf); |
1812 yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */ | 1812 yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */ |
1813 } | 1813 } |
1814 } | 1814 } |
1815 } | 1815 } |
1816 | 1816 |
1817 static void ignore_buddy(GaimBuddy *buddy) { | 1817 static void ignore_buddy(PurpleBuddy *buddy) { |
1818 GaimGroup *group; | 1818 PurpleGroup *group; |
1819 GaimAccount *account; | 1819 PurpleAccount *account; |
1820 gchar *name; | 1820 gchar *name; |
1821 | 1821 |
1822 if (!buddy) | 1822 if (!buddy) |
1823 return; | 1823 return; |
1824 | 1824 |
1825 group = gaim_buddy_get_group(buddy); | 1825 group = purple_buddy_get_group(buddy); |
1826 name = g_strdup(buddy->name); | 1826 name = g_strdup(buddy->name); |
1827 account = buddy->account; | 1827 account = buddy->account; |
1828 | 1828 |
1829 gaim_debug(GAIM_DEBUG_INFO, "blist", | 1829 purple_debug(PURPLE_DEBUG_INFO, "blist", |
1830 "Removing '%s' from buddy list.\n", buddy->name); | 1830 "Removing '%s' from buddy list.\n", buddy->name); |
1831 gaim_account_remove_buddy(account, buddy, group); | 1831 purple_account_remove_buddy(account, buddy, group); |
1832 gaim_blist_remove_buddy(buddy); | 1832 purple_blist_remove_buddy(buddy); |
1833 | 1833 |
1834 serv_add_deny(account->gc, name); | 1834 serv_add_deny(account->gc, name); |
1835 | 1835 |
1836 g_free(name); | 1836 g_free(name); |
1837 } | 1837 } |
1838 | 1838 |
1839 static void keep_buddy(GaimBuddy *b) { | 1839 static void keep_buddy(PurpleBuddy *b) { |
1840 gaim_privacy_deny_remove(b->account, b->name, 1); | 1840 purple_privacy_deny_remove(b->account, b->name, 1); |
1841 } | 1841 } |
1842 | 1842 |
1843 static void yahoo_process_ignore(GaimConnection *gc, struct yahoo_packet *pkt) { | 1843 static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { |
1844 GaimBuddy *b; | 1844 PurpleBuddy *b; |
1845 GSList *l; | 1845 GSList *l; |
1846 gchar *who = NULL; | 1846 gchar *who = NULL; |
1847 gchar *sn = NULL; | 1847 gchar *sn = NULL; |
1848 gchar buf[BUF_LONG]; | 1848 gchar buf[BUF_LONG]; |
1849 gint ignore = 0; | 1849 gint ignore = 0; |
1869 } | 1869 } |
1870 } | 1870 } |
1871 | 1871 |
1872 switch (status) { | 1872 switch (status) { |
1873 case 12: | 1873 case 12: |
1874 b = gaim_find_buddy(gc->account, who); | 1874 b = purple_find_buddy(gc->account, who); |
1875 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " | 1875 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " |
1876 "user is on your buddy list. Clicking \"Yes\" " | 1876 "user is on your buddy list. Clicking \"Yes\" " |
1877 "will remove and ignore the buddy."), who); | 1877 "will remove and ignore the buddy."), who); |
1878 gaim_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, b, | 1878 purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, b, |
1879 G_CALLBACK(ignore_buddy), | 1879 G_CALLBACK(ignore_buddy), |
1880 G_CALLBACK(keep_buddy)); | 1880 G_CALLBACK(keep_buddy)); |
1881 break; | 1881 break; |
1882 case 2: | 1882 case 2: |
1883 case 3: | 1883 case 3: |
1885 default: | 1885 default: |
1886 break; | 1886 break; |
1887 } | 1887 } |
1888 } | 1888 } |
1889 | 1889 |
1890 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt) | 1890 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
1891 { | 1891 { |
1892 #ifdef TRY_WEBMESSENGER_LOGIN | 1892 #ifdef TRY_WEBMESSENGER_LOGIN |
1893 struct yahoo_data *yd = gc->proto_data; | 1893 struct yahoo_data *yd = gc->proto_data; |
1894 #endif | 1894 #endif |
1895 GSList *l = pkt->hash; | 1895 GSList *l = pkt->hash; |
1914 msg = g_strdup(_("Invalid screen name.")); | 1914 msg = g_strdup(_("Invalid screen name.")); |
1915 break; | 1915 break; |
1916 case 13: | 1916 case 13: |
1917 #ifdef TRY_WEBMESSENGER_LOGIN | 1917 #ifdef TRY_WEBMESSENGER_LOGIN |
1918 if (!yd->wm) { | 1918 if (!yd->wm) { |
1919 GaimUtilFetchUrlData *url_data; | 1919 PurpleUtilFetchUrlData *url_data; |
1920 yd->wm = TRUE; | 1920 yd->wm = TRUE; |
1921 if (yd->fd >= 0) | 1921 if (yd->fd >= 0) |
1922 close(yd->fd); | 1922 close(yd->fd); |
1923 if (gc->inpa) | 1923 if (gc->inpa) |
1924 gaim_input_remove(gc->inpa); | 1924 purple_input_remove(gc->inpa); |
1925 url_data = gaim_util_fetch_url(WEBMESSENGER_URL, TRUE, | 1925 url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, |
1926 "Gaim/" VERSION, FALSE, yahoo_login_page_cb, gc); | 1926 "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); |
1927 if (url_data != NULL) | 1927 if (url_data != NULL) |
1928 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); | 1928 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
1929 return; | 1929 return; |
1930 } | 1930 } |
1931 #endif | 1931 #endif |
1942 fullmsg = g_strdup_printf("%s\n%s", msg, url); | 1942 fullmsg = g_strdup_printf("%s\n%s", msg, url); |
1943 else | 1943 else |
1944 fullmsg = g_strdup(msg); | 1944 fullmsg = g_strdup(msg); |
1945 | 1945 |
1946 gc->wants_to_die = TRUE; | 1946 gc->wants_to_die = TRUE; |
1947 gaim_connection_error(gc, fullmsg); | 1947 purple_connection_error(gc, fullmsg); |
1948 g_free(msg); | 1948 g_free(msg); |
1949 g_free(fullmsg); | 1949 g_free(fullmsg); |
1950 } | 1950 } |
1951 | 1951 |
1952 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt) | 1952 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) |
1953 { | 1953 { |
1954 int err = 0; | 1954 int err = 0; |
1955 char *who = NULL; | 1955 char *who = NULL; |
1956 char *group = NULL; | 1956 char *group = NULL; |
1957 char *decoded_group; | 1957 char *decoded_group; |
1988 return; | 1988 return; |
1989 } | 1989 } |
1990 | 1990 |
1991 decoded_group = yahoo_string_decode(gc, group, FALSE); | 1991 decoded_group = yahoo_string_decode(gc, group, FALSE); |
1992 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."), | 1992 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."), |
1993 who, decoded_group, gaim_connection_get_display_name(gc)); | 1993 who, decoded_group, purple_connection_get_display_name(gc)); |
1994 if (!gaim_conv_present_error(who, gaim_connection_get_account(gc), buf)) | 1994 if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) |
1995 gaim_notify_error(gc, NULL, _("Could not add buddy to server list"), buf); | 1995 purple_notify_error(gc, NULL, _("Could not add buddy to server list"), buf); |
1996 g_free(buf); | 1996 g_free(buf); |
1997 g_free(decoded_group); | 1997 g_free(decoded_group); |
1998 } | 1998 } |
1999 | 1999 |
2000 static void yahoo_process_p2p(GaimConnection *gc, struct yahoo_packet *pkt) | 2000 static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) |
2001 { | 2001 { |
2002 GSList *l = pkt->hash; | 2002 GSList *l = pkt->hash; |
2003 char *who = NULL; | 2003 char *who = NULL; |
2004 char *base64 = NULL; | 2004 char *base64 = NULL; |
2005 guchar *decoded; | 2005 guchar *decoded; |
2041 if (base64) { | 2041 if (base64) { |
2042 guint32 ip; | 2042 guint32 ip; |
2043 char *tmp2; | 2043 char *tmp2; |
2044 YahooFriend *f; | 2044 YahooFriend *f; |
2045 | 2045 |
2046 decoded = gaim_base64_decode(base64, &len); | 2046 decoded = purple_base64_decode(base64, &len); |
2047 if (len) { | 2047 if (len) { |
2048 char *tmp = gaim_str_binary_to_ascii(decoded, len); | 2048 char *tmp = purple_str_binary_to_ascii(decoded, len); |
2049 gaim_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); | 2049 purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); |
2050 g_free(tmp); | 2050 g_free(tmp); |
2051 } | 2051 } |
2052 | 2052 |
2053 tmp2 = g_strndup((const gchar *)decoded, len); /* so its \0 terminated...*/ | 2053 tmp2 = g_strndup((const gchar *)decoded, len); /* so its \0 terminated...*/ |
2054 ip = strtol(tmp2, NULL, 10); | 2054 ip = strtol(tmp2, NULL, 10); |
2061 yahoo_friend_set_ip(f, tmp2); | 2061 yahoo_friend_set_ip(f, tmp2); |
2062 g_free(tmp2); | 2062 g_free(tmp2); |
2063 } | 2063 } |
2064 } | 2064 } |
2065 | 2065 |
2066 static void yahoo_process_audible(GaimConnection *gc, struct yahoo_packet *pkt) | 2066 static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) |
2067 { | 2067 { |
2068 char *who = NULL, *msg = NULL, *id = NULL; | 2068 char *who = NULL, *msg = NULL, *id = NULL; |
2069 GSList *l = pkt->hash; | 2069 GSList *l = pkt->hash; |
2070 | 2070 |
2071 while (l) { | 2071 while (l) { |
2098 if (!msg) | 2098 if (!msg) |
2099 msg = id; | 2099 msg = id; |
2100 if (!who || !msg) | 2100 if (!who || !msg) |
2101 return; | 2101 return; |
2102 if (!g_utf8_validate(msg, -1, NULL)) { | 2102 if (!g_utf8_validate(msg, -1, NULL)) { |
2103 gaim_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); | 2103 purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); |
2104 return; | 2104 return; |
2105 } | 2105 } |
2106 if (!yahoo_privacy_check(gc, who)) { | 2106 if (!yahoo_privacy_check(gc, who)) { |
2107 gaim_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", | 2107 purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", |
2108 gc->account->username, who); | 2108 gc->account->username, who); |
2109 return; | 2109 return; |
2110 } | 2110 } |
2111 if (id) { | 2111 if (id) { |
2112 /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ | 2112 /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ |
2118 g_free(buf); | 2118 g_free(buf); |
2119 } else | 2119 } else |
2120 serv_got_im(gc, who, msg, 0, time(NULL)); | 2120 serv_got_im(gc, who, msg, 0, time(NULL)); |
2121 } | 2121 } |
2122 | 2122 |
2123 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt) | 2123 static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) |
2124 { | 2124 { |
2125 switch (pkt->service) { | 2125 switch (pkt->service) { |
2126 case YAHOO_SERVICE_LOGON: | 2126 case YAHOO_SERVICE_LOGON: |
2127 case YAHOO_SERVICE_LOGOFF: | 2127 case YAHOO_SERVICE_LOGOFF: |
2128 case YAHOO_SERVICE_ISAWAY: | 2128 case YAHOO_SERVICE_ISAWAY: |
2239 break; | 2239 break; |
2240 case YAHOO_SERVICE_AUDIBLE: | 2240 case YAHOO_SERVICE_AUDIBLE: |
2241 yahoo_process_audible(gc, pkt); | 2241 yahoo_process_audible(gc, pkt); |
2242 break; | 2242 break; |
2243 default: | 2243 default: |
2244 gaim_debug(GAIM_DEBUG_ERROR, "yahoo", | 2244 purple_debug(PURPLE_DEBUG_ERROR, "yahoo", |
2245 "Unhandled service 0x%02x\n", pkt->service); | 2245 "Unhandled service 0x%02x\n", pkt->service); |
2246 break; | 2246 break; |
2247 } | 2247 } |
2248 } | 2248 } |
2249 | 2249 |
2250 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond) | 2250 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
2251 { | 2251 { |
2252 GaimConnection *gc = data; | 2252 PurpleConnection *gc = data; |
2253 struct yahoo_data *yd = gc->proto_data; | 2253 struct yahoo_data *yd = gc->proto_data; |
2254 char buf[1024]; | 2254 char buf[1024]; |
2255 int len; | 2255 int len; |
2256 | 2256 |
2257 len = read(yd->fd, buf, sizeof(buf)); | 2257 len = read(yd->fd, buf, sizeof(buf)); |
2263 /* No worries */ | 2263 /* No worries */ |
2264 return; | 2264 return; |
2265 | 2265 |
2266 tmp = g_strdup_printf(_("Lost connection with server:\n%s"), | 2266 tmp = g_strdup_printf(_("Lost connection with server:\n%s"), |
2267 strerror(errno)); | 2267 strerror(errno)); |
2268 gaim_connection_error(gc, tmp); | 2268 purple_connection_error(gc, tmp); |
2269 g_free(tmp); | 2269 g_free(tmp); |
2270 return; | 2270 return; |
2271 } else if (len == 0) { | 2271 } else if (len == 0) { |
2272 gaim_connection_error(gc, _("Server closed the connection.")); | 2272 purple_connection_error(gc, _("Server closed the connection.")); |
2273 return; | 2273 return; |
2274 } | 2274 } |
2275 | 2275 |
2276 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); | 2276 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); |
2277 memcpy(yd->rxqueue + yd->rxlen, buf, len); | 2277 memcpy(yd->rxqueue + yd->rxlen, buf, len); |
2288 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { | 2288 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { |
2289 /* HEY! This isn't even a YMSG packet. What | 2289 /* HEY! This isn't even a YMSG packet. What |
2290 * are you trying to pull? */ | 2290 * are you trying to pull? */ |
2291 guchar *start; | 2291 guchar *start; |
2292 | 2292 |
2293 gaim_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!"); | 2293 purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!"); |
2294 | 2294 |
2295 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); | 2295 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); |
2296 if (start) { | 2296 if (start) { |
2297 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); | 2297 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); |
2298 yd->rxlen -= start - yd->rxqueue; | 2298 yd->rxlen -= start - yd->rxqueue; |
2308 pos += 4; /* YMSG */ | 2308 pos += 4; /* YMSG */ |
2309 pos += 2; | 2309 pos += 2; |
2310 pos += 2; | 2310 pos += 2; |
2311 | 2311 |
2312 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; | 2312 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; |
2313 gaim_debug(GAIM_DEBUG_MISC, "yahoo", | 2313 purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
2314 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); | 2314 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
2315 | 2315 |
2316 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) | 2316 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) |
2317 return; | 2317 return; |
2318 | 2318 |
2320 | 2320 |
2321 pkt = yahoo_packet_new(0, 0, 0); | 2321 pkt = yahoo_packet_new(0, 0, 0); |
2322 | 2322 |
2323 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; | 2323 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; |
2324 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; | 2324 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
2325 gaim_debug(GAIM_DEBUG_MISC, "yahoo", | 2325 purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
2326 "Yahoo Service: 0x%02x Status: %d\n", | 2326 "Yahoo Service: 0x%02x Status: %d\n", |
2327 pkt->service, pkt->status); | 2327 pkt->service, pkt->status); |
2328 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; | 2328 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
2329 | 2329 |
2330 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); | 2330 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); |
2345 } | 2345 } |
2346 } | 2346 } |
2347 | 2347 |
2348 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) | 2348 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
2349 { | 2349 { |
2350 GaimConnection *gc = data; | 2350 PurpleConnection *gc = data; |
2351 struct yahoo_data *yd; | 2351 struct yahoo_data *yd; |
2352 struct yahoo_packet *pkt; | 2352 struct yahoo_packet *pkt; |
2353 | 2353 |
2354 if (!GAIM_CONNECTION_IS_VALID(gc)) { | 2354 if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
2355 close(source); | 2355 close(source); |
2356 return; | 2356 return; |
2357 } | 2357 } |
2358 | 2358 |
2359 if (source < 0) { | 2359 if (source < 0) { |
2360 gaim_connection_error(gc, _("Unable to connect.")); | 2360 purple_connection_error(gc, _("Unable to connect.")); |
2361 return; | 2361 return; |
2362 } | 2362 } |
2363 | 2363 |
2364 yd = gc->proto_data; | 2364 yd = gc->proto_data; |
2365 yd->fd = source; | 2365 yd->fd = source; |
2366 | 2366 |
2367 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0); | 2367 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0); |
2368 | 2368 |
2369 yahoo_packet_hash_str(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); | 2369 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); |
2370 yahoo_packet_send_and_free(pkt, yd); | 2370 yahoo_packet_send_and_free(pkt, yd); |
2371 | 2371 |
2372 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | 2372 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
2373 } | 2373 } |
2374 | 2374 |
2375 #ifdef TRY_WEBMESSENGER_LOGIN | 2375 #ifdef TRY_WEBMESSENGER_LOGIN |
2376 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) | 2376 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
2377 { | 2377 { |
2378 GaimConnection *gc = data; | 2378 PurpleConnection *gc = data; |
2379 struct yahoo_data *yd; | 2379 struct yahoo_data *yd; |
2380 struct yahoo_packet *pkt; | 2380 struct yahoo_packet *pkt; |
2381 | 2381 |
2382 if (!GAIM_CONNECTION_IS_VALID(gc)) { | 2382 if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
2383 close(source); | 2383 close(source); |
2384 return; | 2384 return; |
2385 } | 2385 } |
2386 | 2386 |
2387 if (source < 0) { | 2387 if (source < 0) { |
2388 gaim_connection_error(gc, _("Unable to connect.")); | 2388 purple_connection_error(gc, _("Unable to connect.")); |
2389 return; | 2389 return; |
2390 } | 2390 } |
2391 | 2391 |
2392 yd = gc->proto_data; | 2392 yd = gc->proto_data; |
2393 yd->fd = source; | 2393 yd->fd = source; |
2394 | 2394 |
2395 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); | 2395 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); |
2396 | 2396 |
2397 yahoo_packet_hash(pkt, "sss", 0, | 2397 yahoo_packet_hash(pkt, "sss", 0, |
2398 gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))), | 2398 purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
2399 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))), | 2399 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
2400 6, yd->auth); | 2400 6, yd->auth); |
2401 yahoo_packet_send_and_free(pkt, yd); | 2401 yahoo_packet_send_and_free(pkt, yd); |
2402 | 2402 |
2403 g_free(yd->auth); | 2403 g_free(yd->auth); |
2404 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | 2404 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
2405 } | 2405 } |
2406 | 2406 |
2407 static void yahoo_web_pending(gpointer data, gint source, GaimInputCondition cond) | 2407 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
2408 { | 2408 { |
2409 GaimConnection *gc = data; | 2409 PurpleConnection *gc = data; |
2410 GaimAccount *account = gaim_connection_get_account(gc); | 2410 PurpleAccount *account = purple_connection_get_account(gc); |
2411 struct yahoo_data *yd = gc->proto_data; | 2411 struct yahoo_data *yd = gc->proto_data; |
2412 char bufread[2048], *i = bufread, *buf = bufread; | 2412 char bufread[2048], *i = bufread, *buf = bufread; |
2413 int len; | 2413 int len; |
2414 GString *s; | 2414 GString *s; |
2415 | 2415 |
2422 /* No worries */ | 2422 /* No worries */ |
2423 return; | 2423 return; |
2424 | 2424 |
2425 tmp = g_strdup_printf(_("Lost connection with server:\n%s"), | 2425 tmp = g_strdup_printf(_("Lost connection with server:\n%s"), |
2426 strerror(errno)); | 2426 strerror(errno)); |
2427 gaim_connection_error(gc, tmp); | 2427 purple_connection_error(gc, tmp); |
2428 g_free(tmp); | 2428 g_free(tmp); |
2429 return; | 2429 return; |
2430 } else if (len == 0) { | 2430 } else if (len == 0) { |
2431 gaim_connection_error(gc, _("Server closed the connection.")); | 2431 purple_connection_error(gc, _("Server closed the connection.")); |
2432 return; | 2432 return; |
2433 } | 2433 } |
2434 | 2434 |
2435 if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { | 2435 if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { |
2436 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); | 2436 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); |
2441 } | 2441 } |
2442 buf[len] = '\0'; | 2442 buf[len] = '\0'; |
2443 | 2443 |
2444 if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && | 2444 if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && |
2445 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { | 2445 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { |
2446 gaim_connection_error(gc, _("Received unexpected HTTP response from server.")); | 2446 purple_connection_error(gc, _("Received unexpected HTTP response from server.")); |
2447 return; | 2447 return; |
2448 } | 2448 } |
2449 | 2449 |
2450 s = g_string_sized_new(len); | 2450 s = g_string_sized_new(len); |
2451 | 2451 |
2456 | 2456 |
2457 g_string_append(s, "; "); | 2457 g_string_append(s, "; "); |
2458 } | 2458 } |
2459 | 2459 |
2460 yd->auth = g_string_free(s, FALSE); | 2460 yd->auth = g_string_free(s, FALSE); |
2461 gaim_input_remove(gc->inpa); | 2461 purple_input_remove(gc->inpa); |
2462 close(source); | 2462 close(source); |
2463 g_free(yd->rxqueue); | 2463 g_free(yd->rxqueue); |
2464 yd->rxqueue = NULL; | 2464 yd->rxqueue = NULL; |
2465 yd->rxlen = 0; | 2465 yd->rxlen = 0; |
2466 /* Now we have our cookies to login with. I'll go get the milk. */ | 2466 /* Now we have our cookies to login with. I'll go get the milk. */ |
2467 if (gaim_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", | 2467 if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", |
2468 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), | 2468 purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
2469 yahoo_got_web_connected, gc) == NULL) { | 2469 yahoo_got_web_connected, gc) == NULL) { |
2470 gaim_connection_error(gc, _("Connection problem")); | 2470 purple_connection_error(gc, _("Connection problem")); |
2471 return; | 2471 return; |
2472 } | 2472 } |
2473 } | 2473 } |
2474 | 2474 |
2475 static void yahoo_got_cookies_send_cb(gpointer data, gint source, GaimInputCondition cond) | 2475 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
2476 { | 2476 { |
2477 GaimConnection *gc; | 2477 PurpleConnection *gc; |
2478 struct yahoo_data *yd; | 2478 struct yahoo_data *yd; |
2479 int written, remaining; | 2479 int written, remaining; |
2480 | 2480 |
2481 gc = data; | 2481 gc = data; |
2482 yd = gc->proto_data; | 2482 yd = gc->proto_data; |
2488 written = 0; | 2488 written = 0; |
2489 else if (written <= 0) { | 2489 else if (written <= 0) { |
2490 g_free(yd->auth); | 2490 g_free(yd->auth); |
2491 yd->auth = NULL; | 2491 yd->auth = NULL; |
2492 if (gc->inpa) | 2492 if (gc->inpa) |
2493 gaim_input_remove(gc->inpa); | 2493 purple_input_remove(gc->inpa); |
2494 gc->inpa = 0; | 2494 gc->inpa = 0; |
2495 gaim_connection_error(gc, _("Unable to connect.")); | 2495 purple_connection_error(gc, _("Unable to connect.")); |
2496 return; | 2496 return; |
2497 } | 2497 } |
2498 | 2498 |
2499 if (written < remaining) { | 2499 if (written < remaining) { |
2500 yd->auth_written += written; | 2500 yd->auth_written += written; |
2502 } | 2502 } |
2503 | 2503 |
2504 g_free(yd->auth); | 2504 g_free(yd->auth); |
2505 yd->auth = NULL; | 2505 yd->auth = NULL; |
2506 yd->auth_written = 0; | 2506 yd->auth_written = 0; |
2507 gaim_input_remove(gc->inpa); | 2507 purple_input_remove(gc->inpa); |
2508 gc->inpa = gaim_input_add(source, GAIM_INPUT_READ, yahoo_web_pending, gc); | 2508 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); |
2509 } | 2509 } |
2510 | 2510 |
2511 static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) | 2511 static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) |
2512 { | 2512 { |
2513 GaimConnection *gc = data; | 2513 PurpleConnection *gc = data; |
2514 | 2514 |
2515 if (source < 0) { | 2515 if (source < 0) { |
2516 gaim_connection_error(gc, _("Unable to connect.")); | 2516 purple_connection_error(gc, _("Unable to connect.")); |
2517 return; | 2517 return; |
2518 } | 2518 } |
2519 | 2519 |
2520 if (gc->inpa == 0) | 2520 if (gc->inpa == 0) |
2521 { | 2521 { |
2522 gc->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, | 2522 gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, |
2523 yahoo_got_cookies_send_cb, gc); | 2523 yahoo_got_cookies_send_cb, gc); |
2524 yahoo_got_cookies_send_cb(gc, source, GAIM_INPUT_WRITE); | 2524 yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); |
2525 } | 2525 } |
2526 } | 2526 } |
2527 | 2527 |
2528 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) | 2528 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) |
2529 { | 2529 { |
2535 if (!strcmp(key, ".save") || !strcmp(key, ".js")) | 2535 if (!strcmp(key, ".save") || !strcmp(key, ".js")) |
2536 g_string_append_c(url, '1'); | 2536 g_string_append_c(url, '1'); |
2537 else if (!strcmp(key, ".challenge")) | 2537 else if (!strcmp(key, ".challenge")) |
2538 g_string_append(url, val); | 2538 g_string_append(url, val); |
2539 else | 2539 else |
2540 g_string_append(url, gaim_url_encode(val)); | 2540 g_string_append(url, purple_url_encode(val)); |
2541 } | 2541 } |
2542 | 2542 |
2543 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) | 2543 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) |
2544 { | 2544 { |
2545 GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 2545 GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
2574 } | 2574 } |
2575 return hash; | 2575 return hash; |
2576 } | 2576 } |
2577 | 2577 |
2578 static void | 2578 static void |
2579 yahoo_login_page_cb(GaimUtilFetchUrlData *url_data, gpointer user_data, | 2579 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
2580 const gchar *url_text, size_t len, const gchar *error_message) | 2580 const gchar *url_text, size_t len, const gchar *error_message) |
2581 { | 2581 { |
2582 GaimConnection *gc = (GaimConnection *)user_data; | 2582 PurpleConnection *gc = (PurpleConnection *)user_data; |
2583 GaimAccount *account = gaim_connection_get_account(gc); | 2583 PurpleAccount *account = purple_connection_get_account(gc); |
2584 struct yahoo_data *yd = gc->proto_data; | 2584 struct yahoo_data *yd = gc->proto_data; |
2585 const char *sn = gaim_account_get_username(account); | 2585 const char *sn = purple_account_get_username(account); |
2586 const char *pass = gaim_connection_get_password(gc); | 2586 const char *pass = purple_connection_get_password(gc); |
2587 GHashTable *hash = yahoo_login_page_hash(url_text, len); | 2587 GHashTable *hash = yahoo_login_page_hash(url_text, len); |
2588 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); | 2588 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
2589 char md5[33], *hashp = md5, *chal; | 2589 char md5[33], *hashp = md5, *chal; |
2590 int i; | 2590 int i; |
2591 GaimCipher *cipher; | 2591 PurpleCipher *cipher; |
2592 GaimCipherContext *context; | 2592 PurpleCipherContext *context; |
2593 guchar digest[16]; | 2593 guchar digest[16]; |
2594 | 2594 |
2595 yd->url_datas = g_slist_remove(yd->url_datas, url_data); | 2595 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
2596 | 2596 |
2597 if (error_message != NULL) | 2597 if (error_message != NULL) |
2598 { | 2598 { |
2599 /* TODO: Include error_message in the message below */ | 2599 /* TODO: Include error_message in the message below */ |
2600 gaim_connection_error(gc, _("Unable to connect.")); | 2600 purple_connection_error(gc, _("Unable to connect.")); |
2601 return; | 2601 return; |
2602 } | 2602 } |
2603 | 2603 |
2604 url = g_string_append(url, sn); | 2604 url = g_string_append(url, sn); |
2605 url = g_string_append(url, "&passwd="); | 2605 url = g_string_append(url, "&passwd="); |
2606 | 2606 |
2607 cipher = gaim_ciphers_find_cipher("md5"); | 2607 cipher = purple_ciphers_find_cipher("md5"); |
2608 context = gaim_cipher_context_new(cipher, NULL); | 2608 context = purple_cipher_context_new(cipher, NULL); |
2609 | 2609 |
2610 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass)); | 2610 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); |
2611 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 2611 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
2612 for (i = 0; i < 16; ++i) { | 2612 for (i = 0; i < 16; ++i) { |
2613 g_snprintf(hashp, 3, "%02x", digest[i]); | 2613 g_snprintf(hashp, 3, "%02x", digest[i]); |
2614 hashp += 2; | 2614 hashp += 2; |
2615 } | 2615 } |
2616 | 2616 |
2617 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); | 2617 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); |
2618 gaim_cipher_context_reset(context, NULL); | 2618 purple_cipher_context_reset(context, NULL); |
2619 gaim_cipher_context_append(context, (const guchar *)chal, strlen(chal)); | 2619 purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); |
2620 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 2620 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
2621 hashp = md5; | 2621 hashp = md5; |
2622 for (i = 0; i < 16; ++i) { | 2622 for (i = 0; i < 16; ++i) { |
2623 g_snprintf(hashp, 3, "%02x", digest[i]); | 2623 g_snprintf(hashp, 3, "%02x", digest[i]); |
2624 hashp += 2; | 2624 hashp += 2; |
2625 } | 2625 } |
2626 /* | 2626 /* |
2627 * I dunno why this is here and commented out.. but in case it's needed | 2627 * I dunno why this is here and commented out.. but in case it's needed |
2628 * I updated it.. | 2628 * I updated it.. |
2629 | 2629 |
2630 gaim_cipher_context_reset(context, NULL); | 2630 purple_cipher_context_reset(context, NULL); |
2631 gaim_cipher_context_append(context, md5, strlen(md5)); | 2631 purple_cipher_context_append(context, md5, strlen(md5)); |
2632 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL); | 2632 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
2633 hashp = md5; | 2633 hashp = md5; |
2634 for (i = 0; i < 16; ++i) { | 2634 for (i = 0; i < 16; ++i) { |
2635 g_snprintf(hashp, 3, "%02x", digest[i]); | 2635 g_snprintf(hashp, 3, "%02x", digest[i]); |
2636 hashp += 2; | 2636 hashp += 2; |
2637 } | 2637 } |
2643 | 2643 |
2644 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" | 2644 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" |
2645 "Host: login.yahoo.com\r\n\r\n"); | 2645 "Host: login.yahoo.com\r\n\r\n"); |
2646 g_hash_table_destroy(hash); | 2646 g_hash_table_destroy(hash); |
2647 yd->auth = g_string_free(url, FALSE); | 2647 yd->auth = g_string_free(url, FALSE); |
2648 if (gaim_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { | 2648 if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { |
2649 gaim_connection_error(gc, _("Connection problem")); | 2649 purple_connection_error(gc, _("Connection problem")); |
2650 return; | 2650 return; |
2651 } | 2651 } |
2652 | 2652 |
2653 gaim_cipher_context_destroy(context); | 2653 purple_cipher_context_destroy(context); |
2654 } | 2654 } |
2655 #endif | 2655 #endif |
2656 | 2656 |
2657 static void yahoo_server_check(GaimAccount *account) | 2657 static void yahoo_server_check(PurpleAccount *account) |
2658 { | 2658 { |
2659 const char *server; | 2659 const char *server; |
2660 | 2660 |
2661 server = gaim_account_get_string(account, "server", YAHOO_PAGER_HOST); | 2661 server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST); |
2662 | 2662 |
2663 if (strcmp(server, "scs.yahoo.com") == 0) | 2663 if (strcmp(server, "scs.yahoo.com") == 0) |
2664 gaim_account_set_string(account, "server", YAHOO_PAGER_HOST); | 2664 purple_account_set_string(account, "server", YAHOO_PAGER_HOST); |
2665 } | 2665 } |
2666 | 2666 |
2667 static void yahoo_picture_check(GaimAccount *account) | 2667 static void yahoo_picture_check(PurpleAccount *account) |
2668 { | 2668 { |
2669 GaimConnection *gc = gaim_account_get_connection(account); | 2669 PurpleConnection *gc = purple_account_get_connection(account); |
2670 char *buddyicon; | 2670 char *buddyicon; |
2671 | 2671 |
2672 buddyicon = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account)); | 2672 buddyicon = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account)); |
2673 yahoo_set_buddy_icon(gc, buddyicon); | 2673 yahoo_set_buddy_icon(gc, buddyicon); |
2674 g_free(buddyicon); | 2674 g_free(buddyicon); |
2675 } | 2675 } |
2676 | 2676 |
2677 static int get_yahoo_status_from_gaim_status(GaimStatus *status) | 2677 static int get_yahoo_status_from_purple_status(PurpleStatus *status) |
2678 { | 2678 { |
2679 GaimPresence *presence; | 2679 PurplePresence *presence; |
2680 const char *status_id; | 2680 const char *status_id; |
2681 const char *msg; | 2681 const char *msg; |
2682 | 2682 |
2683 presence = gaim_status_get_presence(status); | 2683 presence = purple_status_get_presence(status); |
2684 status_id = gaim_status_get_id(status); | 2684 status_id = purple_status_get_id(status); |
2685 msg = gaim_status_get_attr_string(status, "message"); | 2685 msg = purple_status_get_attr_string(status, "message"); |
2686 | 2686 |
2687 if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { | 2687 if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { |
2688 if ((msg != NULL) && (*msg != '\0')) | 2688 if ((msg != NULL) && (*msg != '\0')) |
2689 return YAHOO_STATUS_CUSTOM; | 2689 return YAHOO_STATUS_CUSTOM; |
2690 else | 2690 else |
2709 return YAHOO_STATUS_STEPPEDOUT; | 2709 return YAHOO_STATUS_STEPPEDOUT; |
2710 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { | 2710 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { |
2711 return YAHOO_STATUS_INVISIBLE; | 2711 return YAHOO_STATUS_INVISIBLE; |
2712 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { | 2712 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { |
2713 return YAHOO_STATUS_CUSTOM; | 2713 return YAHOO_STATUS_CUSTOM; |
2714 } else if (gaim_presence_is_idle(presence)) { | 2714 } else if (purple_presence_is_idle(presence)) { |
2715 return YAHOO_STATUS_IDLE; | 2715 return YAHOO_STATUS_IDLE; |
2716 } else { | 2716 } else { |
2717 gaim_debug_error("yahoo", "Unexpected GaimStatus!\n"); | 2717 purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); |
2718 return YAHOO_STATUS_AVAILABLE; | 2718 return YAHOO_STATUS_AVAILABLE; |
2719 } | 2719 } |
2720 } | 2720 } |
2721 | 2721 |
2722 static void yahoo_login(GaimAccount *account) { | 2722 static void yahoo_login(PurpleAccount *account) { |
2723 GaimConnection *gc = gaim_account_get_connection(account); | 2723 PurpleConnection *gc = purple_account_get_connection(account); |
2724 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); | 2724 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
2725 GaimStatus *status = gaim_account_get_active_status(account); | 2725 PurpleStatus *status = purple_account_get_active_status(account); |
2726 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_URLDESC; | 2726 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; |
2727 | 2727 |
2728 gaim_connection_update_progress(gc, _("Connecting"), 1, 2); | 2728 purple_connection_update_progress(gc, _("Connecting"), 1, 2); |
2729 | 2729 |
2730 gaim_connection_set_display_name(gc, gaim_account_get_username(account)); | 2730 purple_connection_set_display_name(gc, purple_account_get_username(account)); |
2731 | 2731 |
2732 yd->fd = -1; | 2732 yd->fd = -1; |
2733 yd->txhandler = -1; | 2733 yd->txhandler = -1; |
2734 /* TODO: Is there a good grow size for the buffer? */ | 2734 /* TODO: Is there a good grow size for the buffer? */ |
2735 yd->txbuf = gaim_circ_buffer_new(0); | 2735 yd->txbuf = purple_circ_buffer_new(0); |
2736 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); | 2736 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); |
2737 yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 2737 yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
2738 yd->confs = NULL; | 2738 yd->confs = NULL; |
2739 yd->conf_id = 2; | 2739 yd->conf_id = 2; |
2740 | 2740 |
2741 yd->current_status = get_yahoo_status_from_gaim_status(status); | 2741 yd->current_status = get_yahoo_status_from_purple_status(status); |
2742 | 2742 |
2743 yahoo_server_check(account); | 2743 yahoo_server_check(account); |
2744 yahoo_picture_check(account); | 2744 yahoo_picture_check(account); |
2745 | 2745 |
2746 if (gaim_account_get_bool(account, "yahoojp", FALSE)) { | 2746 if (purple_account_get_bool(account, "yahoojp", FALSE)) { |
2747 yd->jp = TRUE; | 2747 yd->jp = TRUE; |
2748 if (gaim_proxy_connect(gc, account, | 2748 if (purple_proxy_connect(gc, account, |
2749 gaim_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST), | 2749 purple_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST), |
2750 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), | 2750 purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
2751 yahoo_got_connected, gc) == NULL) | 2751 yahoo_got_connected, gc) == NULL) |
2752 { | 2752 { |
2753 gaim_connection_error(gc, _("Connection problem")); | 2753 purple_connection_error(gc, _("Connection problem")); |
2754 return; | 2754 return; |
2755 } | 2755 } |
2756 } else { | 2756 } else { |
2757 yd->jp = FALSE; | 2757 yd->jp = FALSE; |
2758 if (gaim_proxy_connect(gc, account, | 2758 if (purple_proxy_connect(gc, account, |
2759 gaim_account_get_string(account, "server", YAHOO_PAGER_HOST), | 2759 purple_account_get_string(account, "server", YAHOO_PAGER_HOST), |
2760 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), | 2760 purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
2761 yahoo_got_connected, gc) == NULL) | 2761 yahoo_got_connected, gc) == NULL) |
2762 { | 2762 { |
2763 gaim_connection_error(gc, _("Connection problem")); | 2763 purple_connection_error(gc, _("Connection problem")); |
2764 return; | 2764 return; |
2765 } | 2765 } |
2766 } | 2766 } |
2767 } | 2767 } |
2768 | 2768 |
2769 static void yahoo_close(GaimConnection *gc) { | 2769 static void yahoo_close(PurpleConnection *gc) { |
2770 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 2770 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
2771 GSList *l; | 2771 GSList *l; |
2772 | 2772 |
2773 if (gc->inpa) | 2773 if (gc->inpa) |
2774 gaim_input_remove(gc->inpa); | 2774 purple_input_remove(gc->inpa); |
2775 | 2775 |
2776 while (yd->url_datas) { | 2776 while (yd->url_datas) { |
2777 gaim_util_fetch_url_cancel(yd->url_datas->data); | 2777 purple_util_fetch_url_cancel(yd->url_datas->data); |
2778 yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); | 2778 yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); |
2779 } | 2779 } |
2780 | 2780 |
2781 for (l = yd->confs; l; l = l->next) { | 2781 for (l = yd->confs; l; l = l->next) { |
2782 GaimConversation *conv = l->data; | 2782 PurpleConversation *conv = l->data; |
2783 | 2783 |
2784 yahoo_conf_leave(yd, gaim_conversation_get_name(conv), | 2784 yahoo_conf_leave(yd, purple_conversation_get_name(conv), |
2785 gaim_connection_get_display_name(gc), | 2785 purple_connection_get_display_name(gc), |
2786 gaim_conv_chat_get_users(GAIM_CONV_CHAT(conv))); | 2786 purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); |
2787 } | 2787 } |
2788 g_slist_free(yd->confs); | 2788 g_slist_free(yd->confs); |
2789 | 2789 |
2790 yd->chat_online = 0; | 2790 yd->chat_online = 0; |
2791 if (yd->in_chat) | 2791 if (yd->in_chat) |
2797 | 2797 |
2798 g_free(yd->cookie_y); | 2798 g_free(yd->cookie_y); |
2799 g_free(yd->cookie_t); | 2799 g_free(yd->cookie_t); |
2800 | 2800 |
2801 if (yd->txhandler) | 2801 if (yd->txhandler) |
2802 gaim_input_remove(yd->txhandler); | 2802 purple_input_remove(yd->txhandler); |
2803 | 2803 |
2804 gaim_circ_buffer_destroy(yd->txbuf); | 2804 purple_circ_buffer_destroy(yd->txbuf); |
2805 | 2805 |
2806 if (yd->fd >= 0) | 2806 if (yd->fd >= 0) |
2807 close(yd->fd); | 2807 close(yd->fd); |
2808 | 2808 |
2809 g_free(yd->rxqueue); | 2809 g_free(yd->rxqueue); |
2810 yd->rxlen = 0; | 2810 yd->rxlen = 0; |
2811 g_free(yd->picture_url); | 2811 g_free(yd->picture_url); |
2812 | 2812 |
2813 if (yd->buddy_icon_connect_data) | 2813 if (yd->buddy_icon_connect_data) |
2814 gaim_proxy_connect_cancel(yd->buddy_icon_connect_data); | 2814 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
2815 if (yd->picture_upload_todo) | 2815 if (yd->picture_upload_todo) |
2816 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); | 2816 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); |
2817 if (yd->ycht) | 2817 if (yd->ycht) |
2818 ycht_connection_close(yd->ycht); | 2818 ycht_connection_close(yd->ycht); |
2819 | 2819 |
2820 g_free(yd); | 2820 g_free(yd); |
2821 gc->proto_data = NULL; | 2821 gc->proto_data = NULL; |
2822 } | 2822 } |
2823 | 2823 |
2824 static const char *yahoo_list_icon(GaimAccount *a, GaimBuddy *b) | 2824 static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) |
2825 { | 2825 { |
2826 return "yahoo"; | 2826 return "yahoo"; |
2827 } | 2827 } |
2828 | 2828 |
2829 static const char *yahoo_list_emblem(GaimBuddy *b) | 2829 static const char *yahoo_list_emblem(PurpleBuddy *b) |
2830 { | 2830 { |
2831 GaimAccount *account; | 2831 PurpleAccount *account; |
2832 GaimConnection *gc; | 2832 PurpleConnection *gc; |
2833 struct yahoo_data *yd; | 2833 struct yahoo_data *yd; |
2834 YahooFriend *f; | 2834 YahooFriend *f; |
2835 GaimPresence *presence; | 2835 PurplePresence *presence; |
2836 | 2836 |
2837 if (!b || !(account = b->account) || !(gc = gaim_account_get_connection(account)) || | 2837 if (!b || !(account = b->account) || !(gc = purple_account_get_connection(account)) || |
2838 !(yd = gc->proto_data)) | 2838 !(yd = gc->proto_data)) |
2839 return NULL; | 2839 return NULL; |
2840 | 2840 |
2841 f = yahoo_friend_find(gc, b->name); | 2841 f = yahoo_friend_find(gc, b->name); |
2842 if (!f) { | 2842 if (!f) { |
2843 return "not-authorized"; | 2843 return "not-authorized"; |
2844 } | 2844 } |
2845 | 2845 |
2846 presence = gaim_buddy_get_presence(b); | 2846 presence = purple_buddy_get_presence(b); |
2847 | 2847 |
2848 if (gaim_presence_is_online(presence)) { | 2848 if (purple_presence_is_online(presence)) { |
2849 if (yahoo_friend_get_game(f)) | 2849 if (yahoo_friend_get_game(f)) |
2850 return "game"; | 2850 return "game"; |
2851 if (f->protocol == 2) | 2851 if (f->protocol == 2) |
2852 return "msn"; | 2852 return "msn"; |
2853 } | 2853 } |
2884 default: | 2884 default: |
2885 return _("Available"); | 2885 return _("Available"); |
2886 } | 2886 } |
2887 } | 2887 } |
2888 | 2888 |
2889 static void yahoo_initiate_conference(GaimBlistNode *node, gpointer data) { | 2889 static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { |
2890 | 2890 |
2891 GaimBuddy *buddy; | 2891 PurpleBuddy *buddy; |
2892 GaimConnection *gc; | 2892 PurpleConnection *gc; |
2893 | 2893 |
2894 GHashTable *components; | 2894 GHashTable *components; |
2895 struct yahoo_data *yd; | 2895 struct yahoo_data *yd; |
2896 int id; | 2896 int id; |
2897 | 2897 |
2898 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | 2898 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
2899 | 2899 |
2900 buddy = (GaimBuddy *) node; | 2900 buddy = (PurpleBuddy *) node; |
2901 gc = gaim_account_get_connection(buddy->account); | 2901 gc = purple_account_get_connection(buddy->account); |
2902 yd = gc->proto_data; | 2902 yd = gc->proto_data; |
2903 id = yd->conf_id; | 2903 id = yd->conf_id; |
2904 | 2904 |
2905 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 2905 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
2906 g_hash_table_replace(components, g_strdup("room"), | 2906 g_hash_table_replace(components, g_strdup("room"), |
2907 g_strdup_printf("%s-%d", gaim_connection_get_display_name(gc), id)); | 2907 g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); |
2908 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); | 2908 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); |
2909 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); | 2909 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); |
2910 yahoo_c_join(gc, components); | 2910 yahoo_c_join(gc, components); |
2911 g_hash_table_destroy(components); | 2911 g_hash_table_destroy(components); |
2912 | 2912 |
2913 yahoo_c_invite(gc, id, "Join my conference...", buddy->name); | 2913 yahoo_c_invite(gc, id, "Join my conference...", buddy->name); |
2914 } | 2914 } |
2915 | 2915 |
2916 static void yahoo_presence_settings(GaimBlistNode *node, gpointer data) { | 2916 static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { |
2917 GaimBuddy *buddy; | 2917 PurpleBuddy *buddy; |
2918 GaimConnection *gc; | 2918 PurpleConnection *gc; |
2919 int presence_val = GPOINTER_TO_INT(data); | 2919 int presence_val = GPOINTER_TO_INT(data); |
2920 | 2920 |
2921 buddy = (GaimBuddy *) node; | 2921 buddy = (PurpleBuddy *) node; |
2922 gc = gaim_account_get_connection(buddy->account); | 2922 gc = purple_account_get_connection(buddy->account); |
2923 | 2923 |
2924 yahoo_friend_update_presence(gc, buddy->name, presence_val); | 2924 yahoo_friend_update_presence(gc, buddy->name, presence_val); |
2925 } | 2925 } |
2926 | 2926 |
2927 static void yahoo_game(GaimBlistNode *node, gpointer data) { | 2927 static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
2928 | 2928 |
2929 GaimBuddy *buddy; | 2929 PurpleBuddy *buddy; |
2930 GaimConnection *gc; | 2930 PurpleConnection *gc; |
2931 | 2931 |
2932 struct yahoo_data *yd; | 2932 struct yahoo_data *yd; |
2933 const char *game; | 2933 const char *game; |
2934 char *game2; | 2934 char *game2; |
2935 char *t; | 2935 char *t; |
2936 char url[256]; | 2936 char url[256]; |
2937 YahooFriend *f; | 2937 YahooFriend *f; |
2938 | 2938 |
2939 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | 2939 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
2940 | 2940 |
2941 buddy = (GaimBuddy *) node; | 2941 buddy = (PurpleBuddy *) node; |
2942 gc = gaim_account_get_connection(buddy->account); | 2942 gc = purple_account_get_connection(buddy->account); |
2943 yd = (struct yahoo_data *) gc->proto_data; | 2943 yd = (struct yahoo_data *) gc->proto_data; |
2944 | 2944 |
2945 f = yahoo_friend_find(gc, buddy->name); | 2945 f = yahoo_friend_find(gc, buddy->name); |
2946 if (!f) | 2946 if (!f) |
2947 return; | 2947 return; |
2953 t = game2 = g_strdup(strstr(game, "ante?room=")); | 2953 t = game2 = g_strdup(strstr(game, "ante?room=")); |
2954 while (*t && *t != '\t') | 2954 while (*t && *t != '\t') |
2955 t++; | 2955 t++; |
2956 *t = 0; | 2956 *t = 0; |
2957 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); | 2957 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); |
2958 gaim_notify_uri(gc, url); | 2958 purple_notify_uri(gc, url); |
2959 g_free(game2); | 2959 g_free(game2); |
2960 } | 2960 } |
2961 | 2961 |
2962 static char *yahoo_status_text(GaimBuddy *b) | 2962 static char *yahoo_status_text(PurpleBuddy *b) |
2963 { | 2963 { |
2964 YahooFriend *f = NULL; | 2964 YahooFriend *f = NULL; |
2965 const char *msg; | 2965 const char *msg; |
2966 char *msg2; | 2966 char *msg2; |
2967 | 2967 |
2978 return NULL; | 2978 return NULL; |
2979 case YAHOO_STATUS_CUSTOM: | 2979 case YAHOO_STATUS_CUSTOM: |
2980 if (!(msg = yahoo_friend_get_status_message(f))) | 2980 if (!(msg = yahoo_friend_get_status_message(f))) |
2981 return NULL; | 2981 return NULL; |
2982 msg2 = g_markup_escape_text(msg, strlen(msg)); | 2982 msg2 = g_markup_escape_text(msg, strlen(msg)); |
2983 gaim_util_chrreplace(msg2, '\n', ' '); | 2983 purple_util_chrreplace(msg2, '\n', ' '); |
2984 return msg2; | 2984 return msg2; |
2985 | 2985 |
2986 default: | 2986 default: |
2987 return g_strdup(yahoo_get_status_string(f->status)); | 2987 return g_strdup(yahoo_get_status_string(f->status)); |
2988 } | 2988 } |
2989 } | 2989 } |
2990 | 2990 |
2991 void yahoo_tooltip_text(GaimBuddy *b, GaimNotifyUserInfo *user_info, gboolean full) | 2991 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
2992 { | 2992 { |
2993 YahooFriend *f; | 2993 YahooFriend *f; |
2994 char *escaped; | 2994 char *escaped; |
2995 char *status = NULL; | 2995 char *status = NULL; |
2996 const char *presence = NULL; | 2996 const char *presence = NULL; |
3020 presence = _("Appear Permanently Offline"); | 3020 presence = _("Appear Permanently Offline"); |
3021 break; | 3021 break; |
3022 case YAHOO_PRESENCE_DEFAULT: | 3022 case YAHOO_PRESENCE_DEFAULT: |
3023 break; | 3023 break; |
3024 default: | 3024 default: |
3025 gaim_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); | 3025 purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); |
3026 break; | 3026 break; |
3027 } | 3027 } |
3028 } | 3028 } |
3029 | 3029 |
3030 if (status != NULL) { | 3030 if (status != NULL) { |
3031 escaped = g_markup_escape_text(status, strlen(status)); | 3031 escaped = g_markup_escape_text(status, strlen(status)); |
3032 gaim_notify_user_info_add_pair(user_info, _("Status"), escaped); | 3032 purple_notify_user_info_add_pair(user_info, _("Status"), escaped); |
3033 g_free(status); | 3033 g_free(status); |
3034 g_free(escaped); | 3034 g_free(escaped); |
3035 } | 3035 } |
3036 | 3036 |
3037 if (presence != NULL) | 3037 if (presence != NULL) |
3038 gaim_notify_user_info_add_pair(user_info, _("Presence"), presence); | 3038 purple_notify_user_info_add_pair(user_info, _("Presence"), presence); |
3039 } | 3039 } |
3040 | 3040 |
3041 static void yahoo_addbuddyfrommenu_cb(GaimBlistNode *node, gpointer data) | 3041 static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) |
3042 { | 3042 { |
3043 GaimBuddy *buddy; | 3043 PurpleBuddy *buddy; |
3044 GaimConnection *gc; | 3044 PurpleConnection *gc; |
3045 | 3045 |
3046 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | 3046 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
3047 | 3047 |
3048 buddy = (GaimBuddy *) node; | 3048 buddy = (PurpleBuddy *) node; |
3049 gc = gaim_account_get_connection(buddy->account); | 3049 gc = purple_account_get_connection(buddy->account); |
3050 | 3050 |
3051 yahoo_add_buddy(gc, buddy, NULL); | 3051 yahoo_add_buddy(gc, buddy, NULL); |
3052 } | 3052 } |
3053 | 3053 |
3054 | 3054 |
3055 static void yahoo_chat_goto_menu(GaimBlistNode *node, gpointer data) | 3055 static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) |
3056 { | 3056 { |
3057 GaimBuddy *buddy; | 3057 PurpleBuddy *buddy; |
3058 GaimConnection *gc; | 3058 PurpleConnection *gc; |
3059 | 3059 |
3060 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | 3060 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
3061 | 3061 |
3062 buddy = (GaimBuddy *) node; | 3062 buddy = (PurpleBuddy *) node; |
3063 gc = gaim_account_get_connection(buddy->account); | 3063 gc = purple_account_get_connection(buddy->account); |
3064 | 3064 |
3065 yahoo_chat_goto(gc, buddy->name); | 3065 yahoo_chat_goto(gc, buddy->name); |
3066 } | 3066 } |
3067 | 3067 |
3068 static GList *build_presence_submenu(YahooFriend *f, GaimConnection *gc) { | 3068 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
3069 GList *m = NULL; | 3069 GList *m = NULL; |
3070 GaimMenuAction *act; | 3070 PurpleMenuAction *act; |
3071 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; | 3071 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
3072 | 3072 |
3073 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { | 3073 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
3074 if (f->presence != YAHOO_PRESENCE_ONLINE) { | 3074 if (f->presence != YAHOO_PRESENCE_ONLINE) { |
3075 act = gaim_menu_action_new(_("Appear Online"), | 3075 act = purple_menu_action_new(_("Appear Online"), |
3076 GAIM_CALLBACK(yahoo_presence_settings), | 3076 PURPLE_CALLBACK(yahoo_presence_settings), |
3077 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), | 3077 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), |
3078 NULL); | 3078 NULL); |
3079 m = g_list_append(m, act); | 3079 m = g_list_append(m, act); |
3080 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { | 3080 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { |
3081 act = gaim_menu_action_new(_("Appear Offline"), | 3081 act = purple_menu_action_new(_("Appear Offline"), |
3082 GAIM_CALLBACK(yahoo_presence_settings), | 3082 PURPLE_CALLBACK(yahoo_presence_settings), |
3083 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), | 3083 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
3084 NULL); | 3084 NULL); |
3085 m = g_list_append(m, act); | 3085 m = g_list_append(m, act); |
3086 } | 3086 } |
3087 } | 3087 } |
3088 | 3088 |
3089 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { | 3089 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
3090 act = gaim_menu_action_new(_("Don't Appear Permanently Offline"), | 3090 act = purple_menu_action_new(_("Don't Appear Permanently Offline"), |
3091 GAIM_CALLBACK(yahoo_presence_settings), | 3091 PURPLE_CALLBACK(yahoo_presence_settings), |
3092 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), | 3092 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
3093 NULL); | 3093 NULL); |
3094 m = g_list_append(m, act); | 3094 m = g_list_append(m, act); |
3095 } else { | 3095 } else { |
3096 act = gaim_menu_action_new(_("Appear Permanently Offline"), | 3096 act = purple_menu_action_new(_("Appear Permanently Offline"), |
3097 GAIM_CALLBACK(yahoo_presence_settings), | 3097 PURPLE_CALLBACK(yahoo_presence_settings), |
3098 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), | 3098 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), |
3099 NULL); | 3099 NULL); |
3100 m = g_list_append(m, act); | 3100 m = g_list_append(m, act); |
3101 } | 3101 } |
3102 | 3102 |
3103 return m; | 3103 return m; |
3104 } | 3104 } |
3105 | 3105 |
3106 static void yahoo_doodle_blist_node(GaimBlistNode *node, gpointer data) | 3106 static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) |
3107 { | 3107 { |
3108 GaimBuddy *b = (GaimBuddy *)node; | 3108 PurpleBuddy *b = (PurpleBuddy *)node; |
3109 GaimConnection *gc = b->account->gc; | 3109 PurpleConnection *gc = b->account->gc; |
3110 | 3110 |
3111 yahoo_doodle_initiate(gc, b->name); | 3111 yahoo_doodle_initiate(gc, b->name); |
3112 } | 3112 } |
3113 | 3113 |
3114 static GList *yahoo_buddy_menu(GaimBuddy *buddy) | 3114 static GList *yahoo_buddy_menu(PurpleBuddy *buddy) |
3115 { | 3115 { |
3116 GList *m = NULL; | 3116 GList *m = NULL; |
3117 GaimMenuAction *act; | 3117 PurpleMenuAction *act; |
3118 | 3118 |
3119 GaimConnection *gc = gaim_account_get_connection(buddy->account); | 3119 PurpleConnection *gc = purple_account_get_connection(buddy->account); |
3120 struct yahoo_data *yd = gc->proto_data; | 3120 struct yahoo_data *yd = gc->proto_data; |
3121 static char buf2[1024]; | 3121 static char buf2[1024]; |
3122 YahooFriend *f; | 3122 YahooFriend *f; |
3123 | 3123 |
3124 f = yahoo_friend_find(gc, buddy->name); | 3124 f = yahoo_friend_find(gc, buddy->name); |
3125 | 3125 |
3126 if (!f && !yd->wm) { | 3126 if (!f && !yd->wm) { |
3127 act = gaim_menu_action_new(_("Add Buddy"), | 3127 act = purple_menu_action_new(_("Add Buddy"), |
3128 GAIM_CALLBACK(yahoo_addbuddyfrommenu_cb), | 3128 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), |
3129 NULL, NULL); | 3129 NULL, NULL); |
3130 m = g_list_append(m, act); | 3130 m = g_list_append(m, act); |
3131 | 3131 |
3132 return m; | 3132 return m; |
3133 | 3133 |
3134 } | 3134 } |
3135 | 3135 |
3136 if (f && f->status != YAHOO_STATUS_OFFLINE) { | 3136 if (f && f->status != YAHOO_STATUS_OFFLINE) { |
3137 if (!yd->wm) { | 3137 if (!yd->wm) { |
3138 act = gaim_menu_action_new(_("Join in Chat"), | 3138 act = purple_menu_action_new(_("Join in Chat"), |
3139 GAIM_CALLBACK(yahoo_chat_goto_menu), | 3139 PURPLE_CALLBACK(yahoo_chat_goto_menu), |
3140 NULL, NULL); | 3140 NULL, NULL); |
3141 m = g_list_append(m, act); | 3141 m = g_list_append(m, act); |
3142 } | 3142 } |
3143 | 3143 |
3144 act = gaim_menu_action_new(_("Initiate Conference"), | 3144 act = purple_menu_action_new(_("Initiate Conference"), |
3145 GAIM_CALLBACK(yahoo_initiate_conference), | 3145 PURPLE_CALLBACK(yahoo_initiate_conference), |
3146 NULL, NULL); | 3146 NULL, NULL); |
3147 m = g_list_append(m, act); | 3147 m = g_list_append(m, act); |
3148 | 3148 |
3149 if (yahoo_friend_get_game(f)) { | 3149 if (yahoo_friend_get_game(f)) { |
3150 const char *game = yahoo_friend_get_game(f); | 3150 const char *game = yahoo_friend_get_game(f); |
3158 while (*t != '\n') | 3158 while (*t != '\n') |
3159 t++; /* replace the \n with a space */ | 3159 t++; /* replace the \n with a space */ |
3160 *t = ' '; | 3160 *t = ' '; |
3161 g_snprintf(buf2, sizeof buf2, "%s", room); | 3161 g_snprintf(buf2, sizeof buf2, "%s", room); |
3162 | 3162 |
3163 act = gaim_menu_action_new(buf2, | 3163 act = purple_menu_action_new(buf2, |
3164 GAIM_CALLBACK(yahoo_game), | 3164 PURPLE_CALLBACK(yahoo_game), |
3165 NULL, NULL); | 3165 NULL, NULL); |
3166 m = g_list_append(m, act); | 3166 m = g_list_append(m, act); |
3167 } | 3167 } |
3168 } | 3168 } |
3169 } | 3169 } |
3170 | 3170 |
3171 if (f) { | 3171 if (f) { |
3172 act = gaim_menu_action_new(_("Presence Settings"), NULL, NULL, | 3172 act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, |
3173 build_presence_submenu(f, gc)); | 3173 build_presence_submenu(f, gc)); |
3174 m = g_list_append(m, act); | 3174 m = g_list_append(m, act); |
3175 } | 3175 } |
3176 | 3176 |
3177 if (f) { | 3177 if (f) { |
3178 act = gaim_menu_action_new(_("Start Doodling"), | 3178 act = purple_menu_action_new(_("Start Doodling"), |
3179 GAIM_CALLBACK(yahoo_doodle_blist_node), | 3179 PURPLE_CALLBACK(yahoo_doodle_blist_node), |
3180 NULL, NULL); | 3180 NULL, NULL); |
3181 m = g_list_append(m, act); | 3181 m = g_list_append(m, act); |
3182 } | 3182 } |
3183 | 3183 |
3184 return m; | 3184 return m; |
3185 } | 3185 } |
3186 | 3186 |
3187 static GList *yahoo_blist_node_menu(GaimBlistNode *node) | 3187 static GList *yahoo_blist_node_menu(PurpleBlistNode *node) |
3188 { | 3188 { |
3189 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | 3189 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
3190 return yahoo_buddy_menu((GaimBuddy *) node); | 3190 return yahoo_buddy_menu((PurpleBuddy *) node); |
3191 } else { | 3191 } else { |
3192 return NULL; | 3192 return NULL; |
3193 } | 3193 } |
3194 } | 3194 } |
3195 | 3195 |
3196 static void yahoo_act_id(GaimConnection *gc, const char *entry) | 3196 static void yahoo_act_id(PurpleConnection *gc, const char *entry) |
3197 { | 3197 { |
3198 struct yahoo_data *yd = gc->proto_data; | 3198 struct yahoo_data *yd = gc->proto_data; |
3199 | 3199 |
3200 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); | 3200 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); |
3201 yahoo_packet_hash_str(pkt, 3, entry); | 3201 yahoo_packet_hash_str(pkt, 3, entry); |
3202 yahoo_packet_send_and_free(pkt, yd); | 3202 yahoo_packet_send_and_free(pkt, yd); |
3203 | 3203 |
3204 gaim_connection_set_display_name(gc, entry); | 3204 purple_connection_set_display_name(gc, entry); |
3205 } | 3205 } |
3206 | 3206 |
3207 static void yahoo_show_act_id(GaimPluginAction *action) | 3207 static void yahoo_show_act_id(PurplePluginAction *action) |
3208 { | 3208 { |
3209 GaimConnection *gc = (GaimConnection *) action->context; | 3209 PurpleConnection *gc = (PurpleConnection *) action->context; |
3210 gaim_request_input(gc, NULL, _("Active which ID?"), NULL, | 3210 purple_request_input(gc, NULL, _("Active which ID?"), NULL, |
3211 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, | 3211 purple_connection_get_display_name(gc), FALSE, FALSE, NULL, |
3212 _("OK"), G_CALLBACK(yahoo_act_id), | 3212 _("OK"), G_CALLBACK(yahoo_act_id), |
3213 _("Cancel"), NULL, gc); | 3213 _("Cancel"), NULL, gc); |
3214 } | 3214 } |
3215 | 3215 |
3216 static void yahoo_show_chat_goto(GaimPluginAction *action) | 3216 static void yahoo_show_chat_goto(PurplePluginAction *action) |
3217 { | 3217 { |
3218 GaimConnection *gc = (GaimConnection *) action->context; | 3218 PurpleConnection *gc = (PurpleConnection *) action->context; |
3219 gaim_request_input(gc, NULL, _("Join who in chat?"), NULL, | 3219 purple_request_input(gc, NULL, _("Join who in chat?"), NULL, |
3220 "", FALSE, FALSE, NULL, | 3220 "", FALSE, FALSE, NULL, |
3221 _("OK"), G_CALLBACK(yahoo_chat_goto), | 3221 _("OK"), G_CALLBACK(yahoo_chat_goto), |
3222 _("Cancel"), NULL, gc); | 3222 _("Cancel"), NULL, gc); |
3223 } | 3223 } |
3224 | 3224 |
3225 static GList *yahoo_actions(GaimPlugin *plugin, gpointer context) { | 3225 static GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { |
3226 GList *m = NULL; | 3226 GList *m = NULL; |
3227 GaimPluginAction *act; | 3227 PurplePluginAction *act; |
3228 | 3228 |
3229 act = gaim_plugin_action_new(_("Activate ID..."), | 3229 act = purple_plugin_action_new(_("Activate ID..."), |
3230 yahoo_show_act_id); | 3230 yahoo_show_act_id); |
3231 m = g_list_append(m, act); | 3231 m = g_list_append(m, act); |
3232 | 3232 |
3233 act = gaim_plugin_action_new(_("Join User in Chat..."), | 3233 act = purple_plugin_action_new(_("Join User in Chat..."), |
3234 yahoo_show_chat_goto); | 3234 yahoo_show_chat_goto); |
3235 m = g_list_append(m, act); | 3235 m = g_list_append(m, act); |
3236 | 3236 |
3237 return m; | 3237 return m; |
3238 } | 3238 } |
3239 | 3239 |
3240 static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) | 3240 static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
3241 { | 3241 { |
3242 struct yahoo_data *yd = gc->proto_data; | 3242 struct yahoo_data *yd = gc->proto_data; |
3243 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); | 3243 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); |
3244 char *msg = yahoo_html_to_codes(what); | 3244 char *msg = yahoo_html_to_codes(what); |
3245 char *msg2; | 3245 char *msg2; |
3246 gboolean utf8 = TRUE; | 3246 gboolean utf8 = TRUE; |
3247 GaimWhiteboard *wb; | 3247 PurpleWhiteboard *wb; |
3248 int ret = 1; | 3248 int ret = 1; |
3249 YahooFriend *f = NULL; | 3249 YahooFriend *f = NULL; |
3250 | 3250 |
3251 msg2 = yahoo_string_encode(gc, msg, &utf8); | 3251 msg2 = yahoo_string_encode(gc, msg, &utf8); |
3252 | 3252 |
3253 yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who); | 3253 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); |
3254 if ((f = yahoo_friend_find(gc, who)) && f->protocol) | 3254 if ((f = yahoo_friend_find(gc, who)) && f->protocol) |
3255 yahoo_packet_hash_int(pkt, 241, f->protocol); | 3255 yahoo_packet_hash_int(pkt, 241, f->protocol); |
3256 | 3256 |
3257 if (utf8) | 3257 if (utf8) |
3258 yahoo_packet_hash_str(pkt, 97, "1"); | 3258 yahoo_packet_hash_str(pkt, 97, "1"); |
3268 * just so that we don't inadvertantly reset their IMVironment back | 3268 * just so that we don't inadvertantly reset their IMVironment back |
3269 * to nothing. | 3269 * to nothing. |
3270 * | 3270 * |
3271 * If they have no set an IMVironment, then use the default. | 3271 * If they have no set an IMVironment, then use the default. |
3272 */ | 3272 */ |
3273 wb = gaim_whiteboard_get_session(gc->account, who); | 3273 wb = purple_whiteboard_get_session(gc->account, who); |
3274 if (wb) | 3274 if (wb) |
3275 yahoo_packet_hash_str(pkt, 63, "doodle;11"); | 3275 yahoo_packet_hash_str(pkt, 63, "doodle;11"); |
3276 else | 3276 else |
3277 { | 3277 { |
3278 const char *imv; | 3278 const char *imv; |
3302 g_free(msg2); | 3302 g_free(msg2); |
3303 | 3303 |
3304 return ret; | 3304 return ret; |
3305 } | 3305 } |
3306 | 3306 |
3307 static unsigned int yahoo_send_typing(GaimConnection *gc, const char *who, GaimTypingState state) | 3307 static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
3308 { | 3308 { |
3309 struct yahoo_data *yd = gc->proto_data; | 3309 struct yahoo_data *yd = gc->proto_data; |
3310 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); | 3310 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); |
3311 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, gaim_connection_get_display_name(gc), | 3311 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
3312 14, " ", 13, state == GAIM_TYPING ? "1" : "0", | 3312 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
3313 5, who, 1002, "1"); | 3313 5, who, 1002, "1"); |
3314 | 3314 |
3315 yahoo_packet_send_and_free(pkt, yd); | 3315 yahoo_packet_send_and_free(pkt, yd); |
3316 | 3316 |
3317 return 0; | 3317 return 0; |
3322 YahooFriend *f = value; | 3322 YahooFriend *f = value; |
3323 if (f && f->presence == YAHOO_PRESENCE_ONLINE) | 3323 if (f && f->presence == YAHOO_PRESENCE_ONLINE) |
3324 f->presence = YAHOO_PRESENCE_DEFAULT; | 3324 f->presence = YAHOO_PRESENCE_DEFAULT; |
3325 } | 3325 } |
3326 | 3326 |
3327 static void yahoo_set_status(GaimAccount *account, GaimStatus *status) | 3327 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
3328 { | 3328 { |
3329 GaimConnection *gc; | 3329 PurpleConnection *gc; |
3330 GaimPresence *presence; | 3330 PurplePresence *presence; |
3331 struct yahoo_data *yd; | 3331 struct yahoo_data *yd; |
3332 struct yahoo_packet *pkt; | 3332 struct yahoo_packet *pkt; |
3333 int old_status; | 3333 int old_status; |
3334 const char *msg = NULL; | 3334 const char *msg = NULL; |
3335 char *tmp = NULL; | 3335 char *tmp = NULL; |
3336 char *conv_msg = NULL; | 3336 char *conv_msg = NULL; |
3337 | 3337 |
3338 if (!gaim_status_is_active(status)) | 3338 if (!purple_status_is_active(status)) |
3339 return; | 3339 return; |
3340 | 3340 |
3341 gc = gaim_account_get_connection(account); | 3341 gc = purple_account_get_connection(account); |
3342 presence = gaim_status_get_presence(status); | 3342 presence = purple_status_get_presence(status); |
3343 yd = (struct yahoo_data *)gc->proto_data; | 3343 yd = (struct yahoo_data *)gc->proto_data; |
3344 old_status = yd->current_status; | 3344 old_status = yd->current_status; |
3345 | 3345 |
3346 yd->current_status = get_yahoo_status_from_gaim_status(status); | 3346 yd->current_status = get_yahoo_status_from_purple_status(status); |
3347 | 3347 |
3348 if (yd->current_status == YAHOO_STATUS_CUSTOM) | 3348 if (yd->current_status == YAHOO_STATUS_CUSTOM) |
3349 { | 3349 { |
3350 msg = gaim_status_get_attr_string(status, "message"); | 3350 msg = purple_status_get_attr_string(status, "message"); |
3351 | 3351 |
3352 if (gaim_status_is_available(status)) { | 3352 if (purple_status_is_available(status)) { |
3353 tmp = yahoo_string_encode(gc, msg, NULL); | 3353 tmp = yahoo_string_encode(gc, msg, NULL); |
3354 conv_msg = gaim_markup_strip_html(tmp); | 3354 conv_msg = purple_markup_strip_html(tmp); |
3355 g_free(tmp); | 3355 g_free(tmp); |
3356 } else { | 3356 } else { |
3357 if ((msg == NULL) || (*msg == '\0')) | 3357 if ((msg == NULL) || (*msg == '\0')) |
3358 msg = _("Away"); | 3358 msg = _("Away"); |
3359 tmp = yahoo_string_encode(gc, msg, NULL); | 3359 tmp = yahoo_string_encode(gc, msg, NULL); |
3360 conv_msg = gaim_markup_strip_html(tmp); | 3360 conv_msg = purple_markup_strip_html(tmp); |
3361 g_free(tmp); | 3361 g_free(tmp); |
3362 } | 3362 } |
3363 } | 3363 } |
3364 | 3364 |
3365 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { | 3365 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
3379 yahoo_packet_hash_str(pkt, 19, ""); | 3379 yahoo_packet_hash_str(pkt, 19, ""); |
3380 } | 3380 } |
3381 | 3381 |
3382 g_free(conv_msg); | 3382 g_free(conv_msg); |
3383 | 3383 |
3384 if (gaim_presence_is_idle(presence)) | 3384 if (purple_presence_is_idle(presence)) |
3385 yahoo_packet_hash_str(pkt, 47, "2"); | 3385 yahoo_packet_hash_str(pkt, 47, "2"); |
3386 else if (!gaim_status_is_available(status)) | 3386 else if (!purple_status_is_available(status)) |
3387 yahoo_packet_hash_str(pkt, 47, "1"); | 3387 yahoo_packet_hash_str(pkt, 47, "1"); |
3388 | 3388 |
3389 yahoo_packet_send_and_free(pkt, yd); | 3389 yahoo_packet_send_and_free(pkt, yd); |
3390 | 3390 |
3391 if (old_status == YAHOO_STATUS_INVISIBLE) { | 3391 if (old_status == YAHOO_STATUS_INVISIBLE) { |
3397 g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); | 3397 g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); |
3398 | 3398 |
3399 } | 3399 } |
3400 } | 3400 } |
3401 | 3401 |
3402 static void yahoo_set_idle(GaimConnection *gc, int idle) | 3402 static void yahoo_set_idle(PurpleConnection *gc, int idle) |
3403 { | 3403 { |
3404 struct yahoo_data *yd = gc->proto_data; | 3404 struct yahoo_data *yd = gc->proto_data; |
3405 struct yahoo_packet *pkt = NULL; | 3405 struct yahoo_packet *pkt = NULL; |
3406 char *msg = NULL, *msg2 = NULL; | 3406 char *msg = NULL, *msg2 = NULL; |
3407 GaimStatus *status = NULL; | 3407 PurpleStatus *status = NULL; |
3408 | 3408 |
3409 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) | 3409 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
3410 yd->current_status = YAHOO_STATUS_IDLE; | 3410 yd->current_status = YAHOO_STATUS_IDLE; |
3411 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { | 3411 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
3412 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); | 3412 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
3413 yd->current_status = get_yahoo_status_from_gaim_status(status); | 3413 yd->current_status = get_yahoo_status_from_purple_status(status); |
3414 } | 3414 } |
3415 | 3415 |
3416 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | 3416 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); |
3417 | 3417 |
3418 yahoo_packet_hash_int(pkt, 10, yd->current_status); | 3418 yahoo_packet_hash_int(pkt, 10, yd->current_status); |
3419 if (yd->current_status == YAHOO_STATUS_CUSTOM) { | 3419 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
3420 const char *tmp; | 3420 const char *tmp; |
3421 if (status == NULL) | 3421 if (status == NULL) |
3422 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); | 3422 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
3423 tmp = gaim_status_get_attr_string(status, "message"); | 3423 tmp = purple_status_get_attr_string(status, "message"); |
3424 if (tmp != NULL) { | 3424 if (tmp != NULL) { |
3425 msg = yahoo_string_encode(gc, tmp, NULL); | 3425 msg = yahoo_string_encode(gc, tmp, NULL); |
3426 msg2 = gaim_markup_strip_html(msg); | 3426 msg2 = purple_markup_strip_html(msg); |
3427 yahoo_packet_hash_str(pkt, 19, msg2); | 3427 yahoo_packet_hash_str(pkt, 19, msg2); |
3428 } else { | 3428 } else { |
3429 /* get_yahoo_status_from_gaim_status() returns YAHOO_STATUS_CUSTOM for | 3429 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for |
3430 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ | 3430 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ |
3431 yahoo_packet_hash_str(pkt, 19, _("Away")); | 3431 yahoo_packet_hash_str(pkt, 19, _("Away")); |
3432 } | 3432 } |
3433 } else { | 3433 } else { |
3434 yahoo_packet_hash_str(pkt, 19, ""); | 3434 yahoo_packet_hash_str(pkt, 19, ""); |
3435 } | 3435 } |
3436 | 3436 |
3437 if (idle) | 3437 if (idle) |
3438 yahoo_packet_hash_str(pkt, 47, "2"); | 3438 yahoo_packet_hash_str(pkt, 47, "2"); |
3439 else if (!gaim_presence_is_available(gaim_account_get_presence(gaim_connection_get_account(gc)))) | 3439 else if (!purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc)))) |
3440 yahoo_packet_hash_str(pkt, 47, "1"); | 3440 yahoo_packet_hash_str(pkt, 47, "1"); |
3441 | 3441 |
3442 yahoo_packet_send_and_free(pkt, yd); | 3442 yahoo_packet_send_and_free(pkt, yd); |
3443 | 3443 |
3444 g_free(msg); | 3444 g_free(msg); |
3445 g_free(msg2); | 3445 g_free(msg2); |
3446 } | 3446 } |
3447 | 3447 |
3448 static GList *yahoo_status_types(GaimAccount *account) | 3448 static GList *yahoo_status_types(PurpleAccount *account) |
3449 { | 3449 { |
3450 GaimStatusType *type; | 3450 PurpleStatusType *type; |
3451 GList *types = NULL; | 3451 GList *types = NULL; |
3452 | 3452 |
3453 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, | 3453 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, |
3454 NULL, TRUE, TRUE, FALSE, | 3454 NULL, TRUE, TRUE, FALSE, |
3455 "message", _("Message"), | 3455 "message", _("Message"), |
3456 gaim_value_new(GAIM_TYPE_STRING), NULL); | 3456 purple_value_new(PURPLE_TYPE_STRING), NULL); |
3457 types = g_list_append(types, type); | 3457 types = g_list_append(types, type); |
3458 | 3458 |
3459 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, | 3459 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, |
3460 NULL, TRUE, TRUE, FALSE, | 3460 NULL, TRUE, TRUE, FALSE, |
3461 "message", _("Message"), | 3461 "message", _("Message"), |
3462 gaim_value_new(GAIM_TYPE_STRING), NULL); | 3462 purple_value_new(PURPLE_TYPE_STRING), NULL); |
3463 types = g_list_append(types, type); | 3463 types = g_list_append(types, type); |
3464 | 3464 |
3465 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); | 3465 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); |
3466 types = g_list_append(types, type); | 3466 types = g_list_append(types, type); |
3467 | 3467 |
3468 type = gaim_status_type_new(GAIM_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE); | 3468 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE); |
3469 types = g_list_append(types, type); | 3469 types = g_list_append(types, type); |
3470 | 3470 |
3471 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); | 3471 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); |
3472 types = g_list_append(types, type); | 3472 types = g_list_append(types, type); |
3473 | 3473 |
3474 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); | 3474 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); |
3475 types = g_list_append(types, type); | 3475 types = g_list_append(types, type); |
3476 | 3476 |
3477 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); | 3477 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); |
3478 types = g_list_append(types, type); | 3478 types = g_list_append(types, type); |
3479 | 3479 |
3480 type = gaim_status_type_new(GAIM_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); | 3480 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); |
3481 types = g_list_append(types, type); | 3481 types = g_list_append(types, type); |
3482 | 3482 |
3483 type = gaim_status_type_new(GAIM_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); | 3483 type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); |
3484 types = g_list_append(types, type); | 3484 types = g_list_append(types, type); |
3485 | 3485 |
3486 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); | 3486 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); |
3487 types = g_list_append(types, type); | 3487 types = g_list_append(types, type); |
3488 | 3488 |
3489 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); | 3489 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); |
3490 types = g_list_append(types, type); | 3490 types = g_list_append(types, type); |
3491 | 3491 |
3492 | 3492 |
3493 type = gaim_status_type_new(GAIM_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); | 3493 type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); |
3494 types = g_list_append(types, type); | 3494 types = g_list_append(types, type); |
3495 | 3495 |
3496 type = gaim_status_type_new(GAIM_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); | 3496 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); |
3497 types = g_list_append(types, type); | 3497 types = g_list_append(types, type); |
3498 | 3498 |
3499 type = gaim_status_type_new_full(GAIM_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); | 3499 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); |
3500 types = g_list_append(types, type); | 3500 types = g_list_append(types, type); |
3501 | 3501 |
3502 return types; | 3502 return types; |
3503 } | 3503 } |
3504 | 3504 |
3505 static void yahoo_keepalive(GaimConnection *gc) | 3505 static void yahoo_keepalive(PurpleConnection *gc) |
3506 { | 3506 { |
3507 struct yahoo_data *yd = gc->proto_data; | 3507 struct yahoo_data *yd = gc->proto_data; |
3508 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0); | 3508 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0); |
3509 yahoo_packet_send_and_free(pkt, yd); | 3509 yahoo_packet_send_and_free(pkt, yd); |
3510 | 3510 |
3515 ycht_chat_send_keepalive(yd->ycht); | 3515 ycht_chat_send_keepalive(yd->ycht); |
3516 return; | 3516 return; |
3517 } | 3517 } |
3518 | 3518 |
3519 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); | 3519 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); |
3520 yahoo_packet_hash_str(pkt, 109, gaim_connection_get_display_name(gc)); | 3520 yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); |
3521 yahoo_packet_send_and_free(pkt, yd); | 3521 yahoo_packet_send_and_free(pkt, yd); |
3522 } | 3522 } |
3523 | 3523 |
3524 /* XXX - What's the deal with GaimGroup *foo? */ | 3524 /* XXX - What's the deal with PurpleGroup *foo? */ |
3525 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *foo) | 3525 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *foo) |
3526 { | 3526 { |
3527 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 3527 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
3528 struct yahoo_packet *pkt; | 3528 struct yahoo_packet *pkt; |
3529 GaimGroup *g; | 3529 PurpleGroup *g; |
3530 char *group = NULL; | 3530 char *group = NULL; |
3531 char *group2 = NULL; | 3531 char *group2 = NULL; |
3532 | 3532 |
3533 if (!yd->logged_in) | 3533 if (!yd->logged_in) |
3534 return; | 3534 return; |
3535 | 3535 |
3536 if (!yahoo_privacy_check(gc, gaim_buddy_get_name(buddy))) | 3536 if (!yahoo_privacy_check(gc, purple_buddy_get_name(buddy))) |
3537 return; | 3537 return; |
3538 | 3538 |
3539 if (foo) | 3539 if (foo) |
3540 group = foo->name; | 3540 group = foo->name; |
3541 if (!group) { | 3541 if (!group) { |
3542 g = gaim_buddy_get_group(buddy); | 3542 g = purple_buddy_get_group(buddy); |
3543 if (g) | 3543 if (g) |
3544 group = g->name; | 3544 group = g->name; |
3545 else | 3545 else |
3546 group = "Buddies"; | 3546 group = "Buddies"; |
3547 } | 3547 } |
3548 | 3548 |
3549 group2 = yahoo_string_encode(gc, group, NULL); | 3549 group2 = yahoo_string_encode(gc, group, NULL); |
3550 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3550 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3551 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc), | 3551 yahoo_packet_hash(pkt, "ssss", 1, purple_connection_get_display_name(gc), |
3552 7, buddy->name, 65, group2, 14, ""); | 3552 7, buddy->name, 65, group2, 14, ""); |
3553 yahoo_packet_send_and_free(pkt, yd); | 3553 yahoo_packet_send_and_free(pkt, yd); |
3554 g_free(group2); | 3554 g_free(group2); |
3555 } | 3555 } |
3556 | 3556 |
3557 static void yahoo_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) | 3557 static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
3558 { | 3558 { |
3559 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 3559 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
3560 struct yahoo_packet *pkt; | 3560 struct yahoo_packet *pkt; |
3561 GSList *buddies, *l; | 3561 GSList *buddies, *l; |
3562 GaimGroup *g; | 3562 PurpleGroup *g; |
3563 gboolean remove = TRUE; | 3563 gboolean remove = TRUE; |
3564 char *cg; | 3564 char *cg; |
3565 | 3565 |
3566 if (!(yahoo_friend_find(gc, buddy->name))) | 3566 if (!(yahoo_friend_find(gc, buddy->name))) |
3567 return; | 3567 return; |
3568 | 3568 |
3569 buddies = gaim_find_buddies(gaim_connection_get_account(gc), buddy->name); | 3569 buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name); |
3570 for (l = buddies; l; l = l->next) { | 3570 for (l = buddies; l; l = l->next) { |
3571 g = gaim_buddy_get_group(l->data); | 3571 g = purple_buddy_get_group(l->data); |
3572 if (gaim_utf8_strcasecmp(group->name, g->name)) { | 3572 if (purple_utf8_strcasecmp(group->name, g->name)) { |
3573 remove = FALSE; | 3573 remove = FALSE; |
3574 break; | 3574 break; |
3575 } | 3575 } |
3576 } | 3576 } |
3577 | 3577 |
3580 if (remove) | 3580 if (remove) |
3581 g_hash_table_remove(yd->friends, buddy->name); | 3581 g_hash_table_remove(yd->friends, buddy->name); |
3582 | 3582 |
3583 cg = yahoo_string_encode(gc, group->name, NULL); | 3583 cg = yahoo_string_encode(gc, group->name, NULL); |
3584 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3584 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3585 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), | 3585 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
3586 7, buddy->name, 65, cg); | 3586 7, buddy->name, 65, cg); |
3587 yahoo_packet_send_and_free(pkt, yd); | 3587 yahoo_packet_send_and_free(pkt, yd); |
3588 g_free(cg); | 3588 g_free(cg); |
3589 } | 3589 } |
3590 | 3590 |
3591 static void yahoo_add_deny(GaimConnection *gc, const char *who) { | 3591 static void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
3592 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 3592 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
3593 struct yahoo_packet *pkt; | 3593 struct yahoo_packet *pkt; |
3594 | 3594 |
3595 if (!yd->logged_in) | 3595 if (!yd->logged_in) |
3596 return; | 3596 return; |
3601 | 3601 |
3602 if (!who || who[0] == '\0') | 3602 if (!who || who[0] == '\0') |
3603 return; | 3603 return; |
3604 | 3604 |
3605 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | 3605 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
3606 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), | 3606 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
3607 7, who, 13, "1"); | 3607 7, who, 13, "1"); |
3608 yahoo_packet_send_and_free(pkt, yd); | 3608 yahoo_packet_send_and_free(pkt, yd); |
3609 } | 3609 } |
3610 | 3610 |
3611 static void yahoo_rem_deny(GaimConnection *gc, const char *who) { | 3611 static void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
3612 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 3612 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
3613 struct yahoo_packet *pkt; | 3613 struct yahoo_packet *pkt; |
3614 | 3614 |
3615 if (!yd->logged_in) | 3615 if (!yd->logged_in) |
3616 return; | 3616 return; |
3617 | 3617 |
3618 if (!who || who[0] == '\0') | 3618 if (!who || who[0] == '\0') |
3619 return; | 3619 return; |
3620 | 3620 |
3621 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | 3621 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
3622 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 13, "2"); | 3622 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); |
3623 yahoo_packet_send_and_free(pkt, yd); | 3623 yahoo_packet_send_and_free(pkt, yd); |
3624 } | 3624 } |
3625 | 3625 |
3626 static void yahoo_set_permit_deny(GaimConnection *gc) { | 3626 static void yahoo_set_permit_deny(PurpleConnection *gc) { |
3627 GaimAccount *acct; | 3627 PurpleAccount *acct; |
3628 GSList *deny; | 3628 GSList *deny; |
3629 | 3629 |
3630 acct = gc->account; | 3630 acct = gc->account; |
3631 | 3631 |
3632 switch (acct->perm_deny) { | 3632 switch (acct->perm_deny) { |
3633 /* privacy 1 */ | 3633 /* privacy 1 */ |
3634 case GAIM_PRIVACY_ALLOW_ALL: | 3634 case PURPLE_PRIVACY_ALLOW_ALL: |
3635 for (deny = acct->deny;deny;deny = deny->next) | 3635 for (deny = acct->deny;deny;deny = deny->next) |
3636 yahoo_rem_deny(gc, deny->data); | 3636 yahoo_rem_deny(gc, deny->data); |
3637 break; | 3637 break; |
3638 /* privacy 3 */ | 3638 /* privacy 3 */ |
3639 case GAIM_PRIVACY_ALLOW_USERS: | 3639 case PURPLE_PRIVACY_ALLOW_USERS: |
3640 for (deny = acct->deny;deny;deny = deny->next) | 3640 for (deny = acct->deny;deny;deny = deny->next) |
3641 yahoo_rem_deny(gc, deny->data); | 3641 yahoo_rem_deny(gc, deny->data); |
3642 break; | 3642 break; |
3643 /* privacy 5 */ | 3643 /* privacy 5 */ |
3644 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | 3644 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
3645 /* privacy 4 */ | 3645 /* privacy 4 */ |
3646 case GAIM_PRIVACY_DENY_USERS: | 3646 case PURPLE_PRIVACY_DENY_USERS: |
3647 for (deny = acct->deny;deny;deny = deny->next) | 3647 for (deny = acct->deny;deny;deny = deny->next) |
3648 yahoo_add_deny(gc, deny->data); | 3648 yahoo_add_deny(gc, deny->data); |
3649 break; | 3649 break; |
3650 /* privacy 2 */ | 3650 /* privacy 2 */ |
3651 case GAIM_PRIVACY_DENY_ALL: | 3651 case PURPLE_PRIVACY_DENY_ALL: |
3652 default: | 3652 default: |
3653 break; | 3653 break; |
3654 } | 3654 } |
3655 } | 3655 } |
3656 | 3656 |
3657 static gboolean yahoo_unload_plugin(GaimPlugin *plugin) | 3657 static gboolean yahoo_unload_plugin(PurplePlugin *plugin) |
3658 { | 3658 { |
3659 yahoo_dest_colorht(); | 3659 yahoo_dest_colorht(); |
3660 | 3660 |
3661 return TRUE; | 3661 return TRUE; |
3662 } | 3662 } |
3663 | 3663 |
3664 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who, | 3664 static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
3665 const char *old_group, const char *new_group) | 3665 const char *old_group, const char *new_group) |
3666 { | 3666 { |
3667 struct yahoo_data *yd = gc->proto_data; | 3667 struct yahoo_data *yd = gc->proto_data; |
3668 struct yahoo_packet *pkt; | 3668 struct yahoo_packet *pkt; |
3669 char *gpn, *gpo; | 3669 char *gpn, *gpo; |
3686 return; | 3686 return; |
3687 } | 3687 } |
3688 | 3688 |
3689 /* Step 1: Add buddy to new group. */ | 3689 /* Step 1: Add buddy to new group. */ |
3690 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3690 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3691 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc), | 3691 yahoo_packet_hash(pkt, "ssss", 1, purple_connection_get_display_name(gc), |
3692 7, who, 65, gpn, 14, ""); | 3692 7, who, 65, gpn, 14, ""); |
3693 yahoo_packet_send_and_free(pkt, yd); | 3693 yahoo_packet_send_and_free(pkt, yd); |
3694 | 3694 |
3695 /* Step 2: Remove buddy from old group */ | 3695 /* Step 2: Remove buddy from old group */ |
3696 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); | 3696 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
3697 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 65, gpo); | 3697 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 65, gpo); |
3698 yahoo_packet_send_and_free(pkt, yd); | 3698 yahoo_packet_send_and_free(pkt, yd); |
3699 g_free(gpn); | 3699 g_free(gpn); |
3700 g_free(gpo); | 3700 g_free(gpo); |
3701 } | 3701 } |
3702 | 3702 |
3703 static void yahoo_rename_group(GaimConnection *gc, const char *old_name, | 3703 static void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
3704 GaimGroup *group, GList *moved_buddies) | 3704 PurpleGroup *group, GList *moved_buddies) |
3705 { | 3705 { |
3706 struct yahoo_data *yd = gc->proto_data; | 3706 struct yahoo_data *yd = gc->proto_data; |
3707 struct yahoo_packet *pkt; | 3707 struct yahoo_packet *pkt; |
3708 char *gpn, *gpo; | 3708 char *gpn, *gpo; |
3709 | 3709 |
3714 g_free(gpo); | 3714 g_free(gpo); |
3715 return; | 3715 return; |
3716 } | 3716 } |
3717 | 3717 |
3718 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); | 3718 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); |
3719 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), | 3719 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
3720 65, gpo, 67, gpn); | 3720 65, gpo, 67, gpn); |
3721 yahoo_packet_send_and_free(pkt, yd); | 3721 yahoo_packet_send_and_free(pkt, yd); |
3722 g_free(gpn); | 3722 g_free(gpn); |
3723 g_free(gpo); | 3723 g_free(gpo); |
3724 } | 3724 } |
3725 | 3725 |
3726 /********************************* Commands **********************************/ | 3726 /********************************* Commands **********************************/ |
3727 | 3727 |
3728 static GaimCmdRet | 3728 static PurpleCmdRet |
3729 yahoogaim_cmd_buzz(GaimConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { | 3729 yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { |
3730 | 3730 |
3731 GaimAccount *account = gaim_conversation_get_account(c); | 3731 PurpleAccount *account = purple_conversation_get_account(c); |
3732 const char *username = gaim_account_get_username(account); | 3732 const char *username = purple_account_get_username(account); |
3733 | 3733 |
3734 if (*args && args[0]) | 3734 if (*args && args[0]) |
3735 return GAIM_CMD_RET_FAILED; | 3735 return PURPLE_CMD_RET_FAILED; |
3736 | 3736 |
3737 gaim_debug(GAIM_DEBUG_INFO, "yahoo", | 3737 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
3738 "Sending <ding> on account %s to buddy %s.\n", username, c->name); | 3738 "Sending <ding> on account %s to buddy %s.\n", username, c->name); |
3739 gaim_conv_im_send(GAIM_CONV_IM(c), "<ding>"); | 3739 purple_conv_im_send(PURPLE_CONV_IM(c), "<ding>"); |
3740 gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_SEND, time(NULL)); | 3740 purple_conv_im_write(PURPLE_CONV_IM(c), "", _("Buzz!!"), PURPLE_MESSAGE_NICK|PURPLE_MESSAGE_SEND, time(NULL)); |
3741 return GAIM_CMD_RET_OK; | 3741 return PURPLE_CMD_RET_OK; |
3742 } | 3742 } |
3743 | 3743 |
3744 static GaimPlugin *my_protocol = NULL; | 3744 static PurplePlugin *my_protocol = NULL; |
3745 | 3745 |
3746 static GaimCmdRet | 3746 static PurpleCmdRet |
3747 yahoogaim_cmd_chat_join(GaimConversation *conv, const char *cmd, | 3747 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, |
3748 char **args, char **error, void *data) | 3748 char **args, char **error, void *data) |
3749 { | 3749 { |
3750 GHashTable *comp; | 3750 GHashTable *comp; |
3751 GaimConnection *gc; | 3751 PurpleConnection *gc; |
3752 struct yahoo_data *yd; | 3752 struct yahoo_data *yd; |
3753 int id; | 3753 int id; |
3754 | 3754 |
3755 if (!args || !args[0]) | 3755 if (!args || !args[0]) |
3756 return GAIM_CMD_RET_FAILED; | 3756 return PURPLE_CMD_RET_FAILED; |
3757 | 3757 |
3758 gc = gaim_conversation_get_gc(conv); | 3758 gc = purple_conversation_get_gc(conv); |
3759 yd = gc->proto_data; | 3759 yd = gc->proto_data; |
3760 id = yd->conf_id; | 3760 id = yd->conf_id; |
3761 gaim_debug(GAIM_DEBUG_INFO, "yahoo", | 3761 purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
3762 "Trying to join %s \n", args[0]); | 3762 "Trying to join %s \n", args[0]); |
3763 | 3763 |
3764 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 3764 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
3765 g_hash_table_replace(comp, g_strdup("room"), | 3765 g_hash_table_replace(comp, g_strdup("room"), |
3766 g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0])))); | 3766 g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0])))); |
3767 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); | 3767 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); |
3768 | 3768 |
3769 yahoo_c_join(gc, comp); | 3769 yahoo_c_join(gc, comp); |
3770 | 3770 |
3771 g_hash_table_destroy(comp); | 3771 g_hash_table_destroy(comp); |
3772 return GAIM_CMD_RET_OK; | 3772 return PURPLE_CMD_RET_OK; |
3773 } | 3773 } |
3774 | 3774 |
3775 static GaimCmdRet | 3775 static PurpleCmdRet |
3776 yahoogaim_cmd_chat_list(GaimConversation *conv, const char *cmd, | 3776 yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, |
3777 char **args, char **error, void *data) | 3777 char **args, char **error, void *data) |
3778 { | 3778 { |
3779 GaimAccount *account = gaim_conversation_get_account(conv); | 3779 PurpleAccount *account = purple_conversation_get_account(conv); |
3780 if (*args && args[0]) | 3780 if (*args && args[0]) |
3781 return GAIM_CMD_RET_FAILED; | 3781 return PURPLE_CMD_RET_FAILED; |
3782 gaim_roomlist_show_with_account(account); | 3782 purple_roomlist_show_with_account(account); |
3783 return GAIM_CMD_RET_OK; | 3783 return PURPLE_CMD_RET_OK; |
3784 } | 3784 } |
3785 | 3785 |
3786 static gboolean yahoo_offline_message(const GaimBuddy *buddy) | 3786 static gboolean yahoo_offline_message(const PurpleBuddy *buddy) |
3787 { | 3787 { |
3788 return TRUE; | 3788 return TRUE; |
3789 } | 3789 } |
3790 | 3790 |
3791 /************************** Plugin Initialization ****************************/ | 3791 /************************** Plugin Initialization ****************************/ |
3792 static void | 3792 static void |
3793 yahoogaim_register_commands(void) | 3793 yahoopurple_register_commands(void) |
3794 { | 3794 { |
3795 gaim_cmd_register("join", "s", GAIM_CMD_P_PRPL, | 3795 purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, |
3796 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | 3796 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | |
3797 GAIM_CMD_FLAG_PRPL_ONLY, | 3797 PURPLE_CMD_FLAG_PRPL_ONLY, |
3798 "prpl-yahoo", yahoogaim_cmd_chat_join, | 3798 "prpl-yahoo", yahoopurple_cmd_chat_join, |
3799 _("join <room>: Join a chat room on the Yahoo network"), NULL); | 3799 _("join <room>: Join a chat room on the Yahoo network"), NULL); |
3800 gaim_cmd_register("list", "", GAIM_CMD_P_PRPL, | 3800 purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, |
3801 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | 3801 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | |
3802 GAIM_CMD_FLAG_PRPL_ONLY, | 3802 PURPLE_CMD_FLAG_PRPL_ONLY, |
3803 "prpl-yahoo", yahoogaim_cmd_chat_list, | 3803 "prpl-yahoo", yahoopurple_cmd_chat_list, |
3804 _("list: List rooms on the Yahoo network"), NULL); | 3804 _("list: List rooms on the Yahoo network"), NULL); |
3805 gaim_cmd_register("buzz", "", GAIM_CMD_P_PRPL, | 3805 purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, |
3806 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, | 3806 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, |
3807 "prpl-yahoo", yahoogaim_cmd_buzz, | 3807 "prpl-yahoo", yahoopurple_cmd_buzz, |
3808 _("buzz: Buzz a user to get their attention"), NULL); | 3808 _("buzz: Buzz a user to get their attention"), NULL); |
3809 gaim_cmd_register("doodle", "", GAIM_CMD_P_PRPL, | 3809 purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, |
3810 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, | 3810 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, |
3811 "prpl-yahoo", yahoo_doodle_gaim_cmd_start, | 3811 "prpl-yahoo", yahoo_doodle_purple_cmd_start, |
3812 _("doodle: Request user to start a Doodle session"), NULL); | 3812 _("doodle: Request user to start a Doodle session"), NULL); |
3813 } | 3813 } |
3814 | 3814 |
3815 static GaimAccount *find_acct(const char *prpl, const char *acct_id) | 3815 static PurpleAccount *find_acct(const char *prpl, const char *acct_id) |
3816 { | 3816 { |
3817 GaimAccount *acct = NULL; | 3817 PurpleAccount *acct = NULL; |
3818 | 3818 |
3819 /* If we have a specific acct, use it */ | 3819 /* If we have a specific acct, use it */ |
3820 if (acct_id) { | 3820 if (acct_id) { |
3821 acct = gaim_accounts_find(acct_id, prpl); | 3821 acct = purple_accounts_find(acct_id, prpl); |
3822 if (acct && !gaim_account_is_connected(acct)) | 3822 if (acct && !purple_account_is_connected(acct)) |
3823 acct = NULL; | 3823 acct = NULL; |
3824 } else { /* Otherwise find an active account for the protocol */ | 3824 } else { /* Otherwise find an active account for the protocol */ |
3825 GList *l = gaim_accounts_get_all(); | 3825 GList *l = purple_accounts_get_all(); |
3826 while (l) { | 3826 while (l) { |
3827 if (!strcmp(prpl, gaim_account_get_protocol_id(l->data)) | 3827 if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) |
3828 && gaim_account_is_connected(l->data)) { | 3828 && purple_account_is_connected(l->data)) { |
3829 acct = l->data; | 3829 acct = l->data; |
3830 break; | 3830 break; |
3831 } | 3831 } |
3832 l = l->next; | 3832 l = l->next; |
3833 } | 3833 } |
3848 } | 3848 } |
3849 | 3849 |
3850 static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params) | 3850 static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params) |
3851 { | 3851 { |
3852 char *acct_id = g_hash_table_lookup(params, "account"); | 3852 char *acct_id = g_hash_table_lookup(params, "account"); |
3853 GaimAccount *acct; | 3853 PurpleAccount *acct; |
3854 | 3854 |
3855 if (g_ascii_strcasecmp(proto, "ymsgr")) | 3855 if (g_ascii_strcasecmp(proto, "ymsgr")) |
3856 return FALSE; | 3856 return FALSE; |
3857 | 3857 |
3858 acct = find_acct(gaim_plugin_get_id(my_protocol), acct_id); | 3858 acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); |
3859 | 3859 |
3860 if (!acct) | 3860 if (!acct) |
3861 return FALSE; | 3861 return FALSE; |
3862 | 3862 |
3863 /* ymsgr:SendIM?screename&m=The+Message */ | 3863 /* ymsgr:SendIM?screename&m=The+Message */ |
3865 char *sname = NULL; | 3865 char *sname = NULL; |
3866 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname); | 3866 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname); |
3867 if (sname) { | 3867 if (sname) { |
3868 char *message = g_hash_table_lookup(params, "m"); | 3868 char *message = g_hash_table_lookup(params, "m"); |
3869 | 3869 |
3870 GaimConversation *conv = gaim_find_conversation_with_account( | 3870 PurpleConversation *conv = purple_find_conversation_with_account( |
3871 GAIM_CONV_TYPE_IM, sname, acct); | 3871 PURPLE_CONV_TYPE_IM, sname, acct); |
3872 if (conv == NULL) | 3872 if (conv == NULL) |
3873 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, acct, sname); | 3873 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); |
3874 gaim_conversation_present(conv); | 3874 purple_conversation_present(conv); |
3875 | 3875 |
3876 if (message) { | 3876 if (message) { |
3877 /* Spaces are encoded as '+' */ | 3877 /* Spaces are encoded as '+' */ |
3878 g_strdelimit(message, "+", ' '); | 3878 g_strdelimit(message, "+", ' '); |
3879 gaim_conv_im_send(GAIM_CONV_IM(conv), message); | 3879 purple_conv_im_send(PURPLE_CONV_IM(conv), message); |
3880 } | 3880 } |
3881 } | 3881 } |
3882 /*else | 3882 /*else |
3883 **If pidgindialogs_im() was in the core, we could use it here. | 3883 **If pidgindialogs_im() was in the core, we could use it here. |
3884 * It is all gaim_request_* based, but I'm not sure it really belongs in the core | 3884 * It is all purple_request_* based, but I'm not sure it really belongs in the core |
3885 pidgindialogs_im();*/ | 3885 pidgindialogs_im();*/ |
3886 | 3886 |
3887 return TRUE; | 3887 return TRUE; |
3888 } | 3888 } |
3889 /* ymsgr:Chat?roomname */ | 3889 /* ymsgr:Chat?roomname */ |
3892 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname); | 3892 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname); |
3893 if (rname) { | 3893 if (rname) { |
3894 /* This is somewhat hacky, but the params aren't useful after this command */ | 3894 /* This is somewhat hacky, but the params aren't useful after this command */ |
3895 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); | 3895 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); |
3896 g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat")); | 3896 g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat")); |
3897 serv_join_chat(gaim_account_get_connection(acct), params); | 3897 serv_join_chat(purple_account_get_connection(acct), params); |
3898 } | 3898 } |
3899 /*else | 3899 /*else |
3900 ** Same as above (except that this would have to be re-written using gaim_request_*) | 3900 ** Same as above (except that this would have to be re-written using purple_request_*) |
3901 pidgin_blist_joinchat_show(); */ | 3901 pidgin_blist_joinchat_show(); */ |
3902 | 3902 |
3903 return TRUE; | 3903 return TRUE; |
3904 } | 3904 } |
3905 /* ymsgr:AddFriend?name */ | 3905 /* ymsgr:AddFriend?name */ |
3906 else if (!g_ascii_strcasecmp(cmd, "AddFriend")) { | 3906 else if (!g_ascii_strcasecmp(cmd, "AddFriend")) { |
3907 char *name = NULL; | 3907 char *name = NULL; |
3908 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name); | 3908 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name); |
3909 gaim_blist_request_add_buddy(acct, name, NULL, NULL); | 3909 purple_blist_request_add_buddy(acct, name, NULL, NULL); |
3910 return TRUE; | 3910 return TRUE; |
3911 } | 3911 } |
3912 | 3912 |
3913 return FALSE; | 3913 return FALSE; |
3914 } | 3914 } |
3915 | 3915 |
3916 static GaimWhiteboardPrplOps yahoo_whiteboard_prpl_ops = | 3916 static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = |
3917 { | 3917 { |
3918 yahoo_doodle_start, | 3918 yahoo_doodle_start, |
3919 yahoo_doodle_end, | 3919 yahoo_doodle_end, |
3920 yahoo_doodle_get_dimensions, | 3920 yahoo_doodle_get_dimensions, |
3921 NULL, | 3921 NULL, |
3923 yahoo_doodle_set_brush, | 3923 yahoo_doodle_set_brush, |
3924 yahoo_doodle_send_draw_list, | 3924 yahoo_doodle_send_draw_list, |
3925 yahoo_doodle_clear | 3925 yahoo_doodle_clear |
3926 }; | 3926 }; |
3927 | 3927 |
3928 static GaimPluginProtocolInfo prpl_info = | 3928 static PurplePluginProtocolInfo prpl_info = |
3929 { | 3929 { |
3930 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, | 3930 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, |
3931 NULL, /* user_splits */ | 3931 NULL, /* user_splits */ |
3932 NULL, /* protocol_options */ | 3932 NULL, /* protocol_options */ |
3933 {"png,gif,jpeg", 96, 96, 96, 96, 0, GAIM_ICON_SCALE_SEND}, | 3933 {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, |
3934 yahoo_list_icon, | 3934 yahoo_list_icon, |
3935 yahoo_list_emblem, | 3935 yahoo_list_emblem, |
3936 yahoo_status_text, | 3936 yahoo_status_text, |
3937 yahoo_tooltip_text, | 3937 yahoo_tooltip_text, |
3938 yahoo_status_types, | 3938 yahoo_status_types, |
3971 NULL, /* alias_buddy */ | 3971 NULL, /* alias_buddy */ |
3972 yahoo_change_buddys_group, | 3972 yahoo_change_buddys_group, |
3973 yahoo_rename_group, | 3973 yahoo_rename_group, |
3974 NULL, /* buddy_free */ | 3974 NULL, /* buddy_free */ |
3975 NULL, /* convo_closed */ | 3975 NULL, /* convo_closed */ |
3976 gaim_normalize_nocase, /* normalize */ | 3976 purple_normalize_nocase, /* normalize */ |
3977 yahoo_set_buddy_icon, | 3977 yahoo_set_buddy_icon, |
3978 NULL, /* void (*remove_group)(GaimConnection *gc, const char *group);*/ | 3978 NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ |
3979 NULL, /* char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who); */ | 3979 NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ |
3980 NULL, /* set_chat_topic */ | 3980 NULL, /* set_chat_topic */ |
3981 NULL, /* find_blist_chat */ | 3981 NULL, /* find_blist_chat */ |
3982 yahoo_roomlist_get_list, | 3982 yahoo_roomlist_get_list, |
3983 yahoo_roomlist_cancel, | 3983 yahoo_roomlist_cancel, |
3984 yahoo_roomlist_expand_category, | 3984 yahoo_roomlist_expand_category, |
3989 &yahoo_whiteboard_prpl_ops, | 3989 &yahoo_whiteboard_prpl_ops, |
3990 NULL, /* send_raw */ | 3990 NULL, /* send_raw */ |
3991 NULL, /* roomlist_room_serialize */ | 3991 NULL, /* roomlist_room_serialize */ |
3992 }; | 3992 }; |
3993 | 3993 |
3994 static GaimPluginInfo info = | 3994 static PurplePluginInfo info = |
3995 { | 3995 { |
3996 GAIM_PLUGIN_MAGIC, | 3996 PURPLE_PLUGIN_MAGIC, |
3997 GAIM_MAJOR_VERSION, | 3997 PURPLE_MAJOR_VERSION, |
3998 GAIM_MINOR_VERSION, | 3998 PURPLE_MINOR_VERSION, |
3999 GAIM_PLUGIN_PROTOCOL, /**< type */ | 3999 PURPLE_PLUGIN_PROTOCOL, /**< type */ |
4000 NULL, /**< ui_requirement */ | 4000 NULL, /**< ui_requirement */ |
4001 0, /**< flags */ | 4001 0, /**< flags */ |
4002 NULL, /**< dependencies */ | 4002 NULL, /**< dependencies */ |
4003 GAIM_PRIORITY_DEFAULT, /**< priority */ | 4003 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
4004 "prpl-yahoo", /**< id */ | 4004 "prpl-yahoo", /**< id */ |
4005 "Yahoo", /**< name */ | 4005 "Yahoo", /**< name */ |
4006 VERSION, /**< version */ | 4006 VERSION, /**< version */ |
4007 /** summary */ | 4007 /** summary */ |
4008 N_("Yahoo Protocol Plugin"), | 4008 N_("Yahoo Protocol Plugin"), |
4009 /** description */ | 4009 /** description */ |
4010 N_("Yahoo Protocol Plugin"), | 4010 N_("Yahoo Protocol Plugin"), |
4011 NULL, /**< author */ | 4011 NULL, /**< author */ |
4012 GAIM_WEBSITE, /**< homepage */ | 4012 PURPLE_WEBSITE, /**< homepage */ |
4013 NULL, /**< load */ | 4013 NULL, /**< load */ |
4014 yahoo_unload_plugin, /**< unload */ | 4014 yahoo_unload_plugin, /**< unload */ |
4015 NULL, /**< destroy */ | 4015 NULL, /**< destroy */ |
4016 NULL, /**< ui_info */ | 4016 NULL, /**< ui_info */ |
4017 &prpl_info, /**< extra_info */ | 4017 &prpl_info, /**< extra_info */ |
4018 NULL, | 4018 NULL, |
4019 yahoo_actions | 4019 yahoo_actions |
4020 }; | 4020 }; |
4021 | 4021 |
4022 static void | 4022 static void |
4023 init_plugin(GaimPlugin *plugin) | 4023 init_plugin(PurplePlugin *plugin) |
4024 { | 4024 { |
4025 GaimAccountOption *option; | 4025 PurpleAccountOption *option; |
4026 | 4026 |
4027 option = gaim_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE); | 4027 option = purple_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE); |
4028 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4028 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4029 | 4029 |
4030 option = gaim_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST); | 4030 option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST); |
4031 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4031 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4032 | 4032 |
4033 option = gaim_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST); | 4033 option = purple_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST); |
4034 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4034 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4035 | 4035 |
4036 option = gaim_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); | 4036 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); |
4037 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4037 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4038 | 4038 |
4039 option = gaim_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST); | 4039 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST); |
4040 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4040 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4041 | 4041 |
4042 option = gaim_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST); | 4042 option = purple_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST); |
4043 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4043 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4044 | 4044 |
4045 option = gaim_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); | 4045 option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); |
4046 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4046 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4047 | 4047 |
4048 option = gaim_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE); | 4048 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE); |
4049 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4049 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4050 | 4050 |
4051 option = gaim_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); | 4051 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); |
4052 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4052 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4053 | 4053 |
4054 option = gaim_account_option_string_new(_("Encoding"), "local_charset", "ISO-8859-1"); | 4054 option = purple_account_option_string_new(_("Encoding"), "local_charset", "ISO-8859-1"); |
4055 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4055 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4056 | 4056 |
4057 | 4057 |
4058 #if 0 | 4058 #if 0 |
4059 option = gaim_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); | 4059 option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); |
4060 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4060 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4061 | 4061 |
4062 option = gaim_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); | 4062 option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); |
4063 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4063 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4064 | 4064 |
4065 option = gaim_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); | 4065 option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); |
4066 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 4066 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
4067 #endif | 4067 #endif |
4068 | 4068 |
4069 my_protocol = plugin; | 4069 my_protocol = plugin; |
4070 yahoogaim_register_commands(); | 4070 yahoopurple_register_commands(); |
4071 yahoo_init_colorht(); | 4071 yahoo_init_colorht(); |
4072 | 4072 |
4073 gaim_signal_connect(gaim_get_core(), "uri-handler", plugin, | 4073 purple_signal_connect(purple_get_core(), "uri-handler", plugin, |
4074 GAIM_CALLBACK(yahoo_uri_handler), NULL); | 4074 PURPLE_CALLBACK(yahoo_uri_handler), NULL); |
4075 } | 4075 } |
4076 | 4076 |
4077 GAIM_INIT_PLUGIN(yahoo, init_plugin, info); | 4077 PURPLE_INIT_PLUGIN(yahoo, init_plugin, info); |