Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/gg.c @ 32774:f236f3fce0d8
GG: Move the "inpa" input watcher into protocol_data.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 18 Oct 2011 21:27:51 +0000 |
parents | 2ec94166be43 |
children | cb486df263ef |
comparison
equal
deleted
inserted
replaced
32773:c2dcb6d3b246 | 32774:f236f3fce0d8 |
---|---|
1972 } | 1972 } |
1973 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); | 1973 purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
1974 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", | 1974 purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
1975 info->session->check, info->session->state); | 1975 info->session->check, info->session->state); |
1976 | 1976 |
1977 purple_input_remove(gc->inpa); | 1977 purple_input_remove(info->inpa); |
1978 info->inpa = 0; | |
1978 | 1979 |
1979 /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ | 1980 /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ |
1980 if (info->session->fd >= 0) | 1981 if (info->session->fd >= 0) |
1981 gc->inpa = purple_input_add(info->session->fd, | 1982 info->inpa = purple_input_add(info->session->fd, |
1982 (info->session->check == 1) ? PURPLE_INPUT_WRITE : | 1983 (info->session->check == 1) ? PURPLE_INPUT_WRITE : |
1983 PURPLE_INPUT_READ, | 1984 PURPLE_INPUT_READ, |
1984 ggp_async_login_handler, gc); | 1985 ggp_async_login_handler, gc); |
1985 | 1986 |
1986 switch (ev->type) { | 1987 switch (ev->type) { |
1989 purple_debug_info("gg", "GG_EVENT_NONE\n"); | 1990 purple_debug_info("gg", "GG_EVENT_NONE\n"); |
1990 break; | 1991 break; |
1991 case GG_EVENT_CONN_SUCCESS: | 1992 case GG_EVENT_CONN_SUCCESS: |
1992 { | 1993 { |
1993 purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); | 1994 purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); |
1994 purple_input_remove(gc->inpa); | 1995 purple_input_remove(info->inpa); |
1995 gc->inpa = purple_input_add(info->session->fd, | 1996 info->inpa = purple_input_add(info->session->fd, |
1996 PURPLE_INPUT_READ, | 1997 PURPLE_INPUT_READ, |
1997 ggp_callback_recv, gc); | 1998 ggp_callback_recv, gc); |
1998 | 1999 |
1999 ggp_buddylist_send(gc); | 2000 ggp_buddylist_send(gc); |
2000 purple_connection_update_progress(gc, _("Connected"), 1, 2); | 2001 purple_connection_update_progress(gc, _("Connected"), 1, 2); |
2001 purple_connection_set_state(gc, PURPLE_CONNECTED); | 2002 purple_connection_set_state(gc, PURPLE_CONNECTED); |
2002 } | 2003 } |
2003 break; | 2004 break; |
2004 case GG_EVENT_CONN_FAILED: | 2005 case GG_EVENT_CONN_FAILED: |
2005 purple_input_remove(gc->inpa); | 2006 purple_input_remove(info->inpa); |
2006 gc->inpa = 0; | 2007 info->inpa = 0; |
2007 purple_debug_info("gg", "Connection failure: %d\n", | 2008 purple_debug_info("gg", "Connection failure: %d\n", |
2008 ev->event.failure); | 2009 ev->event.failure); |
2009 switch (ev->event.failure) { | 2010 switch (ev->event.failure) { |
2010 case GG_FAILURE_RESOLVING: | 2011 case GG_FAILURE_RESOLVING: |
2011 purple_connection_error(gc, | 2012 purple_connection_error(gc, |
2363 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 2364 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
2364 _("Connection failed")); | 2365 _("Connection failed")); |
2365 g_free(glp); | 2366 g_free(glp); |
2366 return; | 2367 return; |
2367 } | 2368 } |
2368 gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, | 2369 info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, |
2369 ggp_async_login_handler, gc); | 2370 ggp_async_login_handler, gc); |
2370 } | 2371 } |
2371 | 2372 |
2372 static void ggp_close(PurpleConnection *gc) | 2373 static void ggp_close(PurpleConnection *gc) |
2373 { | 2374 { |
2399 purple_notify_close_with_handle(gc); | 2400 purple_notify_close_with_handle(gc); |
2400 | 2401 |
2401 ggp_search_destroy(info->searches); | 2402 ggp_search_destroy(info->searches); |
2402 g_list_free(info->pending_richtext_messages); | 2403 g_list_free(info->pending_richtext_messages); |
2403 g_hash_table_destroy(info->pending_images); | 2404 g_hash_table_destroy(info->pending_images); |
2405 | |
2406 if (info->inpa > 0) | |
2407 purple_input_remove(info->inpa); | |
2408 | |
2409 purple_connection_set_protocol_data(gc, NULL); | |
2404 g_free(info); | 2410 g_free(info); |
2405 purple_connection_set_protocol_data(gc, NULL); | 2411 } |
2406 } | |
2407 | |
2408 if (gc->inpa > 0) | |
2409 purple_input_remove(gc->inpa); | |
2410 | 2412 |
2411 purple_debug_info("gg", "Connection closed.\n"); | 2413 purple_debug_info("gg", "Connection closed.\n"); |
2412 } | 2414 } |
2413 | 2415 |
2414 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, | 2416 static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, |