Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 9370:76f4bffcfb23
[gaim-migrate @ 10178]
I moved the #define to yahoo.h, and made some of the checks runtime, in
hopes of still supporting yahoo japan. I also made some things not show
up when using web messenger.
For some reason I can't log in to yahoo japan now either. weird.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Thu, 24 Jun 2004 03:55:54 +0000 |
parents | 241a799cc821 |
children | 30598cb2efb5 |
comparison
equal
deleted
inserted
replaced
9369:241a799cc821 | 9370:76f4bffcfb23 |
---|---|
18 * You should have received a copy of the GNU General Public License | 18 * You should have received a copy of the GNU General Public License |
19 * along with this program; if not, write to the Free Software | 19 * along with this program; if not, write to the Free Software |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 * | 21 * |
22 */ | 22 */ |
23 #define YAHOO_WEBMESSENGER | |
24 | 23 |
25 #include "internal.h" | 24 #include "internal.h" |
26 | 25 |
27 #include "account.h" | 26 #include "account.h" |
28 #include "accountopt.h" | 27 #include "accountopt.h" |
2108 | 2107 |
2109 yahoo_packet_free(pkt); | 2108 yahoo_packet_free(pkt); |
2110 } | 2109 } |
2111 } | 2110 } |
2112 | 2111 |
2113 #ifndef YAHOO_WEBMESSENGER | |
2114 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond) | 2112 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond) |
2115 { | 2113 { |
2116 GaimConnection *gc = data; | 2114 GaimConnection *gc = data; |
2117 struct yahoo_data *yd; | 2115 struct yahoo_data *yd; |
2118 struct yahoo_packet *pkt; | 2116 struct yahoo_packet *pkt; |
2137 | 2135 |
2138 yahoo_packet_free(pkt); | 2136 yahoo_packet_free(pkt); |
2139 | 2137 |
2140 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); | 2138 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc); |
2141 } | 2139 } |
2142 #endif | 2140 |
2143 | |
2144 #ifdef YAHOO_WEBMESSENGER | |
2145 static void yahoo_got_web_connected(gpointer data, gint source, GaimInputCondition cond) | 2141 static void yahoo_got_web_connected(gpointer data, gint source, GaimInputCondition cond) |
2146 { | 2142 { |
2147 GaimConnection *gc = data; | 2143 GaimConnection *gc = data; |
2148 struct yahoo_data *yd; | 2144 struct yahoo_data *yd; |
2149 struct yahoo_packet *pkt; | 2145 struct yahoo_packet *pkt; |
2320 gaim_connection_error(gc, _("Connection problem")); | 2316 gaim_connection_error(gc, _("Connection problem")); |
2321 return; | 2317 return; |
2322 } | 2318 } |
2323 } | 2319 } |
2324 | 2320 |
2325 #endif /* YAHOO_WEBMESSENGER */ | |
2326 | |
2327 #ifndef YAHOO_WEBMESSENGER | |
2328 static void yahoo_server_check(GaimAccount *account) | 2321 static void yahoo_server_check(GaimAccount *account) |
2329 { | 2322 { |
2330 const char *server; | 2323 const char *server; |
2331 | 2324 |
2332 server = gaim_account_get_string(account, "server", YAHOO_PAGER_HOST); | 2325 server = gaim_account_get_string(account, "server", YAHOO_PAGER_HOST); |
2342 | 2335 |
2343 buddyicon = gaim_account_get_buddy_icon(account); | 2336 buddyicon = gaim_account_get_buddy_icon(account); |
2344 yahoo_set_buddy_icon(gc, buddyicon); | 2337 yahoo_set_buddy_icon(gc, buddyicon); |
2345 } | 2338 } |
2346 | 2339 |
2347 #endif | |
2348 | 2340 |
2349 static void yahoo_login(GaimAccount *account) { | 2341 static void yahoo_login(GaimAccount *account) { |
2350 GaimConnection *gc = gaim_account_get_connection(account); | 2342 GaimConnection *gc = gaim_account_get_connection(account); |
2351 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); | 2343 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
2352 | 2344 |
2358 | 2350 |
2359 yd->fd = -1; | 2351 yd->fd = -1; |
2360 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); | 2352 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); |
2361 yd->confs = NULL; | 2353 yd->confs = NULL; |
2362 yd->conf_id = 2; | 2354 yd->conf_id = 2; |
2363 | |
2364 #ifndef YAHOO_WEBMESSENGER | |
2365 | 2355 |
2366 yahoo_server_check(account); | 2356 yahoo_server_check(account); |
2367 yahoo_picture_check(account); | 2357 yahoo_picture_check(account); |
2368 | 2358 |
2369 if (gaim_account_get_bool(account, "yahoojp", FALSE)) { | 2359 if (gaim_account_get_bool(account, "yahoojp", FALSE)) { |
2375 { | 2365 { |
2376 gaim_connection_error(gc, _("Connection problem")); | 2366 gaim_connection_error(gc, _("Connection problem")); |
2377 return; | 2367 return; |
2378 } | 2368 } |
2379 } else { | 2369 } else { |
2370 #ifndef YAHOO_WEBMESSENGER | |
2380 yd->jp = FALSE; | 2371 yd->jp = FALSE; |
2381 if (gaim_proxy_connect(account, | 2372 if (gaim_proxy_connect(account, |
2382 gaim_account_get_string(account, "server", YAHOO_PAGER_HOST), | 2373 gaim_account_get_string(account, "server", YAHOO_PAGER_HOST), |
2383 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), | 2374 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), |
2384 yahoo_got_connected, gc) != 0) | 2375 yahoo_got_connected, gc) != 0) |
2385 { | 2376 { |
2386 gaim_connection_error(gc, _("Connection problem")); | 2377 gaim_connection_error(gc, _("Connection problem")); |
2387 return; | 2378 return; |
2388 } | 2379 } |
2389 } | |
2390 #else | 2380 #else |
2391 gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE, | 2381 yd->wm = TRUE; |
2392 yahoo_login_page_cb, gc); | 2382 gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE, |
2383 yahoo_login_page_cb, gc); | |
2393 #endif | 2384 #endif |
2385 } | |
2386 | |
2394 | 2387 |
2395 } | 2388 } |
2396 | 2389 |
2397 static void yahoo_close(GaimConnection *gc) { | 2390 static void yahoo_close(GaimConnection *gc) { |
2398 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | 2391 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
2663 { | 2656 { |
2664 GList *m = NULL; | 2657 GList *m = NULL; |
2665 GaimBlistNodeAction *act; | 2658 GaimBlistNodeAction *act; |
2666 | 2659 |
2667 GaimConnection *gc = gaim_account_get_connection(buddy->account); | 2660 GaimConnection *gc = gaim_account_get_connection(buddy->account); |
2661 struct yahoo_data *yd = gc->proto_data; | |
2668 static char buf2[1024]; | 2662 static char buf2[1024]; |
2669 YahooFriend *f; | 2663 YahooFriend *f; |
2670 | 2664 |
2671 f = yahoo_friend_find(gc, buddy->name); | 2665 f = yahoo_friend_find(gc, buddy->name); |
2672 | 2666 |
2673 if (!f) { | 2667 if (!f && !yd->wm) { |
2674 act = gaim_blist_node_action_new(_("Add Buddy"), | 2668 act = gaim_blist_node_action_new(_("Add Buddy"), |
2675 yahoo_addbuddyfrommenu_cb, NULL); | 2669 yahoo_addbuddyfrommenu_cb, NULL); |
2676 m = g_list_append(m, act); | 2670 m = g_list_append(m, act); |
2677 | 2671 |
2678 return m; | 2672 return m; |
2679 | 2673 |
2680 } else if (f->status == YAHOO_STATUS_OFFLINE) { | 2674 } else if (f->status == YAHOO_STATUS_OFFLINE) { |
2681 return NULL; | 2675 return NULL; |
2682 } | 2676 } |
2683 | 2677 |
2684 act = gaim_blist_node_action_new(_("Join in Chat"), | 2678 if (!yd->wm) { |
2685 yahoo_chat_goto_menu, NULL); | 2679 act = gaim_blist_node_action_new(_("Join in Chat"), |
2686 m = g_list_append(m, act); | 2680 yahoo_chat_goto_menu, NULL); |
2681 m = g_list_append(m, act); | |
2682 } | |
2687 | 2683 |
2688 act = gaim_blist_node_action_new(_("Initiate Conference"), | 2684 act = gaim_blist_node_action_new(_("Initiate Conference"), |
2689 yahoo_initiate_conference, NULL); | 2685 yahoo_initiate_conference, NULL); |
2690 m = g_list_append(m, act); | 2686 m = g_list_append(m, act); |
2691 | 2687 |
2955 } | 2951 } |
2956 | 2952 |
2957 static GList *yahoo_away_states(GaimConnection *gc) | 2953 static GList *yahoo_away_states(GaimConnection *gc) |
2958 { | 2954 { |
2959 GList *m = NULL; | 2955 GList *m = NULL; |
2956 struct yahoo_data *yd = gc->proto_data; | |
2960 | 2957 |
2961 m = g_list_append(m, _("Available")); | 2958 m = g_list_append(m, _("Available")); |
2962 m = g_list_append(m, _("Be Right Back")); | 2959 if (!yd->wm) { |
2963 m = g_list_append(m, _("Busy")); | 2960 m = g_list_append(m, _("Be Right Back")); |
2964 m = g_list_append(m, _("Not At Home")); | 2961 m = g_list_append(m, _("Busy")); |
2965 m = g_list_append(m, _("Not At Desk")); | 2962 m = g_list_append(m, _("Not At Home")); |
2966 m = g_list_append(m, _("Not In Office")); | 2963 m = g_list_append(m, _("Not At Desk")); |
2967 m = g_list_append(m, _("On The Phone")); | 2964 m = g_list_append(m, _("Not In Office")); |
2968 m = g_list_append(m, _("On Vacation")); | 2965 m = g_list_append(m, _("On The Phone")); |
2969 m = g_list_append(m, _("Out To Lunch")); | 2966 m = g_list_append(m, _("On Vacation")); |
2970 m = g_list_append(m, _("Stepped Out")); | 2967 m = g_list_append(m, _("Out To Lunch")); |
2968 m = g_list_append(m, _("Stepped Out")); | |
2969 } | |
2971 m = g_list_append(m, _("Invisible")); | 2970 m = g_list_append(m, _("Invisible")); |
2972 m = g_list_append(m, GAIM_AWAY_CUSTOM); | 2971 if (!yd->wm) |
2972 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
2973 | 2973 |
2974 return m; | 2974 return m; |
2975 } | 2975 } |
2976 | 2976 |
2977 static void yahoo_keepalive(GaimConnection *gc) | 2977 static void yahoo_keepalive(GaimConnection *gc) |