summaryrefslogtreecommitdiff
path: root/src/media-channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/media-channel.c')
-rw-r--r--src/media-channel.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/media-channel.c b/src/media-channel.c
index 54c2a41..934eeb8 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -265,7 +265,7 @@ pending_stream_request_free (gpointer data)
if (p->context != NULL)
{
- GError e = { TP_ERROR, TP_ERROR_CANCELLED,
+ GError e = { TP_ERRORS, TP_ERROR_CANCELLED,
"The session terminated before the requested streams could be added"
};
@@ -609,6 +609,7 @@ haze_media_channel_constructor (GType type, guint n_props,
/* automatically add creator to channel, but also ref them again (because
* priv->creator is the InitiatorHandle) */
g_assert (priv->creator != 0);
+ tp_handle_ref (contact_handles, priv->creator);
set = tp_intset_new_containing (priv->creator);
tp_group_mixin_change_members (obj, "", set, NULL, NULL, NULL, 0,
@@ -786,6 +787,15 @@ haze_media_channel_set_property (GObject *object,
break;
case PROP_INITIAL_PEER:
priv->initial_peer = g_value_get_uint (value);
+
+ if (priv->initial_peer != 0)
+ {
+ TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn;
+ TpHandleRepoIface *repo = tp_base_connection_get_handles (base_conn,
+ TP_HANDLE_TYPE_CONTACT);
+ tp_handle_ref (repo, priv->initial_peer);
+ }
+
break;
case PROP_MEDIA:
g_assert (priv->media == NULL);
@@ -957,6 +967,9 @@ haze_media_channel_dispose (GObject *object)
{
HazeMediaChannel *self = HAZE_MEDIA_CHANNEL (object);
HazeMediaChannelPrivate *priv = self->priv;
+ TpBaseConnection *conn = (TpBaseConnection *) priv->conn;
+ TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (
+ conn, TP_HANDLE_TYPE_CONTACT);
if (priv->dispose_has_run)
return;
@@ -970,6 +983,15 @@ haze_media_channel_dispose (GObject *object)
g_assert (priv->closed);
+ tp_handle_unref (contact_handles, priv->creator);
+ priv->creator = 0;
+
+ if (priv->initial_peer != 0)
+ {
+ tp_handle_unref (contact_handles, priv->initial_peer);
+ priv->initial_peer = 0;
+ }
+
if (priv->media != NULL)
g_object_unref (priv->media);
priv->media = NULL;
@@ -1157,7 +1179,7 @@ haze_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface,
GError *e;
g_object_get (base_conn, "protocol", &name, NULL);
- g_set_error (&e, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (&e, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
"Streams can't be removed in Haze's \"%s\" protocol's calls", name);
g_free (name);
@@ -1194,7 +1216,7 @@ haze_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface,
if (j >= backend_streams->len)
{
- GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
+ GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
"Requested stream wasn't found" };
DEBUG ("%s", e.message);
dbus_g_method_return_error (context, &e);
@@ -1239,7 +1261,7 @@ haze_media_channel_request_stream_direction (TpSvcChannelTypeStreamedMedia *ifac
DBusGMethodInvocation *context)
{
/* Libpurple doesn't have API for this yet */
- GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ GError e = { TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
"Stream direction can't be set Haze calls" };
DEBUG ("%s", e.message);
dbus_g_method_return_error (context, &e);
@@ -1305,7 +1327,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan,
}
else
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
"given media type %u is invalid", media_type);
return FALSE;
}
@@ -1326,7 +1348,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan,
gchar *name;
g_object_get (base_conn, "protocol", &name, NULL);
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Streams can't be added in Haze's \"%s\" protocol's calls",
name);
@@ -1338,7 +1360,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan,
if ((want_audio == FALSE || caps & PURPLE_MEDIA_CAPS_AUDIO) &&
(want_video == FALSE || caps & PURPLE_MEDIA_CAPS_VIDEO))
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Member does not have the desired audio/video capabilities");
return FALSE;
}
@@ -1420,7 +1442,7 @@ media_channel_request_streams (HazeMediaChannel *self,
if (peer != contact_handle)
{
- g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"cannot add streams for %u: this channel's peer is %u",
contact_handle, peer);
goto error;
@@ -1559,7 +1581,7 @@ haze_media_channel_add_member (GObject *obj,
if (peer != handle)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"handle %u cannot be added: this channel's peer is %u",
handle, peer);
return FALSE;
@@ -1589,7 +1611,7 @@ haze_media_channel_add_member (GObject *obj,
/* is the call on hold? */
if (priv->hold_state != TP_LOCAL_HOLD_STATE_UNHELD)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Can't answer a call while it's on hold");
return FALSE;
}
@@ -1608,7 +1630,7 @@ haze_media_channel_add_member (GObject *obj,
}
}
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"handle %u cannot be added in the current state", handle);
return FALSE;
}