Beispiel #1
0
void
msn_session_destroy (MsnSession *session)
{
    if (!session)
        return;

    pn_oim_session_free (session->oim_session);

    purple_signal_disconnect (purple_conversations_get_handle(), "conversation-created",
                              session, PURPLE_CALLBACK (conversation_created_cb));

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

#if defined(PECAN_CVR)
    g_hash_table_destroy (session->links);
#endif /* defined(PECAN_CVR) */

    msn_notification_destroy (session->notification);

    pn_dp_manager_free (session->dp_manager);

    g_hash_table_destroy (session->conversations);
    g_hash_table_destroy (session->chats);

    pn_contactlist_destroy (session->contactlist);

    g_free (session->passport_info.kv);
    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->passport_cookie.t);
    g_free (session->passport_cookie.p);

    if (session->autoupdate_tune.timer)
        g_source_remove (session->autoupdate_tune.timer);

    if (session->sync)
        msn_sync_destroy (session->sync);

    if (session->nexus)
        msn_nexus_destroy (session->nexus);

    pn_contact_free (session->user);

    g_hash_table_destroy (session->config);

    g_free (session->username);
    g_free (session->password);

#ifdef INTERNAL_MAINLOOP
    purple_timeout_remove (session->g_main_loop_timer);
    g_main_loop_unref (session->g_main_loop);
#endif

    g_free (session);
}
Beispiel #2
0
void
msn_session_destroy (MsnSession *session)
{
    if (!session)
        return;

    pn_oim_session_free (session->oim_session);
    pn_service_session_free (session->service_session);
    pn_roaming_session_free (session->roaming_session);

    g_free (session->cid);
    g_free (session->machineguid);

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

#if defined(PECAN_CVR)
    g_hash_table_destroy (session->links);
#endif /* defined(PECAN_CVR) */

    msn_notification_destroy (session->notification);

    pn_dp_manager_free (session->dp_manager);

    g_hash_table_destroy (session->conversations);
    g_hash_table_destroy (session->chats);

    pn_contactlist_destroy (session->contactlist);

    g_free (session->passport_info.kv);
    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->passport_cookie.t);
    g_free (session->passport_cookie.p);

    if (session->autoupdate_tune.timer)
        g_source_remove (session->autoupdate_tune.timer);

    if (session->auth)
        pn_auth_free (session->auth);

    pn_contact_free (session->user);

    g_hash_table_destroy (session->config);

    g_free (session->username);
    g_free (session->password);

#ifdef INTERNAL_MAINLOOP
    purple_timeout_remove (session->g_main_loop_timer);
    g_main_loop_unref (session->g_main_loop);
#endif

    g_free (session);
}
Beispiel #3
0
void
msn_session_set_error (MsnSession *session,
                       MsnErrorType error,
                       const char *info)
{
    PurpleAccount *account;
    PurpleConnection *connection;
    char *msg;

    account = msn_session_get_user_data (session);
    connection = purple_account_get_connection (account);

    switch (error)
    {
        case MSN_ERROR_SERVCONN:
            msg = g_strdup (info);
            break;
        case MSN_ERROR_UNSUPPORTED_PROTOCOL:
            msg = g_strdup (_("Our protocol is not supported by the "
                              "server."));
            break;
        case MSN_ERROR_HTTP_MALFORMED:
            msg = g_strdup (_("Error parsing HTTP."));
            break;
        case MSN_ERROR_SIGN_OTHER:
            connection->wants_to_die = TRUE;
            msg = g_strdup (_("You have signed on from another location."));
            break;
        case MSN_ERROR_SERV_UNAVAILABLE:
            msg = g_strdup (_("The MSN servers are temporarily "
                              "unavailable. Please wait and try "
                              "again."));
            break;
        case MSN_ERROR_SERV_DOWN:
            msg = g_strdup (_("The MSN servers are going down "
                              "temporarily."));
            break;
        case MSN_ERROR_AUTH:
            connection->wants_to_die = TRUE;
            msg = g_strdup_printf (_("Unable to authenticate: %s"),
                                   info ? info : _("Unknown error"));
            break;
        case MSN_ERROR_BAD_BLIST:
            msg = g_strdup (_("Your MSN buddy list is temporarily "
                              "unavailable. Please wait and try "
                              "again."));
            break;
        default:
            msg = g_strdup (_("Unknown error."));
            break;
    }

    msn_session_disconnect (session);

    purple_connection_error (connection, msg);

    g_free (msg);
}
Beispiel #4
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);
}
Beispiel #5
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);
}
Beispiel #6
0
void
msn_session_destroy(MsnSession *session)
{
	g_return_if_fail(session != NULL);

	session->destroying = TRUE;

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

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

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

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

	msn_userlist_destroy(session->userlist);

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

	if (session->passport_info.file != NULL)
	{
		g_unlink(session->passport_info.file);
		g_free(session->passport_info.file);
	}

	if (session->sync != NULL)
		msn_sync_destroy(session->sync);

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

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

	g_free(session);
}
Beispiel #7
0
void
msn_session_set_error(MsnSession *session, MsnErrorType error,
					  const char *info)
{
	PurpleConnection *gc;
	PurpleConnectionError reason;
	char *msg;

	if (session->destroying)
		return;

	gc = purple_account_get_connection(session->account);

	switch (error)
	{
		case MSN_ERROR_SERVCONN:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(info);
			break;
		case MSN_ERROR_UNSUPPORTED_PROTOCOL:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(_("Our protocol is not supported by the "
							 "server"));
			break;
		case MSN_ERROR_HTTP_MALFORMED:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(_("Error parsing HTTP"));
			break;
		case MSN_ERROR_SIGN_OTHER:
			reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
			msg = g_strdup(_("You have signed on from another location"));
			if (!purple_account_get_remember_password(session->account))
				purple_account_set_password(session->account, NULL, NULL, NULL);
			break;
		case MSN_ERROR_SERV_UNAVAILABLE:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(_("The MSN servers are temporarily "
							 "unavailable. Please wait and try "
							 "again."));
			break;
		case MSN_ERROR_SERV_DOWN:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(_("The MSN servers are going down "
							 "temporarily"));
			break;
		case MSN_ERROR_AUTH:
			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
			msg = g_strdup_printf(_("Unable to authenticate: %s"),
								  (info == NULL ) ?
								  _("Unknown error") : info);
			/* Clear the password if it isn't being saved */
			if (!purple_account_get_remember_password(session->account))
				purple_account_set_password(session->account, NULL, NULL, NULL);
			break;
		case MSN_ERROR_BAD_BLIST:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup_printf(_("Your MSN buddy list is temporarily "
			                        "unavailable: %s"),
			                      (info == NULL) ? _("Unknown error") : info);
			break;
		default:
			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
			msg = g_strdup(_("Unknown error"));
			break;
	}

	msn_session_disconnect(session);

	purple_connection_error(gc, reason, msg);

	g_free(msg);
}