Exemplo n.º 1
0
void
msn_session_destroy(MsnSession *session)
{
	g_return_if_fail(session != NULL);

	session->destroying = TRUE;

	while (session->url_datas) {
		purple_util_fetch_url_cancel(session->url_datas->data);
		session->url_datas = g_slist_delete_link(session->url_datas, session->url_datas);
	}

	if (session->connected)
		msn_session_disconnect(session);

	if (session->soap_cleanup_handle)
		purple_timeout_remove(session->soap_cleanup_handle);

	if (session->soap_table != NULL)
		g_hash_table_destroy(session->soap_table);

	while (session->slplinks != NULL)
		msn_slplink_unref(session->slplinks->data);

	while (session->switches != NULL)
		msn_switchboard_destroy(session->switches->data);

	if (session->oim != NULL)
		msn_oim_destroy(session->oim);

	if (session->nexus != NULL)
		msn_nexus_destroy(session->nexus);

	if (session->user != NULL)
		msn_user_unref(session->user);

	if (session->notification != NULL)
		msn_notification_destroy(session->notification);

	msn_userlist_destroy(session->userlist);

	g_free(session->psm);
	g_free(session->guid);
	g_free(session->abch_cachekey);
#if 0
	g_free(session->blocked_text);
#endif

	g_free(session->passport_info.sid);
	g_free(session->passport_info.mspauth);
	g_free(session->passport_info.client_ip);
	g_free(session->passport_info.mail_url);

	g_free(session);
}
Exemplo n.º 2
0
void
msn_page_destroy(MsnPage *page)
{
	g_return_if_fail(page != NULL);

	if (page->sender != NULL)
		msn_user_unref(page->sender);

	if (page->receiver != NULL)
		msn_user_unref(page->receiver);

	if (page->body != NULL)
		g_free(page->body);

	if (page->from_location != NULL)
		g_free(page->from_location);

	if (page->from_phone != NULL)
		g_free(page->from_phone);

	g_free(page);
}
Exemplo n.º 3
0
void
msn_session_destroy(MsnSession *session)
{
	g_return_if_fail(session != NULL);

	session->destroying = TRUE;

	purple_http_connection_set_destroy(session->http_reqs);

	if (session->connected)
		msn_session_disconnect(session);

	msn_soap_service_destroy(session->soap);

	while (session->slplinks != NULL)
		msn_slplink_unref(session->slplinks->data);

	while (session->switches != NULL)
		msn_switchboard_destroy(session->switches->data);

	if (session->oim != NULL)
		msn_oim_destroy(session->oim);

	if (session->nexus != NULL)
		msn_nexus_destroy(session->nexus);

	if (session->user != NULL)
		msn_user_unref(session->user);

	if (session->notification != NULL)
		msn_notification_destroy(session->notification);

	msn_userlist_destroy(session->userlist);

	g_free(session->psm);
	g_free(session->guid);
	g_free(session->abch_cachekey);
#if 0
	g_free(session->blocked_text);
#endif

	g_free(session->passport_info.sid);
	g_free(session->passport_info.mspauth);
	g_free(session->passport_info.client_ip);
	g_free(session->passport_info.mail_url);

	g_free(session);
}
Exemplo n.º 4
0
void
msn_switchboard_destroy(MsnSwitchBoard *swboard)
{
	MsnSession *session;
	MsnMessage *msg;
	GList *l;

	if (purple_debug_is_verbose())
		purple_debug_info("msn", "switchboard destroy: swboard(%p)\n", swboard);

	g_return_if_fail(swboard != NULL);

	if (swboard->destroying)
		return;

	swboard->destroying = TRUE;

	if (swboard->reconn_timeout_h > 0)
		purple_timeout_remove(swboard->reconn_timeout_h);

	/* If it linked us is because its looking for trouble */
	while (swboard->slplinks != NULL) {
		MsnSlpLink *slplink = swboard->slplinks->data;

		swboard->slplinks = g_list_remove(swboard->slplinks, slplink);

		/* Destroy only those slplinks which use the switchboard */
		if (slplink->dc == NULL)
			msn_slplink_unref(slplink);
		else {
			swboard->slplinks = g_list_remove(swboard->slplinks, slplink);
			slplink->swboard = NULL;
		}
	}

	/* Destroy the message queue */
	while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL)
	{
		if (swboard->error != MSN_SB_ERROR_NONE)
		{
			/* The messages could not be sent due to a switchboard error */
			msg_error_helper(swboard->cmdproc, msg,
							 MSN_MSG_ERROR_SB);
		}
		msn_message_unref(msg);
	}

	g_queue_free(swboard->msg_queue);

	/* msg_error_helper will both remove the msg from ack_list and
	   unref it, so we don't need to do either here */
	while ((l = swboard->ack_list) != NULL)
		msg_error_helper(swboard->cmdproc, l->data, MSN_MSG_ERROR_SB);

	g_free(swboard->im_user);
	g_free(swboard->auth_key);
	g_free(swboard->session_id);

	for (; swboard->users; swboard->users = g_list_delete_link(swboard->users, swboard->users))
		msn_user_unref(swboard->users->data);

	session = swboard->session;
	session->switches = g_list_remove(session->switches, swboard);

	for (l = session->slplinks; l; l = l->next) {
		MsnSlpLink *slplink = l->data;
		if (slplink->swboard == swboard) slplink->swboard = NULL;
	}

#if 0
	/* This should never happen or we are in trouble. */
	if (swboard->servconn != NULL)
		msn_servconn_destroy(swboard->servconn);
#endif

	swboard->cmdproc->data = NULL;

	msn_servconn_set_disconnect_cb(swboard->servconn, NULL);

	msn_servconn_destroy(swboard->servconn);

	g_free(swboard);
}