# HG changeset patch
# Node ID 10297f64de82
# Parent  a3d036e859b1
diff --git a/libpurple/tests/meson.build b/libpurple/tests/meson.build
--- a/libpurple/tests/meson.build
+++ b/libpurple/tests/meson.build
@@ -35,7 +35,6 @@
     'protocol_conversation',
     'protocol_file_transfer',
     'protocol_roster',
-    'protocol_xfer',
     'purplepath',
     'request_field',
     'request_group',
diff --git a/libpurple/tests/test_protocol_xfer.c b/libpurple/tests/test_protocol_xfer.c
deleted file mode 100644
--- a/libpurple/tests/test_protocol_xfer.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Purple
- *
- * Purple is the legal property of its developers, whose names are too
- * numerous to list here. Please refer to the COPYRIGHT file distributed
- * with this source distribution
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include <purple.h>
-
-#include "test_ui.h"
-
-/******************************************************************************
- * PurpleProtcolXfer Implementations
- *****************************************************************************/
-static GType test_purple_protocol_xfer_get_type(void);
-
-typedef struct {
-	PurpleProtocol parent;
-
-	gboolean can_send;
-	gboolean new_xfer_called;
-	gboolean send_called;
-} TestPurpleProtocolXfer;
-
-typedef struct {
-	PurpleProtocolClass parent;
-} TestPurpleProtocolXferClass;
-
-
-static gboolean
-test_purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer,
-                                      G_GNUC_UNUSED PurpleConnection *c,
-                                      G_GNUC_UNUSED const gchar *who)
-{
-	TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer;
-
-	return test_xfer->can_send;
-}
-
-static void
-test_purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer,
-                                    G_GNUC_UNUSED PurpleConnection *c,
-                                    G_GNUC_UNUSED const gchar *who,
-                                    G_GNUC_UNUSED const gchar *filename)
-{
-	TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer;
-
-	test_xfer->send_called = TRUE;
-}
-
-static PurpleXfer *
-test_purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer,
-                                   PurpleConnection *c,
-                                   const gchar *who)
-{
-	TestPurpleProtocolXfer *test_xfer = (TestPurpleProtocolXfer *)prplxfer;
-	PurpleAccount *a = purple_connection_get_account(c);
-
-	test_xfer->new_xfer_called = TRUE;
-
-	return purple_xfer_new(a, PURPLE_XFER_TYPE_SEND, who);
-}
-
-static void
-test_purple_protocol_xfer_iface_init(PurpleProtocolXferInterface *iface) {
-	iface->can_receive = test_purple_protocol_xfer_can_receive;
-	iface->send_file = test_purple_protocol_xfer_send_file;
-	iface->new_xfer = test_purple_protocol_xfer_new_xfer;
-}
-
-G_DEFINE_TYPE_WITH_CODE(
-	TestPurpleProtocolXfer,
-	test_purple_protocol_xfer,
-	PURPLE_TYPE_PROTOCOL,
-	G_IMPLEMENT_INTERFACE(
-		PURPLE_TYPE_PROTOCOL_XFER,
-		test_purple_protocol_xfer_iface_init
-	)
-);
-
-static void
-test_purple_protocol_xfer_init(G_GNUC_UNUSED TestPurpleProtocolXfer *prplxfer) {
-}
-
-static void
-test_purple_protocol_xfer_class_init(G_GNUC_UNUSED TestPurpleProtocolXferClass *klass) {
-}
-
-static TestPurpleProtocolXfer *
-test_purple_protocol_xfer_new(void) {
-	return (TestPurpleProtocolXfer *)g_object_new(
-		test_purple_protocol_xfer_get_type(),
-		"id", "prpl-xfer",
-		NULL);
-}
-
-/******************************************************************************
- * Tests
- *****************************************************************************/
-static void
-test_purple_protocol_xfer_can_receive_func(void) {
-	TestPurpleProtocolXfer *xfer = NULL;
-	PurpleAccount *account = NULL;
-	PurpleConnection *connection = NULL;
-	gboolean actual = FALSE;
-
-	xfer = test_purple_protocol_xfer_new();
-	account = purple_account_new("prpl-xfer-can-receive", "prpl-xfer");
-	connection = g_object_new(PURPLE_TYPE_CONNECTION, "account", account, NULL);
-
-	g_assert_true(PURPLE_IS_PROTOCOL_XFER(xfer));
-
-	xfer->can_send = FALSE;
-	actual = purple_protocol_xfer_can_receive(PURPLE_PROTOCOL_XFER(xfer),
-	                                          connection, "foo");
-	g_assert_false(actual);
-
-	xfer->can_send = TRUE;
-	actual = purple_protocol_xfer_can_receive(
-		PURPLE_PROTOCOL_XFER(xfer),
-		connection,
-		"foo"
-	);
-	g_assert_true(actual);
-
-	g_clear_object(&account);
-	g_clear_object(&xfer);
-}
-
-static void
-test_purple_protocol_xfer_send_file_func(void) {
-	TestPurpleProtocolXfer *prplxfer = NULL;
-	PurpleAccount *account = NULL;
-	PurpleConnection *connection = NULL;
-
-	prplxfer = g_object_new(test_purple_protocol_xfer_get_type(), NULL);
-	account = purple_account_new("prpl-xfer-send", "prpl-xfer");
-	connection = g_object_new(PURPLE_TYPE_CONNECTION, "account", account, NULL);
-
-	purple_protocol_xfer_send_file(PURPLE_PROTOCOL_XFER(prplxfer), connection,
-	                               "foo", "somefile");
-	g_assert_true(prplxfer->send_called);
-
-	g_clear_object(&account);
-	g_clear_object(&prplxfer);
-}
-
-static void
-test_purple_protocol_xfer_new_func(void) {
-	TestPurpleProtocolXfer *prplxfer = NULL;
-	PurpleAccount *account = NULL;
-	PurpleConnection *connection = NULL;
-	PurpleXfer *xfer = NULL;
-
-	prplxfer = g_object_new(test_purple_protocol_xfer_get_type(), NULL);
-	account = purple_account_new("prpl-xfer-new-xfer", "prpl-xfer");
-	connection = g_object_new(PURPLE_TYPE_CONNECTION, "account", account, NULL);
-
-	xfer = purple_protocol_xfer_new_xfer(PURPLE_PROTOCOL_XFER(prplxfer),
-	                                     connection, "foo");
-	g_assert_true(PURPLE_IS_XFER(xfer));
-	g_assert_cmpstr("foo", ==, purple_xfer_get_remote_user(xfer));
-	g_assert_true(prplxfer->new_xfer_called);
-
-	g_clear_object(&account);
-	g_clear_object(&prplxfer);
-}
-
-/******************************************************************************
- * Main
- *****************************************************************************/
-gint
-main(gint argc, gchar **argv) {
-	gint res = 0;
-
-	g_test_init(&argc, &argv, NULL);
-
-	g_test_set_nonfatal_assertions();
-
-	test_ui_purple_init();
-
-	g_test_add_func(
-		"/protocol-xfer/can-receive",
-		test_purple_protocol_xfer_can_receive_func
-	);
-
-	g_test_add_func(
-		"/protocol-xfer/send-file",
-		test_purple_protocol_xfer_send_file_func
-	);
-
-	g_test_add_func(
-		"/protocol-xfer/new",
-		test_purple_protocol_xfer_new_func
-	);
-
-	res = g_test_run();
-
-	/* FIXME: We cannot call test_ui_purple_uninit() here because connections
-	 * are not easily destroyed if they haven't been fully implemented. */
-
-	return res;
-}
diff --git a/libpurple/xfer.h b/libpurple/xfer.h
--- a/libpurple/xfer.h
+++ b/libpurple/xfer.h
@@ -980,84 +980,6 @@
 PURPLE_AVAILABLE_IN_ALL
 PurpleXferUiOps *purple_xfers_get_ui_ops(void);
 
-/******************************************************************************
- * Protocol Interface
- *****************************************************************************/
-
-#define PURPLE_TYPE_PROTOCOL_XFER (purple_protocol_xfer_get_type())
-
-PURPLE_AVAILABLE_IN_3_0
-G_DECLARE_INTERFACE(PurpleProtocolXfer, purple_protocol_xfer, PURPLE,
-                    PROTOCOL_XFER, PurpleProtocol)
-
-/**
- * PurpleProtocolXfer:
- *
- * The protocol file transfer interface.
- *
- * Since: 3.0
- */
-
-struct _PurpleProtocolXferInterface {
-	/*< private >*/
-	GTypeInterface parent_iface;
-
-	/*< public >*/
-	gboolean (*can_receive)(PurpleProtocolXfer *prplxfer,
-	                        PurpleConnection *connection, const gchar *who);
-
-	void (*send_file)(PurpleProtocolXfer *prplxfer,
-	                  PurpleConnection *connection, const gchar *who,
-	                  const gchar *filename);
-
-	PurpleXfer *(*new_xfer)(PurpleProtocolXfer *prplxfer,
-	                        PurpleConnection *connection, const gchar *who);
-};
-
-/**
- * purple_protocol_xfer_can_receive:
- * @prplxfer: The #PurpleProtocolXfer implementer instance
- * @connection: The #PurpleConnection that we're checking
- * @who: The user that we want to send a file transfer to.
- *
- * Checks whether or not we can transfer a file to @who.
- *
- * Returns: TRUE on success, FALSE otherwise.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-gboolean purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer, PurpleConnection *connection, const gchar *who);
-
-/**
- * purple_protocol_xfer_send_file:
- * @prplxfer: The #PurpleProtocolXfer implementer instance
- * @connection: The #PurpleConnection that we're checking
- * @who: The user that we want to set a file transfer to.
- * @filename: The name of the file to send.
- *
- * Sends @filename to @who.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer, PurpleConnection *connection, const gchar *who, const gchar *filename);
-
-/**
- * purple_protocol_xfer_new_xfer:
- * @prplxfer: The #PurpleProtocolXfer implementer instance
- * @connection: The #PurpleConnection that we're checking
- * @who: The user that we want to send a file transfer to.
- *
- * Creates a new #PurpleXfer to @who.
- *
- * Returns: (transfer full): A new #PurpleXfer instance.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-PurpleXfer *purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer, PurpleConnection *connection, const gchar *who);
-
 G_END_DECLS
 
 #endif /* PURPLE_XFER_H */
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -2517,30 +2517,17 @@
 purple_xfer_new(PurpleAccount *account, PurpleXferType type, const char *who)
 {
 	PurpleXfer *xfer;
-	PurpleProtocol *protocol;
 
 	g_return_val_if_fail(type != PURPLE_XFER_TYPE_UNKNOWN, NULL);
 	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
 	g_return_val_if_fail(who != NULL, NULL);
 
-	protocol = purple_account_get_protocol(account);
-	if (PURPLE_IS_PROTOCOL_XFER(protocol)) {
-		PurpleConnection *connection = purple_account_get_connection(account);
-
-		xfer = purple_protocol_xfer_new_xfer(
-			PURPLE_PROTOCOL_XFER(protocol),
-			connection,
-			/* TODO: this should support the type */
-			who
-		);
-	} else {
-		xfer = g_object_new(PURPLE_TYPE_XFER,
-			"account",     account,
-			"type",        type,
-			"remote-user", who,
-			NULL
-		);
-	}
+	xfer = g_object_new(PURPLE_TYPE_XFER,
+		"account",     account,
+		"type",        type,
+		"remote-user", who,
+		NULL
+	);
 
 	return xfer;
 }
@@ -2619,70 +2606,3 @@
 
 	return type;
 }
-
-/**************************************************************************
- * PurpleXferProtocolInterface
- **************************************************************************/
-G_DEFINE_INTERFACE(PurpleProtocolXfer, purple_protocol_xfer,
-                   PURPLE_TYPE_PROTOCOL)
-
-static void
-purple_protocol_xfer_default_init(G_GNUC_UNUSED PurpleProtocolXferInterface *face)
-{
-}
-
-gboolean
-purple_protocol_xfer_can_receive(PurpleProtocolXfer *prplxfer,
-                                 PurpleConnection *connection,
-                                 const gchar *who
-) {
-	PurpleProtocolXferInterface *iface = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer), FALSE);
-	g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), FALSE);
-	g_return_val_if_fail(who, FALSE);
-
-	iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer);
-	if(iface &&  iface->can_receive)
-		return iface->can_receive(prplxfer, connection, who);
-
-	/* If the PurpleProtocolXfer doesn't implement this function, we assume
-	 * there are no conditions where we can't send a file to the given user.
-	 */
-	return TRUE;
-}
-
-void
-purple_protocol_xfer_send_file(PurpleProtocolXfer *prplxfer,
-                               PurpleConnection *connection,
-                               const gchar *who,
-                               const gchar *filename
-) {
-	PurpleProtocolXferInterface *iface = NULL;
-
-	g_return_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer));
-	g_return_if_fail(PURPLE_IS_CONNECTION(connection));
-	g_return_if_fail(who);
-
-	iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer);
-	if(iface && iface->send_file)
-		iface->send_file(prplxfer, connection, who, filename);
-}
-
-PurpleXfer *
-purple_protocol_xfer_new_xfer(PurpleProtocolXfer *prplxfer,
-                              PurpleConnection *connection,
-                              const gchar *who
-) {
-	PurpleProtocolXferInterface *iface = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_PROTOCOL_XFER(prplxfer), FALSE);
-	g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), FALSE);
-	g_return_val_if_fail(who, FALSE);
-
-	iface = PURPLE_PROTOCOL_XFER_GET_IFACE(prplxfer);
-	if(iface && iface->new_xfer)
-		return iface->new_xfer(prplxfer, connection, who);
-
-	return NULL;
-}
diff --git a/po/POTFILES.in b/po/POTFILES.in
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -120,7 +120,6 @@
 libpurple/tests/test_keyvaluepair.c
 libpurple/tests/test_markup.c
 libpurple/tests/test_protocol_action.c
-libpurple/tests/test_protocol_xfer.c
 libpurple/tests/test_purplepath.c
 libpurple/tests/test_ui.c
 libpurple/tests/test_util.c
