aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-ft-factory.c18
-rw-r--r--libempathy/empathy-ft-factory.h6
-rw-r--r--libempathy/empathy-ft-handler.c61
-rw-r--r--libempathy/empathy-ft-handler.h4
4 files changed, 25 insertions, 64 deletions
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index 7e19973aa..5d54203fc 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -173,25 +173,20 @@ empathy_ft_factory_dup_singleton (void)
* @factory: an #EmpathyFTFactory
* @contact: the #EmpathyContact destination of the transfer
* @source: the #GFile to be transferred to @contact
- * @use_hash: whether the handler should try to use checksum to validate
- * the transfer
*
* Trigger the creation of an #EmpathyFTHandler object to send @source to
- * the specified @contact. Note that it's not guaranteed that setting
- * @use_hash to TRUE will trigger checksumming, as that is not supported
- * by all the underlying connection managers.
+ * the specified @contact.
*/
void
empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
EmpathyContact *contact,
- GFile *source,
- gboolean use_hash)
+ GFile *source)
{
g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
g_return_if_fail (G_IS_FILE (source));
- empathy_ft_handler_new_outgoing (contact, source, use_hash,
+ empathy_ft_handler_new_outgoing (contact, source,
ft_handler_outgoing_ready_cb, factory);
}
@@ -227,8 +222,6 @@ empathy_ft_factory_claim_channel (EmpathyFTFactory *factory,
* @factory: an #EmpathyFTFactory
* @handler: the #EmpathyFTHandler to set the destination of
* @destination: the #GFile destination of the transfer
- * @use_hash: whether the handler should try to use checksum to validate
- * the transfer
*
* Sets @destination as destination file for the transfer. After the call of
* this method, the ::new-ft-handler will be emitted for the incoming handler.
@@ -237,14 +230,13 @@ void
empathy_ft_factory_set_destination_for_incoming_handler (
EmpathyFTFactory *factory,
EmpathyFTHandler *handler,
- GFile *destination,
- gboolean use_hash)
+ GFile *destination)
{
g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
g_return_if_fail (G_IS_FILE (destination));
- empathy_ft_handler_incoming_set_destination (handler, destination, use_hash);
+ empathy_ft_handler_incoming_set_destination (handler, destination);
g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, NULL);
}
diff --git a/libempathy/empathy-ft-factory.h b/libempathy/empathy-ft-factory.h
index 27fad9a13..cffb73301 100644
--- a/libempathy/empathy-ft-factory.h
+++ b/libempathy/empathy-ft-factory.h
@@ -63,15 +63,13 @@ GType empathy_ft_factory_get_type (void);
EmpathyFTFactory* empathy_ft_factory_dup_singleton (void);
void empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
EmpathyContact *contact,
- GFile *source,
- gboolean use_hash);
+ GFile *source);
void empathy_ft_factory_claim_channel (EmpathyFTFactory *factory,
EmpathyDispatchOperation *operation);
void empathy_ft_factory_set_destination_for_incoming_handler (
EmpathyFTFactory *factory,
EmpathyFTHandler *handler,
- GFile *destination,
- gboolean use_hash);
+ GFile *destination);
G_END_DECLS
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index be40d5e01..62f430b57 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -83,8 +83,7 @@ enum {
PROP_FILENAME,
PROP_MODIFICATION_TIME,
PROP_TOTAL_BYTES,
- PROP_TRANSFERRED_BYTES,
- PROP_USE_HASH
+ PROP_TRANSFERRED_BYTES
};
enum {
@@ -190,9 +189,6 @@ do_get_property (GObject *object,
case PROP_TP_FILE:
g_value_set_object (value, priv->tpfile);
break;
- case PROP_USE_HASH:
- g_value_set_boolean (value, priv->use_hash);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -235,9 +231,6 @@ do_set_property (GObject *object,
case PROP_TP_FILE:
priv->tpfile = g_value_dup_object (value);
break;
- case PROP_USE_HASH:
- priv->use_hash = g_value_get_boolean (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -425,16 +418,6 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_TP_FILE, param_spec);
- /**
- * EmpathyFTHandler:use-hash:
- *
- * %TRUE if checksumming is enabled for the handler, %FALSE otherwise
- */
- param_spec = g_param_spec_boolean ("use-hash",
- "use-hash", "Whether we should use checksum when sending or receiving",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_property (object_class, PROP_USE_HASH, param_spec);
-
/* signals */
/**
@@ -508,12 +491,11 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
* @handler: the object which has received the signal
*
* This signal is emitted when the hashing operation of the handler
- * is started. Note that this only happens if the handler is created
- * with checksum enabled and, even if the option is set, is not
- * guaranteed to happen for incoming handlers, as the CM might not
- * support sending/receiving the file hash. You can use
- * empathy_ft_handler_get_use_hash() to find out whether the handler really
- * supports checksum.
+ * is started. Note that this might happen or not, depending on the CM
+ * and remote contact capabilities. Clients shoud use
+ * empathy_ft_handler_get_use_hash() before calling
+ * empathy_ft_handler_start_transfer() to know whether they should connect
+ * to this signal.
*/
signals[HASHING_STARTED] =
g_signal_new ("hashing-started", G_TYPE_FROM_CLASS (klass),
@@ -1084,10 +1066,10 @@ find_hash_channel_class_cb (GStrv channel_class,
DEBUG ("check if FT+hash is allowed: %s", allowed ? "True" : "False");
+ priv->use_hash = allowed;
+
if (!allowed)
{
- priv->use_hash = FALSE;
-
/* see if we support FT without hash instead */
empathy_dispatcher_find_requestable_channel_classes_async
(priv->dispatcher, empathy_contact_get_connection (priv->contact),
@@ -1255,7 +1237,6 @@ channel_get_all_properties_cb (TpProxy *proxy,
* empathy_ft_handler_new_outgoing:
* @contact: the #EmpathyContact to send @source to
* @source: the #GFile to send
- * @use_hash: whether the handler should send a checksum of the file
* @callback: callback to be called when the handler has been created
* @user_data: user data to be passed to @callback
*
@@ -1264,7 +1245,6 @@ channel_get_all_properties_cb (TpProxy *proxy,
void
empathy_ft_handler_new_outgoing (EmpathyContact *contact,
GFile *source,
- gboolean use_hash,
EmpathyFTHandlerReadyCallback callback,
gpointer user_data)
{
@@ -1272,14 +1252,13 @@ empathy_ft_handler_new_outgoing (EmpathyContact *contact,
CallbacksData *data;
EmpathyFTHandlerPriv *priv;
- DEBUG ("New handler outgoing, use hash %s",
- use_hash ? "True" : "False");
+ DEBUG ("New handler outgoing");
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
g_return_if_fail (G_IS_FILE (source));
handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
- "contact", contact, "gfile", source, "use-hash", use_hash, NULL);
+ "contact", contact, "gfile", source, NULL);
priv = GET_PRIV (handler);
@@ -1394,8 +1373,6 @@ empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler)
* empathy_ft_handler_incoming_set_destination:
* @handler: an #EmpathyFTHandler
* @destination: the #GFile where the transfer should be saved
- * @use_hash: whether the handler should, after the transfer, try to
- * validate it with checksum.
*
* Sets the destination of the incoming handler to be @destination.
* Note that calling this method is mandatory before starting the transfer
@@ -1403,28 +1380,25 @@ empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler)
*/
void
empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
- GFile *destination,
- gboolean use_hash)
+ GFile *destination)
{
EmpathyFTHandlerPriv *priv;
- DEBUG ("Set incoming destination, use hash %s",
- use_hash ? "True" : "False");
-
g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
g_return_if_fail (G_IS_FILE (destination));
priv = GET_PRIV (handler);
- g_object_set (handler, "gfile", destination,
- "use-hash", use_hash, NULL);
+ g_object_set (handler, "gfile", destination, NULL);
- /* check if hash is really supported. if it isn't, set use_hash to FALSE
+ /* check if hash is supported. if it isn't, set use_hash to FALSE
* anyway, so that clients won't be expecting us to checksum.
*/
if (EMP_STR_EMPTY (priv->content_hash) ||
priv->content_hash_type == TP_FILE_HASH_TYPE_NONE)
priv->use_hash = FALSE;
+ else
+ priv->use_hash = TRUE;
}
/**
@@ -1511,9 +1485,8 @@ empathy_ft_handler_get_gfile (EmpathyFTHandler *handler)
* empathy_ft_handler_get_use_hash:
* @handler: an #EmpathyFTHandler
*
- * Returns whether @handler has checksumming enabled. Note that if the CM
- * doesn't support sending/receiving the checksum, this can return %FALSE even
- * if the handler was created with the use_hash parameter set to %TRUE.
+ * Returns whether @handler has checksumming enabled. This can depend on
+ * the CM and the remote contact capabilities.
*
* Return value: %TRUE if the handler has checksumming enabled,
* %FALSE otherwise.
diff --git a/libempathy/empathy-ft-handler.h b/libempathy/empathy-ft-handler.h
index 0f715321a..7d4153611 100644
--- a/libempathy/empathy-ft-handler.h
+++ b/libempathy/empathy-ft-handler.h
@@ -71,7 +71,6 @@ GType empathy_ft_handler_get_type (void);
/* public methods */
void empathy_ft_handler_new_outgoing (EmpathyContact *contact,
GFile *source,
- gboolean use_hash,
EmpathyFTHandlerReadyCallback callback,
gpointer user_data);
@@ -79,8 +78,7 @@ void empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
EmpathyFTHandlerReadyCallback callback,
gpointer user_data);
void empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
- GFile *destination,
- gboolean use_hash);
+ GFile *destination);
void empathy_ft_handler_start_transfer (EmpathyFTHandler *handler);
void empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler);