aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-file.c40
-rw-r--r--libempathy/empathy-tp-file.h3
-rw-r--r--libempathy/empathy-utils.c2
3 files changed, 42 insertions, 3 deletions
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index c64c0e2f8..0d1a47a39 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -621,7 +621,8 @@ _get_local_socket (EmpathyTpFile *tp_file)
* EMP_FILE_TRANSFER_STATE_LOCAL_PENDING).
*/
void
-empathy_tp_file_accept (EmpathyTpFile *tp_file)
+empathy_tp_file_accept (EmpathyTpFile *tp_file,
+ guint64 offset)
{
EmpathyTpFilePriv *priv;
GValue *address;
@@ -641,11 +642,46 @@ empathy_tp_file_accept (EmpathyTpFile *tp_file)
if (!emp_cli_channel_type_file_run_accept_file (TP_PROXY (priv->channel),
-1, TP_SOCKET_ADDRESS_TYPE_UNIX, TP_SOCKET_ACCESS_CONTROL_LOCALHOST,
- &nothing, &address, &error, NULL))
+ &nothing, offset, &address, &error, NULL))
{
DEBUG ("Accept error: %s",
error ? error->message : "No message given");
g_clear_error (&error);
+ return;
+ }
+
+ if (priv->unix_socket_path)
+ g_free (priv->unix_socket_path);
+
+ priv->unix_socket_path = g_value_dup_string (address);
+ g_value_unset (address);
+
+ DEBUG ("Got unix socket path: %s", priv->unix_socket_path);
+}
+
+void
+empathy_tp_file_offer (EmpathyTpFile *tp_file)
+{
+ EmpathyTpFilePriv *priv;
+ GValue *address;
+ GError *error = NULL;
+ GValue nothing = { 0 };
+
+ g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
+
+ priv = GET_PRIV (tp_file);
+
+ g_value_init (&nothing, G_TYPE_STRING);
+ g_value_set_string (&nothing, "");
+
+ if (!emp_cli_channel_type_file_run_offer_file (TP_PROXY (priv->channel),
+ -1, TP_SOCKET_ADDRESS_TYPE_UNIX, TP_SOCKET_ACCESS_CONTROL_LOCALHOST,
+ &nothing, &address, &error, NULL))
+ {
+ DEBUG ("OfferFile error: %s",
+ error ? error->message : "No message given");
+ g_clear_error (&error);
+ return;
}
if (priv->unix_socket_path)
diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h
index 213948c93..5ba1f1d47 100644
--- a/libempathy/empathy-tp-file.h
+++ b/libempathy/empathy-tp-file.h
@@ -65,8 +65,9 @@ GType empathy_tp_file_get_type (void) G_GNUC_CONST;
EmpathyTpFile *empathy_tp_file_new (McAccount *account, TpChannel *channel);
TpChannel *empathy_tp_file_get_channel (EmpathyTpFile *tp_file);
-void empathy_tp_file_accept (EmpathyTpFile *tp_file);
+void empathy_tp_file_accept (EmpathyTpFile *tp_file, guint64 offset);
void empathy_tp_file_cancel (EmpathyTpFile *tp_file);
+void empathy_tp_file_offer (EmpathyTpFile *tp_file);
const gchar *empathy_tp_file_get_id (EmpathyTpFile *tp_file);
guint64 empathy_tp_file_get_transferred_bytes (EmpathyTpFile *tp_file);
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 1a33328a4..b17d18a52 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -867,6 +867,8 @@ empathy_send_file (EmpathyContact *contact,
empathy_tp_file_set_input_stream (tp_file, in_stream);
}
+ empathy_tp_file_offer (tp_file);
+
g_object_unref (mc);
g_object_unref (connection);
g_object_unref (channel);