aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/Makefile.am22
-rw-r--r--libempathy/cheese-camera-device-monitor.c5
-rw-r--r--libempathy/empathy-account-settings.c6
-rw-r--r--libempathy/empathy-auth-factory.c8
-rw-r--r--libempathy/empathy-camera-monitor.c4
-rw-r--r--libempathy/empathy-chatroom-manager.c8
-rw-r--r--libempathy/empathy-client-factory.c6
-rw-r--r--libempathy/empathy-connection-managers.c2
-rw-r--r--libempathy/empathy-connectivity.c5
-rw-r--r--libempathy/empathy-contact-list.c11
-rw-r--r--libempathy/empathy-contact-manager.c4
-rw-r--r--libempathy/empathy-contact.c6
-rw-r--r--libempathy/empathy-ft-factory.c22
-rw-r--r--libempathy/empathy-ft-factory.h3
-rw-r--r--libempathy/empathy-ft-handler.c88
-rw-r--r--libempathy/empathy-ft-handler.h1
-rw-r--r--libempathy/empathy-gsettings.h2
-rw-r--r--libempathy/empathy-individual-manager.c49
-rw-r--r--libempathy/empathy-irc-network.c3
-rw-r--r--libempathy/empathy-irc-server.c3
-rw-r--r--libempathy/empathy-presence-manager.c4
-rw-r--r--libempathy/empathy-request-util.c26
-rw-r--r--libempathy/empathy-request-util.h10
-rw-r--r--libempathy/empathy-server-sasl-handler.c58
-rw-r--r--libempathy/empathy-tp-chat.c79
-rw-r--r--libempathy/empathy-tp-file.c191
-rw-r--r--libempathy/empathy-tp-file.h14
-rw-r--r--libempathy/empathy-tp-roomlist.c16
-rw-r--r--libempathy/empathy-tp-streamed-media.c5
-rw-r--r--libempathy/empathy-utils.c138
-rw-r--r--libempathy/empathy-utils.h9
31 files changed, 391 insertions, 417 deletions
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 3cd971a5d..079b4736b 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -20,9 +20,6 @@ AM_CPPFLAGS = \
$(DISABLE_DEPRECATED)
BUILT_SOURCES = \
- empathy-marshal.h \
- empathy-marshal.c \
- empathy-marshal.list \
empathy-enum-types.h \
empathy-enum-types.c
@@ -135,24 +132,6 @@ check_c_sources = \
include $(top_srcdir)/tools/check-coding-style.mk
check-local: check-coding-style
-empathy-marshal.list: $(libempathy_la_SOURCES) Makefile.am
- $(AM_V_GEN)( cd $(srcdir) && \
- sed -n -e 's/.*empathy_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
- $(libempathy_la_SOURCES) ) \
- | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
- @if cmp -s $@.tmp $@; then \
- rm $@.tmp; \
- else \
- mv $@.tmp $@; \
- fi
-
-empathy-marshal.h: empathy-marshal.list Makefile
- $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=_empathy_marshal $< > empathy-marshal.h
-
-empathy-marshal.c: empathy-marshal.list Makefile
- $(AM_V_GEN)echo "#include \"empathy-marshal.h\"" > $@ && \
- $(GLIB_GENMARSHAL) --body --prefix=_empathy_marshal $< >> empathy-marshal.c
-
empathy-enum-types.h: stamp-empathy-enum-types.h
$(AM_V_GEN)true
stamp-empathy-enum-types.h: $(libempathy_headers) Makefile
@@ -203,7 +182,6 @@ ircnetworks_DATA = \
irc-networks.xml
EXTRA_DIST = \
- empathy-marshal.list \
$(dtd_DATA) \
$(ircnetworks_DATA)
diff --git a/libempathy/cheese-camera-device-monitor.c b/libempathy/cheese-camera-device-monitor.c
index 85c6a0aa4..78b40fb70 100644
--- a/libempathy/cheese-camera-device-monitor.c
+++ b/libempathy/cheese-camera-device-monitor.c
@@ -43,7 +43,6 @@
#endif
#include "cheese-camera-device-monitor.h"
-#include "empathy-marshal.h"
/**
* SECTION:cheese-camera-device-monitor
@@ -360,7 +359,7 @@ cheese_camera_device_monitor_class_init (CheeseCameraDeviceMonitorClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (CheeseCameraDeviceMonitorClass, added),
NULL, NULL,
- _empathy_marshal_VOID__STRING_STRING_STRING_INT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
/**
@@ -375,7 +374,7 @@ cheese_camera_device_monitor_class_init (CheeseCameraDeviceMonitorClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (CheeseCameraDeviceMonitorClass, removed),
NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 1, G_TYPE_STRING);
g_type_class_add_private (klass, sizeof (CheeseCameraDeviceMonitorPrivate));
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index 04fa789d5..cd6b69e8c 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -336,7 +336,7 @@ empathy_account_settings_class_init (
g_signal_new ("password-retrieved",
G_TYPE_FROM_CLASS (empathy_account_settings_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
@@ -1617,7 +1617,7 @@ empathy_account_settings_manager_ready_cb (GObject *source_object,
TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
GError *error = NULL;
- if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ if (!tp_proxy_prepare_finish (account_manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
@@ -1652,7 +1652,7 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings,
if (priv->account == NULL)
{
- tp_account_manager_prepare_async (priv->account_manager, NULL,
+ tp_proxy_prepare_async (priv->account_manager, NULL,
empathy_account_settings_manager_ready_cb, settings);
}
else
diff --git a/libempathy/empathy-auth-factory.c b/libempathy/empathy-auth-factory.c
index 56b3b73eb..6368b1d7d 100644
--- a/libempathy/empathy-auth-factory.c
+++ b/libempathy/empathy-auth-factory.c
@@ -20,9 +20,7 @@
#include "empathy-auth-factory.h"
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/simple-handler.h>
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib.h>
#define DEBUG_FLAG EMPATHY_DEBUG_TLS
#include "empathy-debug.h"
@@ -552,7 +550,7 @@ empathy_auth_factory_class_init (EmpathyAuthFactoryClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_SERVER_TLS_HANDLER);
@@ -561,7 +559,7 @@ empathy_auth_factory_class_init (EmpathyAuthFactoryClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_SERVER_SASL_HANDLER);
}
diff --git a/libempathy/empathy-camera-monitor.c b/libempathy/empathy-camera-monitor.c
index 3b5221eb8..7d9d695e8 100644
--- a/libempathy/empathy-camera-monitor.c
+++ b/libempathy/empathy-camera-monitor.c
@@ -228,14 +228,14 @@ empathy_camera_monitor_class_init (EmpathyCameraMonitorClass *klass)
g_signal_new ("added", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0, NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA);
signals[CAMERA_REMOVED] =
g_signal_new ("removed", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0, NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 1, EMPATHY_TYPE_CAMERA);
g_type_class_add_private (object_class,
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 043f8a829..9a9a7b250 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -518,7 +518,7 @@ account_manager_ready_cb (GObject *source_object,
GError *error = NULL;
GFile *file = NULL;
- if (!tp_account_manager_prepare_finish (manager, result, &error))
+ if (!tp_proxy_prepare_finish (manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
@@ -575,7 +575,7 @@ empathy_chatroom_manager_constructor (GType type,
priv->account_manager = tp_account_manager_dup ();
- tp_account_manager_prepare_async (priv->account_manager, NULL,
+ tp_proxy_prepare_async (priv->account_manager, NULL,
account_manager_ready_cb, g_object_ref (self));
if (priv->file == NULL)
@@ -648,7 +648,7 @@ empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_CHATROOM);
@@ -656,7 +656,7 @@ empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_CHATROOM);
diff --git a/libempathy/empathy-client-factory.c b/libempathy/empathy-client-factory.c
index 3794ef60d..f7529bf2e 100644
--- a/libempathy/empathy-client-factory.c
+++ b/libempathy/empathy-client-factory.c
@@ -24,6 +24,7 @@
#include "empathy-client-factory.h"
#include "empathy-tp-chat.h"
+#include "empathy-tp-file.h"
#include "empathy-utils.h"
#include <telepathy-yell/telepathy-yell.h>
@@ -88,6 +89,11 @@ empathy_client_factory_create_channel (TpSimpleClientFactory *factory,
return TP_CHANNEL (call_channel_new_with_factory (
TP_SIMPLE_CLIENT_FACTORY (factory), conn, path, properties, error));
}
+ else if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER))
+ {
+ return TP_CHANNEL (empathy_tp_file_new (
+ TP_SIMPLE_CLIENT_FACTORY (factory), conn, path, properties, error));
+ }
return chainup->create_channel (factory, conn, path, properties, error);
}
diff --git a/libempathy/empathy-connection-managers.c b/libempathy/empathy-connection-managers.c
index 30a9b8471..a45731686 100644
--- a/libempathy/empathy-connection-managers.c
+++ b/libempathy/empathy-connection-managers.c
@@ -150,7 +150,7 @@ empathy_connection_managers_class_init (
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
diff --git a/libempathy/empathy-connectivity.c b/libempathy/empathy-connectivity.c
index 3c9805c54..f84505f9b 100644
--- a/libempathy/empathy-connectivity.c
+++ b/libempathy/empathy-connectivity.c
@@ -33,7 +33,6 @@
#include <telepathy-glib/util.h>
#include "empathy-utils.h"
-#include "empathy-marshal.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONNECTIVITY
#include "empathy-debug.h"
@@ -220,7 +219,7 @@ empathy_connectivity_init (EmpathyConnectivity *connectivity)
"net.connman.Manager");
dbus_g_object_register_marshaller (
- _empathy_marshal_VOID__STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (priv->proxy, "StateChanged",
@@ -364,7 +363,7 @@ empathy_connectivity_class_init (EmpathyConnectivityClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_BOOLEAN, NULL);
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index d28866735..e532782d5 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -22,7 +22,6 @@
#include "config.h"
#include "empathy-contact-list.h"
-#include "empathy-marshal.h"
static void contact_list_base_init (gpointer klass);
@@ -59,7 +58,7 @@ contact_list_base_init (gpointer klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
4, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT, G_TYPE_UINT, G_TYPE_STRING);
@@ -68,7 +67,7 @@ contact_list_base_init (gpointer klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
5, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT,
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_BOOLEAN);
@@ -78,7 +77,7 @@ contact_list_base_init (gpointer klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, EMPATHY_TYPE_CONTACT, G_TYPE_BOOLEAN);
@@ -87,7 +86,7 @@ contact_list_base_init (gpointer klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
5, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT,
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_BOOLEAN);
@@ -97,7 +96,7 @@ contact_list_base_init (gpointer klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
3, EMPATHY_TYPE_CONTACT, G_TYPE_STRING, G_TYPE_BOOLEAN);
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index b00f82477..8dbf6d3d5 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -436,7 +436,7 @@ account_manager_prepared_cb (GObject *source_object,
TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
GError *error = NULL;
- if (!tp_account_manager_prepare_finish (account_manager, result, &error)) {
+ if (!tp_proxy_prepare_finish (account_manager, result, &error)) {
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
return;
@@ -578,7 +578,7 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
priv->account_manager = tp_account_manager_dup ();
- tp_account_manager_prepare_async (priv->account_manager, NULL,
+ tp_proxy_prepare_async (priv->account_manager, NULL,
account_manager_prepared_cb, manager);
bus = tp_dbus_daemon_dup (&error);
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index c6225c191..935afb556 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -44,7 +44,6 @@
#include "empathy-individual-manager.h"
#include "empathy-utils.h"
#include "empathy-enum-types.h"
-#include "empathy-marshal.h"
#include "empathy-location.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
@@ -405,7 +404,7 @@ empathy_contact_class_init (EmpathyContactClass *class)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__UINT_UINT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, G_TYPE_UINT,
G_TYPE_UINT);
@@ -1663,7 +1662,8 @@ update_geocode (EmpathyContact *contact)
GHashTable *location;
location = empathy_contact_get_location (contact);
- if (location == NULL)
+ if (location == NULL ||
+ g_hash_table_size (location) == 0)
return;
/* No need to search for position if contact published it */
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index 597bbaf51..fb2497a54 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -27,7 +27,6 @@
#include "empathy-ft-factory.h"
#include "empathy-ft-handler.h"
-#include "empathy-marshal.h"
#include "empathy-request-util.h"
#include "empathy-utils.h"
@@ -126,7 +125,7 @@ empathy_ft_factory_class_init (EmpathyFTFactoryClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_POINTER,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_POINTER);
/**
@@ -149,7 +148,7 @@ empathy_ft_factory_class_init (EmpathyFTFactoryClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_POINTER,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_POINTER);
}
@@ -179,22 +178,16 @@ handle_channels_cb (TpSimpleHandler *handler,
for (l = channels; l != NULL; l = g_list_next (l))
{
TpChannel *channel = l->data;
- EmpathyTpFile *tp_file;
if (tp_proxy_get_invalidated (channel) != NULL)
continue;
- if (tp_channel_get_channel_type_id (channel) !=
- TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER)
+ if (!EMPATHY_IS_TP_FILE (channel))
continue;
- tp_file = empathy_tp_file_new (channel);
-
/* We handle only incoming FT */
- empathy_ft_handler_new_incoming (tp_file, ft_handler_incoming_ready_cb,
- self);
-
- g_object_unref (tp_file);
+ empathy_ft_handler_new_incoming ((EmpathyTpFile *) channel,
+ ft_handler_incoming_ready_cb, self);
}
@@ -265,13 +258,14 @@ empathy_ft_factory_dup_singleton (void)
void
empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
EmpathyContact *contact,
- GFile *source)
+ GFile *source,
+ gint64 action_time)
{
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,
+ empathy_ft_handler_new_outgoing (contact, source, action_time,
ft_handler_outgoing_ready_cb, factory);
}
diff --git a/libempathy/empathy-ft-factory.h b/libempathy/empathy-ft-factory.h
index f59ecc44c..dcbffe1e1 100644
--- a/libempathy/empathy-ft-factory.h
+++ b/libempathy/empathy-ft-factory.h
@@ -62,7 +62,8 @@ 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);
+ GFile *source,
+ gint64 user_action_time);
void empathy_ft_factory_set_destination_for_incoming_handler (
EmpathyFTFactory *factory,
EmpathyFTHandler *handler,
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 99b6dc85f..facc49a3b 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -30,7 +30,6 @@
#include "empathy-ft-handler.h"
#include "empathy-tp-contact-factory.h"
-#include "empathy-marshal.h"
#include "empathy-time.h"
#include "empathy-utils.h"
@@ -85,7 +84,8 @@ enum {
PROP_FILENAME,
PROP_MODIFICATION_TIME,
PROP_TOTAL_BYTES,
- PROP_TRANSFERRED_BYTES
+ PROP_TRANSFERRED_BYTES,
+ PROP_USER_ACTION_TIME
};
enum {
@@ -138,6 +138,8 @@ typedef struct {
gchar *content_hash;
TpFileHashType content_hash_type;
+ gint64 user_action_time;
+
/* time and speed */
gdouble speed;
guint remaining_time;
@@ -189,6 +191,9 @@ do_get_property (GObject *object,
case PROP_TP_FILE:
g_value_set_object (value, priv->tpfile);
break;
+ case PROP_USER_ACTION_TIME:
+ g_value_set_int64 (value, priv->user_action_time);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -231,6 +236,9 @@ do_set_property (GObject *object,
case PROP_TP_FILE:
priv->tpfile = g_value_dup_object (value);
break;
+ case PROP_USER_ACTION_TIME:
+ priv->user_action_time = g_value_get_int64 (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -412,6 +420,13 @@ 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);
+ param_spec = g_param_spec_int64 ("user-action-time", "user action time",
+ "User action time",
+ 0, G_MAXINT64, 0,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property (object_class, PROP_USER_ACTION_TIME,
+ param_spec);
+
/* signals */
/**
@@ -424,7 +439,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[TRANSFER_STARTED] =
g_signal_new ("transfer-started", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_TP_FILE);
@@ -439,7 +454,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[TRANSFER_DONE] =
g_signal_new ("transfer-done", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_TP_FILE);
@@ -457,7 +472,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[TRANSFER_ERROR] =
g_signal_new ("transfer-error", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_POINTER);
@@ -476,7 +491,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[TRANSFER_PROGRESS] =
g_signal_new ("transfer-progress", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- _empathy_marshal_VOID__UINT64_UINT64_UINT_DOUBLE,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
4, G_TYPE_UINT64, G_TYPE_UINT64, G_TYPE_UINT, G_TYPE_DOUBLE);
@@ -494,7 +509,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[HASHING_STARTED] =
g_signal_new ("hashing-started", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
/**
@@ -509,7 +524,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[HASHING_PROGRESS] =
g_signal_new ("hashing-progress", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- _empathy_marshal_VOID__UINT64_UINT64,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, G_TYPE_UINT64, G_TYPE_UINT64);
@@ -523,7 +538,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
signals[HASHING_DONE] =
g_signal_new ("hashing-done", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
@@ -709,7 +724,7 @@ ft_handler_create_channel_cb (GObject *source,
EmpathyFTHandler *handler = user_data;
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
GError *error = NULL;
- TpChannel *channel = NULL;
+ TpChannel *channel;
DEBUG ("Dispatcher create channel CB");
@@ -725,18 +740,16 @@ ft_handler_create_channel_cb (GObject *source,
{
emit_error_signal (handler, error);
+ g_clear_object (&channel);
g_error_free (error);
- goto out;
+ return;
}
- priv->tpfile = empathy_tp_file_new (channel);
+ priv->tpfile = EMPATHY_TP_FILE (channel);
empathy_tp_file_offer (priv->tpfile, priv->gfile, priv->cancellable,
ft_transfer_progress_callback, handler,
ft_transfer_operation_callback, handler);
-
-out:
- tp_clear_object (&channel);
}
static void
@@ -751,7 +764,7 @@ ft_handler_push_to_dispatcher (EmpathyFTHandler *handler)
account = empathy_contact_get_account (priv->contact);
req = tp_account_channel_request_new (account, priv->request,
- TP_USER_ACTION_TIME_NOT_USER_ACTION);
+ priv->user_action_time);
tp_account_channel_request_create_and_handle_channel_async (req, NULL,
ft_handler_create_channel_cb, handler);
@@ -1253,27 +1266,12 @@ channel_get_all_properties_cb (TpProxy *proxy,
return;
}
- priv->total_bytes = g_value_get_uint64 (
- g_hash_table_lookup (properties, "Size"));
-
- priv->transferred_bytes = g_value_get_uint64 (
- g_hash_table_lookup (properties, "TransferredBytes"));
-
- priv->filename = g_value_dup_string (
- g_hash_table_lookup (properties, "Filename"));
-
priv->content_hash = g_value_dup_string (
g_hash_table_lookup (properties, "ContentHash"));
priv->content_hash_type = g_value_get_uint (
g_hash_table_lookup (properties, "ContentHashType"));
- priv->content_type = g_value_dup_string (
- g_hash_table_lookup (properties, "ContentType"));
-
- priv->description = g_value_dup_string (
- g_hash_table_lookup (properties, "Description"));
-
c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL);
empathy_tp_contact_factory_get_from_handle (
tp_channel_borrow_connection (TP_CHANNEL (proxy)), c_handle,
@@ -1295,6 +1293,7 @@ channel_get_all_properties_cb (TpProxy *proxy,
void
empathy_ft_handler_new_outgoing (EmpathyContact *contact,
GFile *source,
+ gint64 action_time,
EmpathyFTHandlerReadyCallback callback,
gpointer user_data)
{
@@ -1308,7 +1307,10 @@ empathy_ft_handler_new_outgoing (EmpathyContact *contact,
g_return_if_fail (G_IS_FILE (source));
handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
- "contact", contact, "gfile", source, NULL);
+ "contact", contact,
+ "gfile", source,
+ "user-action-time", action_time,
+ NULL);
priv = GET_PRIV (handler);
@@ -1345,22 +1347,36 @@ empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
gpointer user_data)
{
EmpathyFTHandler *handler;
- TpChannel *channel;
CallbacksData *data;
+ TpFileTransferChannel *ft_chan = (TpFileTransferChannel *) tp_file;
+ EmpathyFTHandlerPriv *priv;
g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
"tp-file", tp_file, NULL);
- g_object_get (tp_file, "channel", &channel, NULL);
+ priv = GET_PRIV (handler);
data = g_slice_new0 (CallbacksData);
data->callback = callback;
data->user_data = user_data;
data->handler = g_object_ref (handler);
- tp_cli_dbus_properties_call_get_all (channel,
+ priv->total_bytes = tp_file_transfer_channel_get_size (ft_chan);
+
+ priv->transferred_bytes = tp_file_transfer_channel_get_transferred_bytes (
+ ft_chan);
+
+ priv->filename = g_strdup (tp_file_transfer_channel_get_filename (ft_chan));
+
+ priv->content_type = g_strdup (tp_file_transfer_channel_get_mime_type (
+ ft_chan));
+
+ priv->description = g_strdup (tp_file_transfer_channel_get_description (
+ ft_chan));
+
+ tp_cli_dbus_properties_call_get_all (tp_file,
-1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
channel_get_all_properties_cb, data, NULL, G_OBJECT (handler));
}
@@ -1574,7 +1590,7 @@ empathy_ft_handler_is_incoming (EmpathyFTHandler *handler)
if (priv->tpfile == NULL)
return FALSE;
- return empathy_tp_file_is_incoming (priv->tpfile);
+ return !tp_channel_get_requested ((TpChannel *) priv->tpfile);
}
/**
diff --git a/libempathy/empathy-ft-handler.h b/libempathy/empathy-ft-handler.h
index 7d4153611..a4392b508 100644
--- a/libempathy/empathy-ft-handler.h
+++ b/libempathy/empathy-ft-handler.h
@@ -71,6 +71,7 @@ GType empathy_ft_handler_get_type (void);
/* public methods */
void empathy_ft_handler_new_outgoing (EmpathyContact *contact,
GFile *source,
+ gint64 action_time,
EmpathyFTHandlerReadyCallback callback,
gpointer user_data);
diff --git a/libempathy/empathy-gsettings.h b/libempathy/empathy-gsettings.h
index d326981d4..fb44b5893 100644
--- a/libempathy/empathy-gsettings.h
+++ b/libempathy/empathy-gsettings.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
#define EMPATHY_PREFS_USE_CONN "use-conn"
#define EMPATHY_PREFS_AUTOCONNECT "autoconnect"
#define EMPATHY_PREFS_AUTOAWAY "autoaway"
-#define EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED "butterfly-logs-migrated"
#define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER "file-transfer-default-folder"
#define EMPATHY_PREFS_NOTIFICATIONS_SCHEMA EMPATHY_PREFS_SCHEMA ".notifications"
@@ -67,6 +66,7 @@ G_BEGIN_DECLS
#define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR "nick-completion-char"
#define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON "avatar-in-icon"
#define EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS "enable-webkit-developer-tools"
+#define EMPATHY_PREFS_CHAT_ROOM_LAST_ACCOUNT "room-last-account"
#define EMPATHY_PREFS_UI_SCHEMA EMPATHY_PREFS_SCHEMA ".ui"
#define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS "separate-chat-windows"
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index 47a01cb8d..833a5692d 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -35,7 +35,6 @@
#include <extensions/extensions.h>
#include "empathy-individual-manager.h"
-#include "empathy-marshal.h"
#include "empathy-utils.h"
#include "empathy-contact-manager.h"
@@ -96,7 +95,7 @@ add_individual (EmpathyIndividualManager *self, FolksIndividual *individual)
EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
g_hash_table_insert (priv->individuals,
- (gpointer) folks_individual_get_id (individual),
+ g_strdup (folks_individual_get_id (individual)),
g_object_ref (individual));
g_signal_connect (individual, "group-changed",
@@ -162,16 +161,20 @@ individual_notify_personas_cb (FolksIndividual *individual,
static void
aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
- GeeSet *added,
- GeeSet *removed,
- const char *message,
- FolksPersona *actor,
- guint reason,
+ GeeMultiMap *changes,
EmpathyIndividualManager *self)
{
EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
GeeIterator *iter;
- GList *added_filtered = NULL, *removed_list = NULL;
+ GeeSet *removed;
+ GeeCollection *added;
+ GList *added_set = NULL, *added_filtered = NULL, *removed_list = NULL;
+
+ /* We're not interested in the relationships between the added and removed
+ * individuals, so just extract collections of them. Note that the added
+ * collection may contain duplicates, while the removed set won't. */
+ removed = gee_multi_map_get_keys (changes);
+ added = gee_multi_map_get_values (changes);
/* Handle the removals first, as one of the added Individuals might have the
* same ID as one of the removed Individuals (due to linking). */
@@ -180,6 +183,9 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
{
FolksIndividual *ind = gee_iterator_get (iter);
+ if (ind == NULL)
+ continue;
+
g_signal_handlers_disconnect_by_func (ind,
individual_notify_personas_cb, self);
@@ -200,6 +206,11 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
{
FolksIndividual *ind = gee_iterator_get (iter);
+ /* Make sure we handle each added individual only once. */
+ if (ind == NULL || g_list_find (added_set, ind) != NULL)
+ continue;
+ added_set = g_list_prepend (added_set, ind);
+
g_signal_connect (ind, "notify::personas",
G_CALLBACK (individual_notify_personas_cb), self);
@@ -213,15 +224,20 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
}
g_clear_object (&iter);
+ g_list_free (added_set);
+
+ g_object_unref (added);
+ g_object_unref (removed);
+
/* Bail if we have no individuals left */
if (added_filtered == NULL && removed == NULL)
return;
added_filtered = g_list_reverse (added_filtered);
- g_signal_emit (self, signals[MEMBERS_CHANGED], 0, message,
+ g_signal_emit (self, signals[MEMBERS_CHANGED], 0, NULL,
added_filtered, removed_list,
- tp_channel_group_change_reason_from_folks_groups_change_reason (reason),
+ TP_CHANNEL_GROUP_CHANGE_REASON_NONE,
TRUE);
g_list_free (added_filtered);
@@ -234,6 +250,9 @@ individual_manager_dispose (GObject *object)
EmpathyIndividualManagerPriv *priv = GET_PRIV (object);
g_hash_table_destroy (priv->individuals);
+
+ g_signal_handlers_disconnect_by_func (priv->aggregator,
+ aggregator_individuals_changed_cb, object);
tp_clear_object (&priv->aggregator);
G_OBJECT_CLASS (empathy_individual_manager_parent_class)->dispose (object);
@@ -294,7 +313,7 @@ empathy_individual_manager_class_init (EmpathyIndividualManagerClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 3, FOLKS_TYPE_INDIVIDUAL, G_TYPE_STRING, G_TYPE_BOOLEAN);
signals[FAVOURITES_CHANGED] =
@@ -303,7 +322,7 @@ empathy_individual_manager_class_init (EmpathyIndividualManagerClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_BOOLEAN,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 2, FOLKS_TYPE_INDIVIDUAL, G_TYPE_BOOLEAN);
signals[MEMBERS_CHANGED] =
@@ -312,7 +331,7 @@ empathy_individual_manager_class_init (EmpathyIndividualManagerClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__STRING_OBJECT_OBJECT_UINT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_UINT);
@@ -328,10 +347,10 @@ empathy_individual_manager_init (EmpathyIndividualManager *self)
self->priv = priv;
priv->individuals = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, g_object_unref);
+ g_free, g_object_unref);
priv->aggregator = folks_individual_aggregator_new ();
- g_signal_connect (priv->aggregator, "individuals-changed",
+ g_signal_connect (priv->aggregator, "individuals-changed-detailed",
G_CALLBACK (aggregator_individuals_changed_cb), self);
folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
}
diff --git a/libempathy/empathy-irc-network.c b/libempathy/empathy-irc-network.c
index 68e071be8..ec0cfffb1 100644
--- a/libempathy/empathy-irc-network.c
+++ b/libempathy/empathy-irc-network.c
@@ -27,7 +27,6 @@
#include <telepathy-glib/util.h>
-#include "empathy-marshal.h"
#include "empathy-irc-network.h"
#include "empathy-utils.h"
@@ -216,7 +215,7 @@ empathy_irc_network_class_init (EmpathyIrcNetworkClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
diff --git a/libempathy/empathy-irc-server.c b/libempathy/empathy-irc-server.c
index 41da5385e..cb1fbfc2f 100644
--- a/libempathy/empathy-irc-server.c
+++ b/libempathy/empathy-irc-server.c
@@ -26,7 +26,6 @@
#include <telepathy-glib/util.h>
-#include "empathy-marshal.h"
#include "empathy-irc-server.h"
#include "empathy-utils.h"
@@ -202,7 +201,7 @@ empathy_irc_server_class_init (EmpathyIrcServerClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
diff --git a/libempathy/empathy-presence-manager.c b/libempathy/empathy-presence-manager.c
index c3eae6583..67867f96d 100644
--- a/libempathy/empathy-presence-manager.c
+++ b/libempathy/empathy-presence-manager.c
@@ -463,7 +463,7 @@ account_manager_ready_cb (GObject *source_object,
self->priv->ready = TRUE;
- if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ if (!tp_proxy_prepare_finish (account_manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
@@ -500,7 +500,7 @@ empathy_presence_manager_init (EmpathyPresenceManager *self)
self->priv->manager = tp_account_manager_dup ();
- tp_account_manager_prepare_async (self->priv->manager, NULL,
+ tp_proxy_prepare_async (self->priv->manager, NULL,
account_manager_ready_cb, self);
tp_g_signal_connect_object (self->priv->manager,
diff --git a/libempathy/empathy-request-util.c b/libempathy/empathy-request-util.c
index 409fdf54a..6b53dab9a 100644
--- a/libempathy/empathy-request-util.c
+++ b/libempathy/empathy-request-util.c
@@ -40,7 +40,7 @@ empathy_chat_with_contact (EmpathyContact *contact,
{
empathy_chat_with_contact_id (
empathy_contact_get_account (contact), empathy_contact_get_id (contact),
- timestamp);
+ timestamp, NULL, NULL);
}
static void
@@ -63,7 +63,9 @@ create_text_channel (TpAccount *account,
TpHandleType target_handle_type,
const gchar *target_id,
gboolean sms_channel,
- gint64 timestamp)
+ gint64 timestamp,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GHashTable *request;
TpAccountChannelRequest *req;
@@ -83,19 +85,23 @@ create_text_channel (TpAccount *account,
tp_account_channel_request_set_delegate_to_preferred_handler (req, TRUE);
tp_account_channel_request_ensure_channel_async (req, EMPATHY_CHAT_BUS_NAME,
- NULL, ensure_text_channel_cb, NULL);
+ NULL, callback ? callback : ensure_text_channel_cb, user_data);
g_hash_table_unref (request);
g_object_unref (req);
}
+/* @callback is optional, but if it's provided, it should call the right
+ * _finish() func that we call in ensure_text_channel_cb() */
void
empathy_chat_with_contact_id (TpAccount *account,
const gchar *contact_id,
- gint64 timestamp)
+ gint64 timestamp,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
create_text_channel (account, TP_HANDLE_TYPE_CONTACT,
- contact_id, FALSE, timestamp);
+ contact_id, FALSE, timestamp, callback, user_data);
}
void
@@ -104,14 +110,18 @@ empathy_join_muc (TpAccount *account,
gint64 timestamp)
{
create_text_channel (account, TP_HANDLE_TYPE_ROOM,
- room_name, FALSE, timestamp);
+ room_name, FALSE, timestamp, NULL, NULL);
}
+/* @callback is optional, but if it's provided, it should call the right
+ * _finish() func that we call in ensure_text_channel_cb() */
void
empathy_sms_contact_id (TpAccount *account,
const gchar *contact_id,
- gint64 timestamp)
+ gint64 timestamp,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
create_text_channel (account, TP_HANDLE_TYPE_CONTACT,
- contact_id, TRUE, timestamp);
+ contact_id, TRUE, timestamp, callback, user_data);
}
diff --git a/libempathy/empathy-request-util.h b/libempathy/empathy-request-util.h
index 70a607e73..6781b72d4 100644
--- a/libempathy/empathy-request-util.h
+++ b/libempathy/empathy-request-util.h
@@ -45,9 +45,11 @@ G_BEGIN_DECLS
/* Requesting 1 to 1 text channels */
void empathy_chat_with_contact_id (TpAccount *account,
const gchar *contact_id,
- gint64 timestamp);
+ gint64 timestamp,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
-void empathy_chat_with_contact (EmpathyContact *contact,
+void empathy_chat_with_contact (EmpathyContact *contact,
gint64 timestamp);
/* Request a muc channel */
@@ -58,7 +60,9 @@ void empathy_join_muc (TpAccount *account,
/* Request a sms channel */
void empathy_sms_contact_id (TpAccount *account,
const gchar *contact_id,
- gint64 timestamp);
+ gint64 timestamp,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
G_END_DECLS
diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c
index b06d7bf4c..d37851405 100644
--- a/libempathy/empathy-server-sasl-handler.c
+++ b/libempathy/empathy-server-sasl-handler.c
@@ -50,6 +50,7 @@ typedef struct {
GSimpleAsyncResult *result;
gchar *password;
+ gboolean save_password;
GSimpleAsyncResult *async_init_res;
} EmpathyServerSASLHandlerPriv;
@@ -71,6 +72,25 @@ static const gchar *sasl_statuses[] = {
};
static void
+empathy_server_sasl_handler_set_password_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!empathy_keyring_set_account_password_finish (TP_ACCOUNT (source), result,
+ &error))
+ {
+ DEBUG ("Failed to set password: %s", error->message);
+ g_clear_error (&error);
+ }
+ else
+ {
+ DEBUG ("Password set successfully.");
+ }
+}
+
+static void
sasl_status_changed_cb (TpChannel *channel,
TpSASLStatus status,
const gchar *error,
@@ -91,6 +111,15 @@ sasl_status_changed_cb (TpChannel *channel,
if (status == TP_SASL_STATUS_SERVER_SUCCEEDED)
{
+ if (priv->save_password)
+ {
+ DEBUG ("Saving password in keyring");
+
+ empathy_keyring_set_account_password_async (priv->account,
+ priv->password, empathy_server_sasl_handler_set_password_cb,
+ NULL);
+ }
+
DEBUG ("Calling AcceptSASL");
tp_cli_channel_interface_sasl_authentication_call_accept_sasl (
priv->channel, -1, NULL, NULL, NULL, NULL);
@@ -308,7 +337,7 @@ empathy_server_sasl_handler_class_init (EmpathyServerSASLHandlerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
@@ -369,25 +398,6 @@ start_mechanism_with_data_cb (TpChannel *proxy,
DEBUG ("Started mechanism successfully");
}
-static void
-empathy_server_sasl_handler_set_password_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- GError *error = NULL;
-
- if (!empathy_keyring_set_account_password_finish (TP_ACCOUNT (source), result,
- &error))
- {
- DEBUG ("Failed to set password: %s", error->message);
- g_clear_error (&error);
- }
- else
- {
- DEBUG ("Password set successfully.");
- }
-}
-
void
empathy_server_sasl_handler_provide_password (
EmpathyServerSASLHandler *handler,
@@ -433,9 +443,11 @@ empathy_server_sasl_handler_provide_password (
{
if (may_save_response)
{
- DEBUG ("Saving password in keyring");
- empathy_keyring_set_account_password_async (priv->account, password,
- empathy_server_sasl_handler_set_password_cb, NULL);
+ g_free (priv->password);
+
+ /* We'll save the password if we manage to connect */
+ priv->password = g_strdup (password);
+ priv->save_password = TRUE;
}
else if (tp_proxy_has_interface_by_id (priv->channel,
EMP_IFACE_QUARK_CHANNEL_INTERFACE_CREDENTIALS_STORAGE))
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 27003561e..dcd6193ec 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -30,7 +30,6 @@
#include "empathy-tp-chat.h"
#include "empathy-tp-contact-factory.h"
#include "empathy-contact-list.h"
-#include "empathy-marshal.h"
#include "empathy-request-util.h"
#include "empathy-time.h"
#include "empathy-utils.h"
@@ -686,13 +685,13 @@ tp_chat_list_properties_cb (TpProxy *proxy,
GArray *ids;
guint i;
- self->priv->had_properties_list = TRUE;
-
if (error) {
DEBUG ("Error listing properties: %s", error->message);
return;
}
+ self->priv->had_properties_list = TRUE;
+
ids = g_array_sized_new (FALSE, FALSE, sizeof (guint), properties->len);
self->priv->properties = g_ptr_array_sized_new (properties->len);
for (i = 0; i < properties->len; i++) {
@@ -890,66 +889,6 @@ check_almost_ready (EmpathyTpChat *self)
}
static void
-tp_chat_update_remote_contact (EmpathyTpChat *self)
-{
- TpChannel *channel = (TpChannel *) self;
- EmpathyContact *contact = NULL;
- TpHandle self_handle;
- TpHandleType handle_type;
- GList *l;
-
- /* If this is a named chatroom, never pretend it is a private chat */
- tp_channel_get_handle (channel, &handle_type);
- if (handle_type == TP_HANDLE_TYPE_ROOM) {
- return;
- }
-
- /* This is an MSN chat, but it's the new style where 1-1 chats don't
- * have the group interface. If it has the conference interface, then
- * it is indeed a MUC. */
- if (tp_proxy_has_interface_by_id (self,
- TP_IFACE_QUARK_CHANNEL_INTERFACE_CONFERENCE)) {
- return;
- }
-
- /* This is an MSN-like chat where anyone can join the chat at anytime.
- * If there is only one non-self contact member, we are in a private
- * chat and we set the "remote-contact" property to that contact. If
- * there are more, set the "remote-contact" property to NULL and the
- * UI will display a contact list. */
- self_handle = tp_channel_group_get_self_handle (channel);
- for (l = self->priv->members; l; l = l->next) {
- /* Skip self contact if member */
- if (empathy_contact_get_handle (l->data) == self_handle) {
- continue;
- }
-
- /* We have more than one remote contact, break */
- if (contact != NULL) {
- contact = NULL;
- break;
- }
-
- /* If we didn't find yet a remote contact, keep this one */
- contact = l->data;
- }
-
- if (self->priv->remote_contact == contact) {
- return;
- }
-
- DEBUG ("Changing remote contact from %p to %p",
- self->priv->remote_contact, contact);
-
- if (self->priv->remote_contact) {
- g_object_unref (self->priv->remote_contact);
- }
-
- self->priv->remote_contact = contact ? g_object_ref (contact) : NULL;
- g_object_notify (G_OBJECT (self), "remote-contact");
-}
-
-static void
tp_chat_got_added_contacts_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
@@ -984,7 +923,6 @@ tp_chat_got_added_contacts_cb (TpConnection *connection,
}
}
- tp_chat_update_remote_contact (EMPATHY_TP_CHAT (chat));
check_almost_ready (EMPATHY_TP_CHAT (chat));
}
@@ -1092,7 +1030,6 @@ tp_chat_got_renamed_contacts_cb (TpConnection *connection,
self->priv->user = g_object_ref (new);
}
- tp_chat_update_remote_contact (self);
check_almost_ready (self);
}
@@ -1168,8 +1105,6 @@ tp_chat_group_members_changed_cb (TpChannel *channel,
G_OBJECT (self));
}
- tp_chat_update_remote_contact (self);
-
if (actor_contact != NULL) {
g_object_unref (actor_contact);
}
@@ -1331,7 +1266,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_MESSAGE);
@@ -1341,7 +1276,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__STRING_UINT_STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
3, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
@@ -1351,7 +1286,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__OBJECT_UINT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, EMPATHY_TYPE_CONTACT, G_TYPE_UINT);
@@ -1361,7 +1296,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- _empathy_marshal_VOID__STRING_BOXED,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, G_TYPE_STRING, G_TYPE_VALUE);
@@ -1371,7 +1306,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_MESSAGE);
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index 3bb2dd49c..ff2099ee9 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -44,7 +44,6 @@
#include <telepathy-glib/interfaces.h>
#include "empathy-tp-file.h"
-#include "empathy-marshal.h"
#include "empathy-time.h"
#include "empathy-utils.h"
@@ -66,8 +65,6 @@
/* EmpathyTpFile object */
struct _EmpathyTpFilePrivate {
- TpChannel *channel;
-
GInputStream *in_stream;
GOutputStream *out_stream;
@@ -78,7 +75,6 @@ struct _EmpathyTpFilePrivate {
TpSocketAccessControl socket_access_control;
/* transfer properties */
- gboolean incoming;
gint64 start_time;
GArray *socket_address;
guint port;
@@ -97,13 +93,7 @@ struct _EmpathyTpFilePrivate {
gboolean is_closed;
};
-enum {
- PROP_0,
- PROP_CHANNEL,
- PROP_INCOMING
-};
-
-G_DEFINE_TYPE (EmpathyTpFile, empathy_tp_file, G_TYPE_OBJECT);
+G_DEFINE_TYPE (EmpathyTpFile, empathy_tp_file, TP_TYPE_FILE_TRANSFER_CHANNEL);
/* private functions */
@@ -343,7 +333,7 @@ tp_file_start_transfer (EmpathyTpFile *self)
if (self->priv->progress_callback != NULL)
self->priv->progress_callback (self, 0, self->priv->progress_user_data);
- if (self->priv->incoming)
+ if (!tp_channel_get_requested ((TpChannel *) self))
{
GInputStream *socket_stream;
@@ -429,7 +419,7 @@ tp_file_state_changed_cb (TpChannel *proxy,
"old state = %u, state = %u, reason = %u\n"
"\tincoming = %s, in_stream = %s, out_stream = %s",
self->priv->state, state, reason,
- self->priv->incoming ? "yes" : "no",
+ tp_channel_get_requested (proxy) ? "no" : "yes",
self->priv->in_stream ? "present" : "not present",
self->priv->out_stream ? "present" : "not present");
@@ -456,12 +446,13 @@ tp_file_state_changed_cb (TpChannel *proxy,
}
static void
-tp_file_transferred_bytes_changed_cb (TpChannel *proxy,
- guint64 count,
- gpointer user_data,
- GObject *weak_object)
+tp_file_transferred_bytes_changed_cb (TpFileTransferChannel *channel,
+ GParamSpec *spec,
+ EmpathyTpFile *self)
{
- EmpathyTpFile *self = (EmpathyTpFile *) weak_object;
+ guint64 count;
+
+ count = tp_file_transfer_channel_get_transferred_bytes (channel);
/* don't notify for 0 bytes count */
if (count == 0)
@@ -469,8 +460,7 @@ tp_file_transferred_bytes_changed_cb (TpChannel *proxy,
/* notify clients */
if (self->priv->progress_callback != NULL)
- self->priv->progress_callback (EMPATHY_TP_FILE (weak_object),
- count, self->priv->progress_user_data);
+ self->priv->progress_callback (self, count, self->priv->progress_user_data);
}
static void
@@ -589,8 +579,7 @@ file_read_async_cb (GObject *source,
*/
initialize_empty_ac_variant (self->priv->socket_access_control, &nothing);
- tp_cli_channel_type_file_transfer_call_provide_file (
- self->priv->channel, -1,
+ tp_cli_channel_type_file_transfer_call_provide_file ((TpChannel *) self, -1,
self->priv->socket_address_type, self->priv->socket_access_control,
&nothing, ft_operation_provide_or_accept_file_cb,
NULL, NULL, G_OBJECT (self));
@@ -616,7 +605,7 @@ file_transfer_set_uri_cb (TpProxy *proxy,
*/
initialize_empty_ac_variant (self->priv->socket_access_control, &nothing);
- tp_cli_channel_type_file_transfer_call_accept_file (self->priv->channel,
+ tp_cli_channel_type_file_transfer_call_accept_file ((TpChannel *) self,
-1, self->priv->socket_address_type, self->priv->socket_access_control,
&nothing, self->priv->offset,
ft_operation_provide_or_accept_file_cb, NULL, NULL, weak_object);
@@ -650,7 +639,7 @@ file_replace_async_cb (GObject *source,
uri = g_file_get_uri (file);
value = tp_g_value_slice_new_take_string (uri);
- tp_cli_dbus_properties_call_set (self->priv->channel, -1,
+ tp_cli_dbus_properties_call_set ((TpChannel *) self, -1,
TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "URI", value,
file_transfer_set_uri_cb, NULL, NULL, G_OBJECT (self));
@@ -682,7 +671,7 @@ close_channel_internal (EmpathyTpFile *self,
self->priv->is_closing = TRUE;
- tp_cli_channel_call_close (self->priv->channel, -1,
+ tp_cli_channel_call_close ((TpChannel *) self, -1,
channel_closed_cb, GINT_TO_POINTER (cancel), NULL, G_OBJECT (self));
}
@@ -700,13 +689,6 @@ do_dispose (GObject *object)
{
EmpathyTpFile *self = (EmpathyTpFile *) object;
- if (self->priv->channel != NULL)
- {
- g_signal_handlers_disconnect_by_func (self->priv->channel,
- tp_file_invalidated_cb, object);
- tp_clear_object (&self->priv->channel);
- }
-
tp_clear_object (&self->priv->in_stream);
tp_clear_object (&self->priv->out_stream);
tp_clear_object (&self->priv->cancellable);
@@ -731,73 +713,32 @@ do_finalize (GObject *object)
}
static void
-do_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EmpathyTpFile *self = (EmpathyTpFile *) object;
-
- switch (param_id)
- {
- case PROP_CHANNEL:
- g_value_set_object (value, self->priv->channel);
- break;
- case PROP_INCOMING:
- g_value_set_boolean (value, self->priv->incoming);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-do_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EmpathyTpFile *self = (EmpathyTpFile *) object;
-
- switch (param_id)
- {
- case PROP_CHANNEL:
- self->priv->channel = g_object_ref (g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
do_constructed (GObject *object)
{
EmpathyTpFile *self = (EmpathyTpFile *) object;
+ TpChannel *channel = (TpChannel *) self;
- g_signal_connect (self->priv->channel, "invalidated",
+ g_signal_connect (self, "invalidated",
G_CALLBACK (tp_file_invalidated_cb), self);
- self->priv->incoming = !tp_channel_get_requested (self->priv->channel);
-
tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed (
- self->priv->channel, tp_file_state_changed_cb, NULL, NULL, object, NULL);
+ channel, tp_file_state_changed_cb, NULL, NULL, object, NULL);
- tp_cli_channel_type_file_transfer_connect_to_transferred_bytes_changed (
- self->priv->channel, tp_file_transferred_bytes_changed_cb,
- NULL, NULL, object, NULL);
+ g_signal_connect (self, "notify::transferred-bytes",
+ G_CALLBACK (tp_file_transferred_bytes_changed_cb), self);
- tp_cli_dbus_properties_call_get (self->priv->channel,
+ tp_cli_dbus_properties_call_get (channel,
-1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "State", tp_file_get_state_cb,
NULL, NULL, object);
- tp_cli_dbus_properties_call_get (self->priv->channel,
+ tp_cli_dbus_properties_call_get (channel,
-1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "AvailableSocketTypes",
tp_file_get_available_socket_types_cb, NULL, NULL, object);
self->priv->state_change_reason =
TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE;
+
+ G_OBJECT_CLASS (empathy_tp_file_parent_class)->constructed (object);
}
static void
@@ -808,66 +749,32 @@ empathy_tp_file_class_init (EmpathyTpFileClass *klass)
object_class->finalize = do_finalize;
object_class->dispose = do_dispose;
object_class->constructed = do_constructed;
- object_class->get_property = do_get_property;
- object_class->set_property = do_set_property;
-
- /* Construct-only properties */
-
- /**
- * EmpathyTpFile:channel:
- *
- * The #TpChannel requested for the file transfer.
- */
- g_object_class_install_property (object_class,
- PROP_CHANNEL,
- g_param_spec_object ("channel",
- "telepathy channel",
- "The file transfer channel",
- TP_TYPE_CHANNEL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- /**
- * EmpathyTpFile:incoming:
- *
- * %TRUE if the transfer is incoming, %FALSE if it's outgoing.
- */
- g_object_class_install_property (object_class,
- PROP_INCOMING,
- g_param_spec_boolean ("incoming",
- "direction of transfer",
- "The direction of the file being transferred",
- FALSE,
- G_PARAM_READABLE));
g_type_class_add_private (object_class, sizeof (EmpathyTpFilePrivate));
}
/* public methods */
-/**
- * empathy_tp_file_new:
- * @channel: a #TpChannel
- * @incoming: whether the file transfer is incoming or not
- *
- * Creates a new #EmpathyTpFile wrapping @channel.
- * The returned #EmpathyTpFile should be unrefed
- * with g_object_unref() when finished with.
- *
- * Return value: a new #EmpathyTpFile
- */
EmpathyTpFile *
-empathy_tp_file_new (TpChannel *channel)
+empathy_tp_file_new (TpSimpleClientFactory *factory,
+ TpConnection *conn,
+ const gchar *object_path,
+ const GHashTable *immutable_properties,
+ GError **error)
{
- EmpathyTpFile *self;
-
- g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
-
- self = g_object_new (EMPATHY_TYPE_TP_FILE,
- "channel", channel,
- NULL);
-
- return self;
+ TpProxy *conn_proxy = (TpProxy *) conn;
+
+ g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
+ g_return_val_if_fail (immutable_properties != NULL, NULL);
+
+ return g_object_new (EMPATHY_TYPE_TP_FILE,
+ "factory", factory,
+ "connection", conn,
+ "dbus-daemon", conn_proxy->dbus_daemon,
+ "bus-name", conn_proxy->bus_name,
+ "object-path", object_path,
+ "channel-properties", immutable_properties,
+ NULL);
}
/**
@@ -957,22 +864,6 @@ empathy_tp_file_offer (EmpathyTpFile *self,
}
/**
- * empathy_tp_file_is_incoming:
- * @self: an #EmpathyTpFile
- *
- * Returns whether @self is incoming.
- *
- * Return value: %TRUE if the @self is incoming, otherwise %FALSE
- */
-gboolean
-empathy_tp_file_is_incoming (EmpathyTpFile *self)
-{
- g_return_val_if_fail (EMPATHY_IS_TP_FILE (self), FALSE);
-
- return self->priv->incoming;
-}
-
-/**
* empathy_tp_file_cancel:
* @self: an #EmpathyTpFile
*
diff --git a/libempathy/empathy-tp-file.h b/libempathy/empathy-tp-file.h
index aca8a0f89..6afb806df 100644
--- a/libempathy/empathy-tp-file.h
+++ b/libempathy/empathy-tp-file.h
@@ -27,7 +27,7 @@
#include <gio/gio.h>
#include <glib.h>
-#include <telepathy-glib/channel.h>
+#include <telepathy-glib/file-transfer-channel.h>
G_BEGIN_DECLS
@@ -60,12 +60,12 @@ typedef struct _EmpathyTpFilePrivate EmpathyTpFilePrivate;
typedef struct _EmpathyTpFileClass EmpathyTpFileClass;
struct _EmpathyTpFile {
- GObject parent;
+ TpFileTransferChannel parent;
EmpathyTpFilePrivate *priv;
};
struct _EmpathyTpFileClass {
- GObjectClass parent_class;
+ TpFileTransferChannelClass parent_class;
};
/* prototypes for operation callbacks */
@@ -96,7 +96,11 @@ GType empathy_tp_file_get_type (void) G_GNUC_CONST;
/* public methods */
-EmpathyTpFile * empathy_tp_file_new (TpChannel *channel);
+EmpathyTpFile * empathy_tp_file_new (TpSimpleClientFactory *factory,
+ TpConnection *conn,
+ const gchar *object_path,
+ const GHashTable *immutable_properties,
+ GError **error);
void empathy_tp_file_accept (EmpathyTpFile *tp_file,
guint64 offset,
@@ -118,8 +122,6 @@ void empathy_tp_file_offer (EmpathyTpFile *tp_file,
void empathy_tp_file_cancel (EmpathyTpFile *tp_file);
void empathy_tp_file_close (EmpathyTpFile *tp_file);
-gboolean empathy_tp_file_is_incoming (EmpathyTpFile *tp_file);
-
G_END_DECLS
#endif /* __EMPATHY_TP_FILE_H__ */
diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c
index d66bfc0f1..1e53facdc 100644
--- a/libempathy/empathy-tp-roomlist.c
+++ b/libempathy/empathy-tp-roomlist.c
@@ -275,7 +275,7 @@ tp_roomlist_create_channel_cb (GObject *source,
if (priv->channel == NULL) {
DEBUG ("Error creating channel: %s", error->message);
g_error_free (error);
- return;
+ goto out;
}
g_signal_connect (priv->channel, "invalidated",
@@ -299,9 +299,12 @@ tp_roomlist_create_channel_cb (GObject *source,
if (priv->start_requested == TRUE) {
tp_cli_channel_type_room_list_call_list_rooms (priv->channel, -1,
- call_list_rooms_cb, self, NULL, NULL);
+ call_list_rooms_cb, self, NULL, G_OBJECT (self));
priv->start_requested = FALSE;
}
+
+out:
+ g_object_unref (self);
}
static void
@@ -348,6 +351,9 @@ tp_roomlist_constructed (GObject *list)
req = tp_account_channel_request_new (priv->account, request,
TP_USER_ACTION_TIME_CURRENT_TIME);
+ /* Ensure we stay alive during the async call */
+ g_object_ref (list);
+
tp_account_channel_request_create_and_handle_channel_async (req, NULL,
tp_roomlist_create_channel_cb, list);
@@ -426,7 +432,7 @@ empathy_tp_roomlist_class_init (EmpathyTpRoomlistClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, EMPATHY_TYPE_CHATROOM);
@@ -436,7 +442,7 @@ empathy_tp_roomlist_class_init (EmpathyTpRoomlistClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
0);
@@ -446,7 +452,7 @@ empathy_tp_roomlist_class_init (EmpathyTpRoomlistClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_POINTER);
diff --git a/libempathy/empathy-tp-streamed-media.c b/libempathy/empathy-tp-streamed-media.c
index b79e4b6b5..87ca01db5 100644
--- a/libempathy/empathy-tp-streamed-media.c
+++ b/libempathy/empathy-tp-streamed-media.c
@@ -30,7 +30,6 @@
#include "empathy-tp-streamed-media.h"
#include "empathy-tp-contact-factory.h"
#include "empathy-utils.h"
-#include "empathy-marshal.h"
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
#include "empathy-debug.h"
@@ -566,7 +565,7 @@ empathy_tp_streamed_media_class_init (EmpathyTpStreamedMediaClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- _empathy_marshal_VOID__UINT_STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, G_TYPE_UINT, G_TYPE_STRING);
@@ -575,7 +574,7 @@ empathy_tp_streamed_media_class_init (EmpathyTpStreamedMediaClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
NULL, NULL,
- _empathy_marshal_VOID__UINT_STRING,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
2, G_TYPE_UINT, G_TYPE_STRING);
}
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index a1047334d..9eec82e74 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -80,6 +80,16 @@ static struct {
{ NULL, },
};
+static gboolean
+properties_contains (gchar **list,
+ gint length,
+ const gchar *property);
+
+static gboolean
+check_writeable_property (TpConnection *connection,
+ FolksIndividual *individual,
+ gchar *property);
+
void
empathy_init (void)
{
@@ -727,6 +737,12 @@ empathy_contact_dup_from_folks_individual (FolksIndividual *individual)
}
g_clear_object (&iter);
+ if (contact == NULL)
+ {
+ DEBUG ("Can't create an EmpathyContact for Individual %s",
+ folks_individual_get_id (individual));
+ }
+
return contact;
}
@@ -798,10 +814,10 @@ empathy_connection_can_add_personas (TpConnection *connection)
}
gboolean
-empathy_connection_can_alias_personas (TpConnection *connection)
+empathy_connection_can_alias_personas (TpConnection *connection,
+ FolksIndividual *individual)
{
gboolean retval;
- FolksPersonaStore *persona_store;
g_return_val_if_fail (TP_IS_CONNECTION (connection), FALSE);
@@ -809,22 +825,16 @@ empathy_connection_can_alias_personas (TpConnection *connection)
TP_CONNECTION_STATUS_CONNECTED)
return FALSE;
- persona_store = FOLKS_PERSONA_STORE (
- empathy_dup_persona_store_for_connection (connection));
-
- retval = (folks_persona_store_get_can_alias_personas (persona_store) ==
- FOLKS_MAYBE_BOOL_TRUE);
-
- g_clear_object (&persona_store);
+ retval = check_writeable_property (connection, individual, "alias");
return retval;
}
gboolean
-empathy_connection_can_group_personas (TpConnection *connection)
+empathy_connection_can_group_personas (TpConnection *connection,
+ FolksIndividual *individual)
{
gboolean retval;
- FolksPersonaStore *persona_store;
g_return_val_if_fail (TP_IS_CONNECTION (connection), FALSE);
@@ -832,13 +842,7 @@ empathy_connection_can_group_personas (TpConnection *connection)
TP_CONNECTION_STATUS_CONNECTED)
return FALSE;
- persona_store = FOLKS_PERSONA_STORE (
- empathy_dup_persona_store_for_connection (connection));
-
- retval = (folks_persona_store_get_can_group_personas (persona_store) ==
- FOLKS_MAYBE_BOOL_TRUE);
-
- g_clear_object (&persona_store);
+ retval = check_writeable_property (connection, individual, "groups");
return retval;
}
@@ -988,3 +992,101 @@ empathy_account_has_uri_scheme_tel (TpAccount *account)
return FALSE;
}
+
+/* Return the TpContact on @conn associated with @individual, if any */
+TpContact *
+empathy_get_tp_contact_for_individual (FolksIndividual *individual,
+ TpConnection *conn)
+{
+ TpContact *contact = NULL;
+ GeeSet *personas;
+ GeeIterator *iter;
+
+ personas = folks_individual_get_personas (individual);
+ iter = gee_iterable_iterator (GEE_ITERABLE (personas));
+ while (contact == NULL && gee_iterator_next (iter))
+ {
+ TpfPersona *persona = gee_iterator_get (iter);
+ TpConnection *contact_conn;
+ TpContact *contact_cur = NULL;
+
+ if (TPF_IS_PERSONA (persona))
+ {
+ contact_cur = tpf_persona_get_contact (persona);
+ if (contact_cur != NULL)
+ {
+ contact_conn = tp_contact_get_connection (contact_cur);
+
+ if (!tp_strdiff (tp_proxy_get_object_path (contact_conn),
+ tp_proxy_get_object_path (conn)))
+ contact = contact_cur;
+ }
+ }
+
+ g_clear_object (&persona);
+ }
+ g_clear_object (&iter);
+
+ return contact;
+}
+
+static gboolean
+properties_contains (gchar **list,
+ gint length,
+ const gchar *property)
+{
+ gint i;
+
+ for (i = 0; i < length; i++)
+ {
+ if (!tp_strdiff (list[i], property))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+check_writeable_property (TpConnection *connection,
+ FolksIndividual *individual,
+ gchar *property)
+{
+ gchar **properties;
+ gint prop_len;
+ gboolean retval = FALSE;
+ GeeSet *personas;
+ GeeIterator *iter;
+ FolksPersonaStore *persona_store;
+
+ persona_store = FOLKS_PERSONA_STORE (
+ empathy_dup_persona_store_for_connection (connection));
+
+ properties =
+ folks_persona_store_get_always_writeable_properties (persona_store,
+ &prop_len);
+ retval = properties_contains (properties, prop_len, property);
+ if (retval == TRUE)
+ goto out;
+
+ /* Lets see if the Individual contains a Persona with the given property */
+ personas = folks_individual_get_personas (individual);
+ iter = gee_iterable_iterator (GEE_ITERABLE (personas));
+ while (!retval && gee_iterator_next (iter))
+ {
+ FolksPersona *persona = gee_iterator_get (iter);
+
+ properties =
+ folks_persona_get_writeable_properties (persona, &prop_len);
+ retval = properties_contains (properties, prop_len, property);
+
+ g_clear_object (&persona);
+
+ if (retval == TRUE)
+ break;
+ }
+ g_clear_object (&iter);
+
+out:
+ g_clear_object (&persona_store);
+ return retval;
+}
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index fb25d7a99..ed603a80f 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -96,8 +96,10 @@ TpChannelGroupChangeReason tp_channel_group_change_reason_from_folks_groups_chan
TpfPersonaStore * empathy_dup_persona_store_for_connection (
TpConnection *connection);
gboolean empathy_connection_can_add_personas (TpConnection *connection);
-gboolean empathy_connection_can_alias_personas (TpConnection *connection);
-gboolean empathy_connection_can_group_personas (TpConnection *connection);
+gboolean empathy_connection_can_alias_personas (TpConnection *connection,
+ FolksIndividual *individual);
+gboolean empathy_connection_can_group_personas (TpConnection *connection,
+ FolksIndividual *individual);
gboolean empathy_folks_persona_is_interesting (FolksPersona *persona);
gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert);
@@ -108,6 +110,9 @@ gchar *empathy_format_currency (gint amount,
gboolean empathy_account_has_uri_scheme_tel (TpAccount *account);
+TpContact * empathy_get_tp_contact_for_individual (FolksIndividual *individual,
+ TpConnection *conn);
+
/* Copied from wocky/wocky-utils.h */
#define empathy_implement_finish_void(source, tag) \