changeset 17811:e62095e99db0

Add new function purple_xfer_get_remote_user. Expose the xfer-functions to dbus. Register the xfer's so dbus-scripts can play with them, and we don't get a runtime dbus-whining.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 27 May 2007 21:35:47 +0000
parents 8bc2b7ec45c1
children c0c17a81f5fe
files ChangeLog.API libpurple/Makefile.am libpurple/ft.c libpurple/ft.h
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun May 27 18:31:40 2007 +0000
+++ b/ChangeLog.API	Sun May 27 21:35:47 2007 +0000
@@ -7,6 +7,7 @@
 	* pidgin_retrieve_user_info, shows immediate feedback when getting
 	  information about a user.
 	* gtk_imhtml_setup_entry
+	* purple_xfer_get_remote_user
 
 	Changed:
 	* pidgin_separator returns the separator added to the menu.
--- a/libpurple/Makefile.am	Sun May 27 18:31:40 2007 +0000
+++ b/libpurple/Makefile.am	Sun May 27 21:35:47 2007 +0000
@@ -151,7 +151,7 @@
 dbus_headers  = dbus-bindings.h dbus-purple.h dbus-server.h dbus-useful.h dbus-define-api.h
 
 dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h \
-                connection.h conversation.h core.h log.h notify.h prefs.h roomlist.h \
+                connection.h conversation.h core.h ft.h log.h notify.h prefs.h roomlist.h \
                 savedstatuses.h status.h server.h util.h xmlnode.h
 
 purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders))
--- a/libpurple/ft.c	Sun May 27 18:31:40 2007 +0000
+++ b/libpurple/ft.c	Sun May 27 21:35:47 2007 +0000
@@ -23,6 +23,7 @@
  *
  */
 #include "internal.h"
+#include "dbus-maybe.h"
 #include "ft.h"
 #include "network.h"
 #include "notify.h"
@@ -56,6 +57,7 @@
 	g_return_val_if_fail(who     != NULL,              NULL);
 
 	xfer = g_new0(PurpleXfer, 1);
+	PURPLE_DBUS_REGISTER_POINTER(xfer, PurpleXfer);
 
 	xfer->ref = 1;
 	xfer->type    = type;
@@ -97,6 +99,7 @@
 	g_free(xfer->remote_ip);
 	g_free(xfer->local_filename);
 
+	PURPLE_DBUS_UNREGISTER_POINTER(xfer);
 	g_free(xfer);
 	xfers = g_list_remove(xfers, xfer);
 }
@@ -551,6 +554,13 @@
 	return xfer->account;
 }
 
+const char *
+purple_xfer_get_remote_user(const PurpleXfer *xfer)
+{
+	g_return_val_if_fail(xfer != NULL, NULL);
+	return xfer->who;
+}
+
 PurpleXferStatusType
 purple_xfer_get_status(const PurpleXfer *xfer)
 {
--- a/libpurple/ft.h	Sun May 27 18:31:40 2007 +0000
+++ b/libpurple/ft.h	Sun May 27 21:35:47 2007 +0000
@@ -237,6 +237,15 @@
 PurpleAccount *purple_xfer_get_account(const PurpleXfer *xfer);
 
 /**
+ * Returns the name of the remote user.
+ *
+ * @param xfer The file transfer.
+ *
+ * @return The name of the remote user.
+ */
+const char *purple_xfer_get_remote_user(const PurpleXfer *xfer);
+
+/**
  * Returns the status of the xfer.
  *
  * @param xfer The file transfer.