| 474 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
474 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 475 { |
475 { |
| 476 GSList *l = pkt->hash; |
476 GSList *l = pkt->hash; |
| 477 |
477 |
| 478 PurpleAccount *account = purple_connection_get_account(gc); |
478 PurpleAccount *account = purple_connection_get_account(gc); |
| 479 struct yahoo_data *yd = gc->proto_data; |
479 YahooData *yd = gc->proto_data; |
| 480 GHashTable *ht; |
480 GHashTable *ht; |
| 481 char *norm_bud = NULL; |
481 char *norm_bud = NULL; |
| 482 char *temp = NULL; |
482 char *temp = NULL; |
| 483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
| 484 /* But what if you had no friends? */ |
484 /* But what if you had no friends? */ |
| 752 char *stat = NULL; |
752 char *stat = NULL; |
| 753 char *game = NULL; |
753 char *game = NULL; |
| 754 YahooFriend *f = NULL; |
754 YahooFriend *f = NULL; |
| 755 GSList *l = pkt->hash; |
755 GSList *l = pkt->hash; |
| 756 gint val_11 = 0; |
756 gint val_11 = 0; |
| 757 struct yahoo_data *yd = gc->proto_data; |
757 YahooData *yd = gc->proto_data; |
| 758 gboolean msn = FALSE; |
758 gboolean msn = FALSE; |
| 759 |
759 |
| 760 account = purple_connection_get_account(gc); |
760 account = purple_connection_get_account(gc); |
| 761 |
761 |
| 762 while (l) { |
762 while (l) { |
| 847 static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
847 static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 848 { |
848 { |
| 849 PurpleAccount *account; |
849 PurpleAccount *account; |
| 850 GSList *l = pkt->hash; |
850 GSList *l = pkt->hash; |
| 851 struct _yahoo_im *sms = NULL; |
851 struct _yahoo_im *sms = NULL; |
| 852 struct yahoo_data *yd; |
852 YahooData *yd; |
| 853 char *server_msg = NULL; |
853 char *server_msg = NULL; |
| 854 char *m; |
854 char *m; |
| 855 |
855 |
| 856 yd = gc->proto_data; |
856 yd = gc->proto_data; |
| 857 account = purple_connection_get_account(gc); |
857 account = purple_connection_get_account(gc); |
| 907 |
907 |
| 908 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
908 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
| 909 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
909 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
| 910 { |
910 { |
| 911 PurpleAccount *account; |
911 PurpleAccount *account; |
| 912 struct yahoo_data *yd = gc->proto_data; |
912 YahooData *yd = gc->proto_data; |
| 913 GSList *l = pkt->hash; |
913 GSList *l = pkt->hash; |
| 914 GSList *list = NULL; |
914 GSList *list = NULL; |
| 915 struct _yahoo_im *im = NULL; |
915 struct _yahoo_im *im = NULL; |
| 916 const char *imv = NULL; |
916 const char *imv = NULL; |
| 917 gint val_11 = 0; |
917 gint val_11 = 0; |
| 1140 static void |
1140 static void |
| 1141 yahoo_buddy_add_authorize_cb(gpointer data) |
1141 yahoo_buddy_add_authorize_cb(gpointer data) |
| 1142 { |
1142 { |
| 1143 struct yahoo_add_request *add_req = data; |
1143 struct yahoo_add_request *add_req = data; |
| 1144 struct yahoo_packet *pkt; |
1144 struct yahoo_packet *pkt; |
| 1145 struct yahoo_data *yd = add_req->gc->proto_data; |
1145 YahooData *yd = add_req->gc->proto_data; |
| 1146 const char *who = add_req->who; |
1146 const char *who = add_req->who; |
| 1147 |
1147 |
| 1148 if (add_req->protocol == 2) |
1148 if (add_req->protocol == 2) |
| 1149 who += 4; |
1149 who += 4; |
| 1150 |
1150 |
| 1163 } |
1163 } |
| 1164 |
1164 |
| 1165 static void |
1165 static void |
| 1166 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) |
1166 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) |
| 1167 { |
1167 { |
| 1168 struct yahoo_data *yd = add_req->gc->proto_data; |
1168 YahooData *yd = add_req->gc->proto_data; |
| 1169 struct yahoo_packet *pkt; |
1169 struct yahoo_packet *pkt; |
| 1170 char *encoded_msg = NULL; |
1170 char *encoded_msg = NULL; |
| 1171 const char *who = add_req->who; |
1171 const char *who = add_req->who; |
| 1172 |
1172 |
| 1173 if (add_req->protocol == 2) |
1173 if (add_req->protocol == 2) |
| 1522 } |
1522 } |
| 1523 |
1523 |
| 1524 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
1524 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 1525 { |
1525 { |
| 1526 PurpleAccount *account = purple_connection_get_account(gc); |
1526 PurpleAccount *account = purple_connection_get_account(gc); |
| 1527 struct yahoo_data *yd = gc->proto_data; |
1527 YahooData *yd = gc->proto_data; |
| 1528 const char *who = NULL; |
1528 const char *who = NULL; |
| 1529 const char *email = NULL; |
1529 const char *email = NULL; |
| 1530 const char *subj = NULL; |
1530 const char *subj = NULL; |
| 1531 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
1531 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
| 1532 int count = 0; |
1532 int count = 0; |
| 1606 *out = '\0'; |
1606 *out = '\0'; |
| 1607 } |
1607 } |
| 1608 |
1608 |
| 1609 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) |
1609 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) |
| 1610 { |
1610 { |
| 1611 struct yahoo_data *yd = gc->proto_data; |
1611 YahooData *yd = gc->proto_data; |
| 1612 PurpleAccount *account = purple_connection_get_account(gc); |
1612 PurpleAccount *account = purple_connection_get_account(gc); |
| 1613 const char *name = purple_normalize(account, purple_account_get_username(account)); |
1613 const char *name = purple_normalize(account, purple_account_get_username(account)); |
| 1614 PurpleCipher *md5_cipher; |
1614 PurpleCipher *md5_cipher; |
| 1615 PurpleCipherContext *md5_ctx; |
1615 PurpleCipherContext *md5_ctx; |
| 1616 guchar md5_digest[16]; |
1616 guchar md5_digest[16]; |
| 1649 |
1649 |
| 1650 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
1650 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
| 1651 { |
1651 { |
| 1652 struct yahoo_auth_data *auth_data = user_data; |
1652 struct yahoo_auth_data *auth_data = user_data; |
| 1653 PurpleConnection *gc = auth_data->gc; |
1653 PurpleConnection *gc = auth_data->gc; |
| 1654 struct yahoo_data *yd; |
1654 YahooData *yd; |
| 1655 gboolean try_login_on_error = FALSE; |
1655 gboolean try_login_on_error = FALSE; |
| 1656 |
1656 |
| 1657 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); |
1657 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); |
| 1658 |
1658 |
| 1659 if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
1659 if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 1660 g_free(auth_data->seed); |
1660 g_free(auth_data->seed); |
| 1661 g_free(auth_data); |
1661 g_free(auth_data); |
| 1662 g_return_if_reached(); |
1662 g_return_if_reached(); |
| 1663 } |
1663 } |
| 1664 |
1664 |
| 1665 yd = (struct yahoo_data *)gc->proto_data; |
1665 yd = (YahooData *)gc->proto_data; |
| 1666 |
1666 |
| 1667 if (error_message != NULL) { |
1667 if (error_message != NULL) { |
| 1668 purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); |
1668 purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); |
| 1669 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
1669 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
| 1670 g_free(auth_data->seed); |
1670 g_free(auth_data->seed); |
| 2024 } |
2024 } |
| 2025 |
2025 |
| 2026 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
2026 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2027 { |
2027 { |
| 2028 #ifdef TRY_WEBMESSENGER_LOGIN |
2028 #ifdef TRY_WEBMESSENGER_LOGIN |
| 2029 struct yahoo_data *yd = gc->proto_data; |
2029 YahooData *yd = gc->proto_data; |
| 2030 #endif /* TRY_WEBMESSENGER_LOGIN */ |
2030 #endif /* TRY_WEBMESSENGER_LOGIN */ |
| 2031 GSList *l = pkt->hash; |
2031 GSList *l = pkt->hash; |
| 2032 int err = 0; |
2032 int err = 0; |
| 2033 char *msg; |
2033 char *msg; |
| 2034 char *url = NULL; |
2034 char *url = NULL; |
| 2195 { |
2195 { |
| 2196 struct yahoo_p2p_data *p2p_data = value; |
2196 struct yahoo_p2p_data *p2p_data = value; |
| 2197 PurpleConnection *gc = user_data; |
2197 PurpleConnection *gc = user_data; |
| 2198 struct yahoo_packet *pkt_to_send; |
2198 struct yahoo_packet *pkt_to_send; |
| 2199 PurpleAccount *account; |
2199 PurpleAccount *account; |
| 2200 struct yahoo_data *yd = gc->proto_data; |
2200 YahooData *yd = gc->proto_data; |
| 2201 |
2201 |
| 2202 account = purple_connection_get_account(gc); |
2202 account = purple_connection_get_account(gc); |
| 2203 |
2203 |
| 2204 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
2204 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
| 2205 yahoo_packet_hash(pkt_to_send, "ssisi", |
2205 yahoo_packet_hash(pkt_to_send, "ssisi", |
| 2255 char *who = NULL; |
2255 char *who = NULL; |
| 2256 GSList *l = pkt->hash; |
2256 GSList *l = pkt->hash; |
| 2257 struct yahoo_packet *pkt_to_send; |
2257 struct yahoo_packet *pkt_to_send; |
| 2258 PurpleAccount *account; |
2258 PurpleAccount *account; |
| 2259 int val_13_to_send = 0; |
2259 int val_13_to_send = 0; |
| 2260 struct yahoo_data *yd; |
2260 YahooData *yd; |
| 2261 YahooFriend *f; |
2261 YahooFriend *f; |
| 2262 |
2262 |
| 2263 if(!(p2p_data = data)) |
2263 if(!(p2p_data = data)) |
| 2264 return ; |
2264 return ; |
| 2265 |
2265 |
| 2342 int pos = 0; |
2342 int pos = 0; |
| 2343 int pktlen; |
2343 int pktlen; |
| 2344 struct yahoo_packet *pkt; |
2344 struct yahoo_packet *pkt; |
| 2345 guchar *start = NULL; |
2345 guchar *start = NULL; |
| 2346 struct yahoo_p2p_data *p2p_data; |
2346 struct yahoo_p2p_data *p2p_data; |
| 2347 struct yahoo_data *yd; |
2347 YahooData *yd; |
| 2348 |
2348 |
| 2349 if(!(p2p_data = data)) |
2349 if(!(p2p_data = data)) |
| 2350 return ; |
2350 return ; |
| 2351 yd = p2p_data->gc->proto_data; |
2351 yd = p2p_data->gc->proto_data; |
| 2352 |
2352 |
| 2414 |
2414 |
| 2415 static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) |
2415 static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) |
| 2416 { |
2416 { |
| 2417 int acceptfd; |
2417 int acceptfd; |
| 2418 struct yahoo_p2p_data *p2p_data; |
2418 struct yahoo_p2p_data *p2p_data; |
| 2419 struct yahoo_data *yd; |
2419 YahooData *yd; |
| 2420 |
2420 |
| 2421 if(!(p2p_data = data)) |
2421 if(!(p2p_data = data)) |
| 2422 return ; |
2422 return ; |
| 2423 yd = p2p_data->gc->proto_data; |
2423 yd = p2p_data->gc->proto_data; |
| 2424 |
2424 |
| 2506 char temp_str[100]; |
2506 char temp_str[100]; |
| 2507 gchar *base64_ip = NULL; |
2507 gchar *base64_ip = NULL; |
| 2508 YahooFriend *f; |
2508 YahooFriend *f; |
| 2509 struct yahoo_packet *pkt; |
2509 struct yahoo_packet *pkt; |
| 2510 PurpleAccount *account; |
2510 PurpleAccount *account; |
| 2511 struct yahoo_data *yd = gc->proto_data; |
2511 YahooData *yd = gc->proto_data; |
| 2512 struct yahoo_p2p_data *p2p_data; |
2512 struct yahoo_p2p_data *p2p_data; |
| 2513 |
2513 |
| 2514 f = yahoo_friend_find(gc, who); |
2514 f = yahoo_friend_find(gc, who); |
| 2515 account = purple_connection_get_account(gc); |
2515 account = purple_connection_get_account(gc); |
| 2516 |
2516 |
| 2574 static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) |
2574 static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) |
| 2575 { |
2575 { |
| 2576 struct yahoo_p2p_data *p2p_data; |
2576 struct yahoo_p2p_data *p2p_data; |
| 2577 struct yahoo_packet *pkt_to_send; |
2577 struct yahoo_packet *pkt_to_send; |
| 2578 PurpleAccount *account; |
2578 PurpleAccount *account; |
| 2579 struct yahoo_data *yd; |
2579 YahooData *yd; |
| 2580 |
2580 |
| 2581 if(!(p2p_data = data)) |
2581 if(!(p2p_data = data)) |
| 2582 return ; |
2582 return ; |
| 2583 yd = p2p_data->gc->proto_data; |
2583 yd = p2p_data->gc->proto_data; |
| 2584 |
2584 |
| 2920 } |
2920 } |
| 2921 |
2921 |
| 2922 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
2922 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 2923 { |
2923 { |
| 2924 PurpleConnection *gc = data; |
2924 PurpleConnection *gc = data; |
| 2925 struct yahoo_data *yd = gc->proto_data; |
2925 YahooData *yd = gc->proto_data; |
| 2926 char buf[1024]; |
2926 char buf[1024]; |
| 2927 int len; |
2927 int len; |
| 2928 |
2928 |
| 2929 len = read(yd->fd, buf, sizeof(buf)); |
2929 len = read(yd->fd, buf, sizeof(buf)); |
| 2930 |
2930 |
| 3017 } |
3017 } |
| 3018 |
3018 |
| 3019 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
3019 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
| 3020 { |
3020 { |
| 3021 PurpleConnection *gc = data; |
3021 PurpleConnection *gc = data; |
| 3022 struct yahoo_data *yd; |
3022 YahooData *yd; |
| 3023 struct yahoo_packet *pkt; |
3023 struct yahoo_packet *pkt; |
| 3024 |
3024 |
| 3025 if (source < 0) { |
3025 if (source < 0) { |
| 3026 gchar *tmp; |
3026 gchar *tmp; |
| 3027 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
3027 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
| 3043 |
3043 |
| 3044 #ifdef TRY_WEBMESSENGER_LOGIN |
3044 #ifdef TRY_WEBMESSENGER_LOGIN |
| 3045 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
3045 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
| 3046 { |
3046 { |
| 3047 PurpleConnection *gc = data; |
3047 PurpleConnection *gc = data; |
| 3048 struct yahoo_data *yd; |
3048 YahooData *yd; |
| 3049 struct yahoo_packet *pkt; |
3049 struct yahoo_packet *pkt; |
| 3050 |
3050 |
| 3051 if (source < 0) { |
3051 if (source < 0) { |
| 3052 gchar *tmp; |
3052 gchar *tmp; |
| 3053 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
3053 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
| 3073 |
3073 |
| 3074 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
3074 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 3075 { |
3075 { |
| 3076 PurpleConnection *gc = data; |
3076 PurpleConnection *gc = data; |
| 3077 PurpleAccount *account = purple_connection_get_account(gc); |
3077 PurpleAccount *account = purple_connection_get_account(gc); |
| 3078 struct yahoo_data *yd = gc->proto_data; |
3078 YahooData *yd = gc->proto_data; |
| 3079 char bufread[2048], *i = bufread, *buf = bufread; |
3079 char bufread[2048], *i = bufread, *buf = bufread; |
| 3080 int len; |
3080 int len; |
| 3081 GString *s; |
3081 GString *s; |
| 3082 |
3082 |
| 3083 len = read(source, bufread, sizeof(bufread) - 1); |
3083 len = read(source, bufread, sizeof(bufread) - 1); |
| 3148 } |
3148 } |
| 3149 |
3149 |
| 3150 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
3150 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
| 3151 { |
3151 { |
| 3152 PurpleConnection *gc; |
3152 PurpleConnection *gc; |
| 3153 struct yahoo_data *yd; |
3153 YahooData *yd; |
| 3154 int written, remaining; |
3154 int written, remaining; |
| 3155 |
3155 |
| 3156 gc = data; |
3156 gc = data; |
| 3157 yd = gc->proto_data; |
3157 yd = gc->proto_data; |
| 3158 |
3158 |
| 3262 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
3262 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
| 3263 const gchar *url_text, size_t len, const gchar *error_message) |
3263 const gchar *url_text, size_t len, const gchar *error_message) |
| 3264 { |
3264 { |
| 3265 PurpleConnection *gc = (PurpleConnection *)user_data; |
3265 PurpleConnection *gc = (PurpleConnection *)user_data; |
| 3266 PurpleAccount *account = purple_connection_get_account(gc); |
3266 PurpleAccount *account = purple_connection_get_account(gc); |
| 3267 struct yahoo_data *yd = gc->proto_data; |
3267 YahooData *yd = gc->proto_data; |
| 3268 const char *sn = purple_account_get_username(account); |
3268 const char *sn = purple_account_get_username(account); |
| 3269 const char *pass = purple_connection_get_password(gc); |
3269 const char *pass = purple_connection_get_password(gc); |
| 3270 GHashTable *hash = yahoo_login_page_hash(url_text, len); |
3270 GHashTable *hash = yahoo_login_page_hash(url_text, len); |
| 3271 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
3271 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
| 3272 char md5[33], *hashp = md5, *chal; |
3272 char md5[33], *hashp = md5, *chal; |
| 3403 } |
3403 } |
| 3404 } |
3404 } |
| 3405 |
3405 |
| 3406 void yahoo_login(PurpleAccount *account) { |
3406 void yahoo_login(PurpleAccount *account) { |
| 3407 PurpleConnection *gc = purple_account_get_connection(account); |
3407 PurpleConnection *gc = purple_account_get_connection(account); |
| 3408 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
3408 YahooData *yd = gc->proto_data = g_new0(YahooData, 1); |
| 3409 PurpleStatus *status = purple_account_get_active_status(account); |
3409 PurpleStatus *status = purple_account_get_active_status(account); |
| 3410 const char *server = NULL; |
3410 const char *server = NULL; |
| 3411 int pager_port = 0; |
3411 int pager_port = 0; |
| 3412 |
3412 |
| 3413 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; |
3413 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; |
| 3548 |
3548 |
| 3549 const char *yahoo_list_emblem(PurpleBuddy *b) |
3549 const char *yahoo_list_emblem(PurpleBuddy *b) |
| 3550 { |
3550 { |
| 3551 PurpleAccount *account; |
3551 PurpleAccount *account; |
| 3552 PurpleConnection *gc; |
3552 PurpleConnection *gc; |
| 3553 struct yahoo_data *yd; |
3553 YahooData *yd; |
| 3554 YahooFriend *f; |
3554 YahooFriend *f; |
| 3555 PurplePresence *presence; |
3555 PurplePresence *presence; |
| 3556 |
3556 |
| 3557 if (!b || !(account = purple_buddy_get_account(b)) || |
3557 if (!b || !(account = purple_buddy_get_account(b)) || |
| 3558 !(gc = purple_account_get_connection(account)) || |
3558 !(gc = purple_account_get_connection(account)) || |
| 3648 static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
3648 static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
| 3649 |
3649 |
| 3650 PurpleBuddy *buddy; |
3650 PurpleBuddy *buddy; |
| 3651 PurpleConnection *gc; |
3651 PurpleConnection *gc; |
| 3652 |
3652 |
| 3653 struct yahoo_data *yd; |
3653 YahooData *yd; |
| 3654 const char *game; |
3654 const char *game; |
| 3655 char *game2; |
3655 char *game2; |
| 3656 char *t; |
3656 char *t; |
| 3657 char url[256]; |
3657 char url[256]; |
| 3658 YahooFriend *f; |
3658 YahooFriend *f; |
| 3659 |
3659 |
| 3660 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
3660 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 3661 |
3661 |
| 3662 buddy = (PurpleBuddy *) node; |
3662 buddy = (PurpleBuddy *) node; |
| 3663 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
3663 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
| 3664 yd = (struct yahoo_data *) gc->proto_data; |
3664 yd = (YahooData *) gc->proto_data; |
| 3665 |
3665 |
| 3666 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
3666 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
| 3667 if (!f) |
3667 if (!f) |
| 3668 return; |
3668 return; |
| 3669 |
3669 |
| 3816 } |
3816 } |
| 3817 |
3817 |
| 3818 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
3818 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
| 3819 GList *m = NULL; |
3819 GList *m = NULL; |
| 3820 PurpleMenuAction *act; |
3820 PurpleMenuAction *act; |
| 3821 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
3821 YahooData *yd = (YahooData *) gc->proto_data; |
| 3822 |
3822 |
| 3823 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
3823 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
| 3824 if (f->presence != YAHOO_PRESENCE_ONLINE) { |
3824 if (f->presence != YAHOO_PRESENCE_ONLINE) { |
| 3825 act = purple_menu_action_new(_("Appear Online"), |
3825 act = purple_menu_action_new(_("Appear Online"), |
| 3826 PURPLE_CALLBACK(yahoo_presence_settings), |
3826 PURPLE_CALLBACK(yahoo_presence_settings), |
| 3876 { |
3876 { |
| 3877 GList *m = NULL; |
3877 GList *m = NULL; |
| 3878 PurpleMenuAction *act; |
3878 PurpleMenuAction *act; |
| 3879 |
3879 |
| 3880 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
3880 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
| 3881 struct yahoo_data *yd = gc->proto_data; |
3881 YahooData *yd = gc->proto_data; |
| 3882 static char buf2[1024]; |
3882 static char buf2[1024]; |
| 3883 YahooFriend *f; |
3883 YahooFriend *f; |
| 3884 |
3884 |
| 3885 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
3885 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
| 3886 |
3886 |
| 3957 } |
3957 } |
| 3958 } |
3958 } |
| 3959 |
3959 |
| 3960 static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) |
3960 static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) |
| 3961 { |
3961 { |
| 3962 struct yahoo_data *yd = gc->proto_data; |
3962 YahooData *yd = gc->proto_data; |
| 3963 const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; |
3963 const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; |
| 3964 |
3964 |
| 3965 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); |
3965 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); |
| 3966 yahoo_packet_hash_str(pkt, 3, name); |
3966 yahoo_packet_hash_str(pkt, 3, name); |
| 3967 yahoo_packet_send_and_free(pkt, yd); |
3967 yahoo_packet_send_and_free(pkt, yd); |
| 3974 const gchar *token, size_t len, const gchar *error_message) |
3974 const gchar *token, size_t len, const gchar *error_message) |
| 3975 { |
3975 { |
| 3976 PurpleConnection *gc = user_data; |
3976 PurpleConnection *gc = user_data; |
| 3977 gboolean set_cookie = FALSE; |
3977 gboolean set_cookie = FALSE; |
| 3978 gchar *url; |
3978 gchar *url; |
| 3979 struct yahoo_data *yd = gc->proto_data; |
3979 YahooData *yd = gc->proto_data; |
| 3980 |
3980 |
| 3981 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
3981 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
| 3982 |
3982 |
| 3983 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
3983 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
| 3984 |
3984 |
| 4010 { |
4010 { |
| 4011 /* Setup a cookie that can be used by the browser */ |
4011 /* Setup a cookie that can be used by the browser */ |
| 4012 /* XXX I have no idea how this will work with Yahoo! Japan. */ |
4012 /* XXX I have no idea how this will work with Yahoo! Japan. */ |
| 4013 |
4013 |
| 4014 PurpleConnection *gc = action->context; |
4014 PurpleConnection *gc = action->context; |
| 4015 struct yahoo_data *yd = gc->proto_data; |
4015 YahooData *yd = gc->proto_data; |
| 4016 |
4016 |
| 4017 PurpleUtilFetchUrlData *url_data; |
4017 PurpleUtilFetchUrlData *url_data; |
| 4018 const char* base_url = "http://login.yahoo.com"; |
4018 const char* base_url = "http://login.yahoo.com"; |
| 4019 /* use whole URL if using HTTP Proxy */ |
4019 /* use whole URL if using HTTP Proxy */ |
| 4020 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
4020 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
| 4054 { |
4054 { |
| 4055 PurpleRequestFields *fields; |
4055 PurpleRequestFields *fields; |
| 4056 PurpleRequestFieldGroup *group; |
4056 PurpleRequestFieldGroup *group; |
| 4057 PurpleRequestField *field; |
4057 PurpleRequestField *field; |
| 4058 PurpleConnection *gc = (PurpleConnection *) action->context; |
4058 PurpleConnection *gc = (PurpleConnection *) action->context; |
| 4059 struct yahoo_data *yd = purple_connection_get_protocol_data(gc); |
4059 YahooData *yd = purple_connection_get_protocol_data(gc); |
| 4060 const char *name = purple_connection_get_display_name(gc); |
4060 const char *name = purple_connection_get_display_name(gc); |
| 4061 int iter; |
4061 int iter; |
| 4062 |
4062 |
| 4063 fields = purple_request_fields_new(); |
4063 fields = purple_request_fields_new(); |
| 4064 group = purple_request_field_group_new(NULL); |
4064 group = purple_request_field_group_new(NULL); |
| 4124 static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
4124 static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
| 4125 const gchar *webdata, size_t len, const gchar *error_message) |
4125 const gchar *webdata, size_t len, const gchar *error_message) |
| 4126 { |
4126 { |
| 4127 struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; |
4127 struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; |
| 4128 PurpleConnection *gc = sms_cb_data->gc; |
4128 PurpleConnection *gc = sms_cb_data->gc; |
| 4129 struct yahoo_data *yd = gc->proto_data; |
4129 YahooData *yd = gc->proto_data; |
| 4130 char *mobile_no = NULL; |
4130 char *mobile_no = NULL; |
| 4131 char *status = NULL; |
4131 char *status = NULL; |
| 4132 char *carrier = NULL; |
4132 char *carrier = NULL; |
| 4133 PurpleAccount *account = purple_connection_get_account(gc); |
4133 PurpleAccount *account = purple_connection_get_account(gc); |
| 4134 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
4134 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
| 4175 } |
4175 } |
| 4176 } |
4176 } |
| 4177 |
4177 |
| 4178 static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) |
4178 static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) |
| 4179 { |
4179 { |
| 4180 struct yahoo_data *yd = gc->proto_data; |
4180 YahooData *yd = gc->proto_data; |
| 4181 PurpleUtilFetchUrlData *url_data; |
4181 PurpleUtilFetchUrlData *url_data; |
| 4182 struct yahoo_sms_carrier_cb_data *sms_cb_data; |
4182 struct yahoo_sms_carrier_cb_data *sms_cb_data; |
| 4183 char *validate_request_str = NULL; |
4183 char *validate_request_str = NULL; |
| 4184 char *request = NULL; |
4184 char *request = NULL; |
| 4185 gboolean use_whole_url = FALSE; |
4185 gboolean use_whole_url = FALSE; |
| 4233 } |
4233 } |
| 4234 } |
4234 } |
| 4235 |
4235 |
| 4236 int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
4236 int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
| 4237 { |
4237 { |
| 4238 struct yahoo_data *yd = gc->proto_data; |
4238 YahooData *yd = gc->proto_data; |
| 4239 struct yahoo_packet *pkt = NULL; |
4239 struct yahoo_packet *pkt = NULL; |
| 4240 char *msg = yahoo_html_to_codes(what); |
4240 char *msg = yahoo_html_to_codes(what); |
| 4241 char *msg2; |
4241 char *msg2; |
| 4242 gboolean utf8 = TRUE; |
4242 gboolean utf8 = TRUE; |
| 4243 PurpleWhiteboard *wb; |
4243 PurpleWhiteboard *wb; |
| 4384 return ret; |
4384 return ret; |
| 4385 } |
4385 } |
| 4386 |
4386 |
| 4387 unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
4387 unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
| 4388 { |
4388 { |
| 4389 struct yahoo_data *yd = gc->proto_data; |
4389 YahooData *yd = gc->proto_data; |
| 4390 struct yahoo_p2p_data *p2p_data; |
4390 struct yahoo_p2p_data *p2p_data; |
| 4391 gboolean msn = !g_strncasecmp(who, "msn/", 4); |
4391 gboolean msn = !g_strncasecmp(who, "msn/", 4); |
| 4392 struct yahoo_packet *pkt = NULL; |
4392 struct yahoo_packet *pkt = NULL; |
| 4393 |
4393 |
| 4394 /* Don't do anything if sms is being typed */ |
4394 /* Don't do anything if sms is being typed */ |
| 4429 |
4429 |
| 4430 void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
4430 void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
| 4431 { |
4431 { |
| 4432 PurpleConnection *gc; |
4432 PurpleConnection *gc; |
| 4433 PurplePresence *presence; |
4433 PurplePresence *presence; |
| 4434 struct yahoo_data *yd; |
4434 YahooData *yd; |
| 4435 struct yahoo_packet *pkt; |
4435 struct yahoo_packet *pkt; |
| 4436 int old_status; |
4436 int old_status; |
| 4437 const char *msg = NULL; |
4437 const char *msg = NULL; |
| 4438 char *tmp = NULL; |
4438 char *tmp = NULL; |
| 4439 char *conv_msg = NULL; |
4439 char *conv_msg = NULL; |
| 4442 if (!purple_status_is_active(status)) |
4442 if (!purple_status_is_active(status)) |
| 4443 return; |
4443 return; |
| 4444 |
4444 |
| 4445 gc = purple_account_get_connection(account); |
4445 gc = purple_account_get_connection(account); |
| 4446 presence = purple_status_get_presence(status); |
4446 presence = purple_status_get_presence(status); |
| 4447 yd = (struct yahoo_data *)gc->proto_data; |
4447 yd = (YahooData *)gc->proto_data; |
| 4448 old_status = yd->current_status; |
4448 old_status = yd->current_status; |
| 4449 |
4449 |
| 4450 yd->current_status = get_yahoo_status_from_purple_status(status); |
4450 yd->current_status = get_yahoo_status_from_purple_status(status); |
| 4451 |
4451 |
| 4452 if (yd->current_status == YAHOO_STATUS_CUSTOM) |
4452 if (yd->current_status == YAHOO_STATUS_CUSTOM) |
| 4504 } |
4504 } |
| 4505 } |
4505 } |
| 4506 |
4506 |
| 4507 void yahoo_set_idle(PurpleConnection *gc, int idle) |
4507 void yahoo_set_idle(PurpleConnection *gc, int idle) |
| 4508 { |
4508 { |
| 4509 struct yahoo_data *yd = gc->proto_data; |
4509 YahooData *yd = gc->proto_data; |
| 4510 struct yahoo_packet *pkt = NULL; |
4510 struct yahoo_packet *pkt = NULL; |
| 4511 char *msg = NULL, *msg2 = NULL; |
4511 char *msg = NULL, *msg2 = NULL; |
| 4512 PurpleStatus *status = NULL; |
4512 PurpleStatus *status = NULL; |
| 4513 |
4513 |
| 4514 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
4514 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
| 4610 } |
4610 } |
| 4611 |
4611 |
| 4612 void yahoo_keepalive(PurpleConnection *gc) |
4612 void yahoo_keepalive(PurpleConnection *gc) |
| 4613 { |
4613 { |
| 4614 struct yahoo_packet *pkt; |
4614 struct yahoo_packet *pkt; |
| 4615 struct yahoo_data *yd = gc->proto_data; |
4615 YahooData *yd = gc->proto_data; |
| 4616 time_t now = time(NULL); |
4616 time_t now = time(NULL); |
| 4617 |
4617 |
| 4618 /* We're only allowed to send a ping once an hour or the servers will boot us */ |
4618 /* We're only allowed to send a ping once an hour or the servers will boot us */ |
| 4619 if ((now - yd->last_ping) >= PING_TIMEOUT) { |
4619 if ((now - yd->last_ping) >= PING_TIMEOUT) { |
| 4620 yd->last_ping = now; |
4620 yd->last_ping = now; |
| 4643 |
4643 |
| 4644 } |
4644 } |
| 4645 |
4645 |
| 4646 void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) |
4646 void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) |
| 4647 { |
4647 { |
| 4648 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
4648 YahooData *yd = (YahooData *)gc->proto_data; |
| 4649 struct yahoo_packet *pkt; |
4649 struct yahoo_packet *pkt; |
| 4650 const char *group = NULL; |
4650 const char *group = NULL; |
| 4651 char *group2; |
4651 char *group2; |
| 4652 YahooFriend *f; |
4652 YahooFriend *f; |
| 4653 const char *bname; |
4653 const char *bname; |
| 4707 g_free(group2); |
4707 g_free(group2); |
| 4708 } |
4708 } |
| 4709 |
4709 |
| 4710 void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
4710 void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 4711 { |
4711 { |
| 4712 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
4712 YahooData *yd = (YahooData *)gc->proto_data; |
| 4713 struct yahoo_packet *pkt; |
4713 struct yahoo_packet *pkt; |
| 4714 GSList *buddies, *l; |
4714 GSList *buddies, *l; |
| 4715 PurpleGroup *g; |
4715 PurpleGroup *g; |
| 4716 gboolean remove = TRUE; |
4716 gboolean remove = TRUE; |
| 4717 char *cg; |
4717 char *cg; |
| 4755 yahoo_packet_send_and_free(pkt, yd); |
4755 yahoo_packet_send_and_free(pkt, yd); |
| 4756 g_free(cg); |
4756 g_free(cg); |
| 4757 } |
4757 } |
| 4758 |
4758 |
| 4759 void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
4759 void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
| 4760 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
4760 YahooData *yd = (YahooData *)gc->proto_data; |
| 4761 struct yahoo_packet *pkt; |
4761 struct yahoo_packet *pkt; |
| 4762 |
4762 |
| 4763 if (!yd->logged_in) |
4763 if (!yd->logged_in) |
| 4764 return; |
4764 return; |
| 4765 |
4765 |
| 4771 7, who, 13, "1"); |
4771 7, who, 13, "1"); |
| 4772 yahoo_packet_send_and_free(pkt, yd); |
4772 yahoo_packet_send_and_free(pkt, yd); |
| 4773 } |
4773 } |
| 4774 |
4774 |
| 4775 void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
4775 void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
| 4776 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
4776 YahooData *yd = (YahooData *)gc->proto_data; |
| 4777 struct yahoo_packet *pkt; |
4777 struct yahoo_packet *pkt; |
| 4778 |
4778 |
| 4779 if (!yd->logged_in) |
4779 if (!yd->logged_in) |
| 4780 return; |
4780 return; |
| 4781 |
4781 |
| 4812 } |
4812 } |
| 4813 |
4813 |
| 4814 void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
4814 void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
| 4815 const char *old_group, const char *new_group) |
4815 const char *old_group, const char *new_group) |
| 4816 { |
4816 { |
| 4817 struct yahoo_data *yd = gc->proto_data; |
4817 YahooData *yd = gc->proto_data; |
| 4818 struct yahoo_packet *pkt; |
4818 struct yahoo_packet *pkt; |
| 4819 char *gpn, *gpo; |
4819 char *gpn, *gpo; |
| 4820 YahooFriend *f = yahoo_friend_find(gc, who); |
4820 YahooFriend *f = yahoo_friend_find(gc, who); |
| 4821 gboolean msn = FALSE; |
4821 gboolean msn = FALSE; |
| 4822 const char *temp = NULL; |
4822 const char *temp = NULL; |
| 4861 } |
4861 } |
| 4862 |
4862 |
| 4863 void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
4863 void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
| 4864 PurpleGroup *group, GList *moved_buddies) |
4864 PurpleGroup *group, GList *moved_buddies) |
| 4865 { |
4865 { |
| 4866 struct yahoo_data *yd = gc->proto_data; |
4866 YahooData *yd = gc->proto_data; |
| 4867 struct yahoo_packet *pkt; |
4867 struct yahoo_packet *pkt; |
| 4868 char *gpn, *gpo; |
4868 char *gpn, *gpo; |
| 4869 |
4869 |
| 4870 gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); |
4870 gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); |
| 4871 gpo = yahoo_string_encode(gc, old_name, NULL); |
4871 gpo = yahoo_string_encode(gc, old_name, NULL); |
| 4901 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, |
4901 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, |
| 4902 char **args, char **error, void *data) |
4902 char **args, char **error, void *data) |
| 4903 { |
4903 { |
| 4904 GHashTable *comp; |
4904 GHashTable *comp; |
| 4905 PurpleConnection *gc; |
4905 PurpleConnection *gc; |
| 4906 struct yahoo_data *yd; |
4906 YahooData *yd; |
| 4907 int id; |
4907 int id; |
| 4908 |
4908 |
| 4909 if (!args || !args[0]) |
4909 if (!args || !args[0]) |
| 4910 return PURPLE_CMD_RET_FAILED; |
4910 return PURPLE_CMD_RET_FAILED; |
| 4911 |
4911 |