[Telepathy-commits] [telepathy-gabble/master] Add a gabble_tube_dbus_offer stub
Will Thompson
will.thompson at collabora.co.uk
Tue Feb 3 03:36:32 PST 2009
---
src/tube-dbus.c | 16 ++++++++++++++++
src/tube-dbus.h | 2 ++
src/tubes-channel.c | 10 ++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/tube-dbus.c b/src/tube-dbus.c
index a4883ea..99f8845 100644
--- a/src/tube-dbus.c
+++ b/src/tube-dbus.c
@@ -1130,6 +1130,22 @@ gabble_tube_dbus_class_init (GabbleTubeDBusClass *gabble_tube_dbus_class)
tp_external_group_mixin_init_dbus_properties (object_class);
}
+gboolean
+gabble_tube_dbus_offer (GabbleTubeDBus *tube,
+ GError **error)
+{
+ if (tube->priv->offered)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "Tube has already been offered");
+ return FALSE;
+ }
+
+ tube->priv->offered = TRUE;
+ g_signal_emit (G_OBJECT (tube), signals[OFFERED], 0);
+ return TRUE;
+}
+
static void
message_received (GabbleTubeDBus *tube,
TpHandle sender,
diff --git a/src/tube-dbus.h b/src/tube-dbus.h
index 3efaeac..cdcc177 100644
--- a/src/tube-dbus.h
+++ b/src/tube-dbus.h
@@ -74,6 +74,8 @@ gboolean gabble_tube_dbus_remove_name (GabbleTubeDBus *tube, TpHandle handle);
gboolean gabble_tube_dbus_handle_in_names (GabbleTubeDBus *tube,
TpHandle handle);
+gboolean gabble_tube_dbus_offer (GabbleTubeDBus *tube, GError **error);
+
void gabble_tube_dbus_listen (GabbleTubeDBus *self);
/* Only extern for the benefit of tests/test-dtube-unique-names.c */
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 15c2dcb..26389d1 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -1709,6 +1709,16 @@ gabble_tubes_channel_offer_d_bus_tube (TpSvcChannelTypeTubes *iface,
g_free (stream_id);
return;
}
+
+ if (!gabble_tube_dbus_offer (GABBLE_TUBE_DBUS (tube), &error))
+ {
+ gabble_tube_iface_close (tube, TRUE);
+ dbus_g_method_return_error (context, error);
+
+ g_error_free (error);
+ g_free (stream_id);
+ return;
+ }
}
tp_svc_channel_type_tubes_return_from_offer_d_bus_tube (context, tube_id);
--
1.5.6.5
More information about the telepathy-commits
mailing list