void msn_slplink_destroy(MsnSlpLink *slplink) { MsnSession *session; #ifdef MSN_DEBUG_SLPLINK purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); #endif g_return_if_fail(slplink != NULL); if (slplink->swboard != NULL) slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); session = slplink->session; if (slplink->local_user != NULL) g_free(slplink->local_user); if (slplink->remote_user != NULL) g_free(slplink->remote_user); if (slplink->directconn != NULL) msn_directconn_destroy(slplink->directconn); while (slplink->slp_calls != NULL) msn_slp_call_destroy(slplink->slp_calls->data); g_queue_free(slplink->slp_msg_queue); session->slplinks = g_list_remove(session->slplinks, slplink); g_free(slplink); }
void msn_slplink_destroy(MsnSlpLink *slplink) { MsnSession *session; #ifdef PECAN_DEBUG_SLPLINK pecan_info ("slplink_destroy: slplink(%p)", slplink); #endif g_return_if_fail(slplink != NULL); if (slplink->swboard != NULL) slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); session = slplink->session; if (slplink->local_user != NULL) g_free(slplink->local_user); if (slplink->remote_user != NULL) g_free(slplink->remote_user); #ifdef MSN_DIRECTCONN if (slplink->directconn != NULL) msn_directconn_destroy(slplink->directconn); #endif /* MSN_DIRECTCONN */ while (slplink->slp_calls != NULL) msn_slp_call_destroy(slplink->slp_calls->data); session->slplinks = g_list_remove(session->slplinks, slplink); g_free(slplink); }
static void read_cb(gpointer data, gint source, GaimInputCondition cond) { MsnDirectConn* directconn; char *body; size_t len, body_len; gaim_debug_info("msn", "read_cb: %d, %d\n", source, cond); directconn = data; /* Let's read the length of the data. */ len = read(directconn->fd, &body_len, sizeof(body_len)); if (len <= 0) { /* ERROR */ gaim_debug_error("msn", "error reading\n"); msn_directconn_destroy(directconn); return; } body_len = GUINT32_FROM_LE(body_len); gaim_debug_info("msn", "body_len=%d\n", body_len); if (body_len <= 0) { /* ERROR */ gaim_debug_error("msn", "error reading\n"); msn_directconn_destroy(directconn); return; } body = g_try_malloc(body_len); if (body != NULL) { /* Let's read the data. */ len = read(directconn->fd, body, body_len); gaim_debug_info("msn", "len=%d\n", len); } else { gaim_debug_error("msn", "Failed to allocate memory for read\n"); len = 0; } if (len > 0) { MsnMessage *msg; #ifdef DEBUG_DC str = g_strdup_printf("/home/revo/msntest/r%.4d.bin", directconn->c); FILE *tf = g_fopen(str, "w"); fwrite(body, 1, len, tf); fclose(tf); g_free(str); #endif directconn->c++; msg = msn_message_new_msnslp(); msn_message_parse_slp_body(msg, body, body_len); msn_directconn_process_msg(directconn, msg); } else { /* ERROR */ gaim_debug_error("msn", "error reading\n"); msn_directconn_destroy(directconn); } }