empathy r1755 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r1755 - trunk/libempathy
- Date: Fri, 21 Nov 2008 16:14:57 +0000 (UTC)
Author: xclaesse
Date: Fri Nov 21 16:14:57 2008
New Revision: 1755
URL: http://svn.gnome.org/viewvc/empathy?rev=1755&view=rev
Log:
Implemented accept_file and empathy_receive_file in empathy-file. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
Modified:
trunk/libempathy/empathy-file.c
Modified: trunk/libempathy/empathy-file.c
==============================================================================
--- trunk/libempathy/empathy-file.c (original)
+++ trunk/libempathy/empathy-file.c Fri Nov 21 16:14:57 2008
@@ -527,24 +527,6 @@
return priv->channel;
}
-/**
- * empathy_file_accept:
- * @file: an #EmpathyFile
- *
- * Accepts a file transfer that's in the "local pending" state (i.e.
- * EMP_FILE_TRANSFER_STATE_LOCAL_PENDING).
- */
-void
-empathy_file_accept (EmpathyFile *file)
-{
- EmpathyFilePriv *priv;
-
- g_return_if_fail (EMPATHY_IS_FILE (file));
-
- /* TODO: accept file here */
- if (priv) ;
-}
-
static void
file_destroy_cb (TpChannel *file_channel, EmpathyFile *file)
{
@@ -631,6 +613,74 @@
return fd;
}
+/**
+ * empathy_file_accept:
+ * @file: an #EmpathyFile
+ *
+ * Accepts a file transfer that's in the "local pending" state (i.e.
+ * EMP_FILE_TRANSFER_STATE_LOCAL_PENDING).
+ */
+void
+empathy_file_accept (EmpathyFile *file)
+{
+ EmpathyFilePriv *priv;
+ GValue *address;
+ GValue nothing = { 0 };
+ GError *error = NULL;
+
+ g_return_if_fail (EMPATHY_IS_FILE (file));
+
+ priv = GET_PRIV (file);
+
+ g_return_if_fail (priv->out_stream != NULL);
+
+ DEBUG ("Accepting file: filename=%s", priv->filename);
+
+ g_value_init (¬hing, G_TYPE_STRING);
+ g_value_set_string (¬hing, "");
+
+ if (!emp_cli_channel_type_file_run_accept_file (TP_PROXY (priv->channel),
+ -1, TP_SOCKET_ADDRESS_TYPE_UNIX, TP_SOCKET_ACCESS_CONTROL_LOCALHOST,
+ ¬hing, &address, &error, NULL))
+ {
+ DEBUG ("Accept error: %s",
+ error ? error->message : "No message given");
+ g_clear_error (&error);
+ }
+
+ 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);
+}
+
+static void
+receive_file (EmpathyFile *file)
+{
+ EmpathyFilePriv *priv;
+ GInputStream *socket_stream;
+ gint socket_fd;
+
+ priv = GET_PRIV (file);
+
+ socket_fd = _get_local_socket (file);
+
+ if (socket_fd < 0)
+ return;
+
+ socket_stream = g_unix_input_stream_new (socket_fd, TRUE);
+
+ priv->cancellable = g_cancellable_new ();
+
+ copy_stream (socket_stream, priv->out_stream, priv->cancellable);
+
+ g_object_unref (socket_stream);
+}
+
+
static void
send_file (EmpathyFile *file)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]