changeset 24987:c7d4b67b3332

Add initiator property to PurpleMedia.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sun, 04 Jan 2009 05:19:54 +0000
parents f0c2e27c7ae7
children f7a2045f9346
files libpurple/media.c libpurple/mediamanager.c libpurple/mediamanager.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle/rtp.c
diffstat 5 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Fri Jan 02 23:14:27 2009 +0000
+++ b/libpurple/media.c	Sun Jan 04 05:19:54 2009 +0000
@@ -73,6 +73,7 @@
 struct _PurpleMediaPrivate
 {
 	FsConference *conference;
+	gboolean initiator;
 
 	GHashTable *sessions;	/* PurpleMediaSession table */
 	GHashTable *participants; /* FsParticipant table */
@@ -124,6 +125,7 @@
 enum {
 	PROP_0,
 	PROP_CONFERENCE,
+	PROP_INITIATOR,
 };
 
 GType
@@ -166,6 +168,13 @@
 			FS_TYPE_CONFERENCE,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
+	g_object_class_install_property(gobject_class, PROP_INITIATOR,
+			g_param_spec_boolean("initiator",
+			"initiator",
+			"If the local user initiated the conference.",
+			FALSE,
+			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
 	purple_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 g_cclosure_marshal_VOID__STRING,
@@ -311,6 +320,9 @@
 			media->priv->conference = g_value_get_object(value);
 			g_object_ref(media->priv->conference);
 			break;
+		case PROP_INITIATOR:
+			media->priv->initiator = g_value_get_boolean(value);
+			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 			break;
@@ -329,6 +341,9 @@
 		case PROP_CONFERENCE:
 			g_value_set_object(value, media->priv->conference);
 			break;
+		case PROP_INITIATOR:
+			g_value_set_boolean(value, media->priv->initiator);
+			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);	
 			break;
--- a/libpurple/mediamanager.c	Fri Jan 02 23:14:27 2009 +0000
+++ b/libpurple/mediamanager.c	Sun Jan 04 05:19:54 2009 +0000
@@ -140,7 +140,8 @@
 purple_media_manager_create_media(PurpleMediaManager *manager,
 				  PurpleConnection *gc,
 				  const char *conference_type,
-				  const char *remote_user)
+				  const char *remote_user,
+				  gboolean initiator)
 {
 	PurpleMedia *media;
 	FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL));
@@ -157,6 +158,7 @@
 
 	media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
 			     "conference", conference,
+			     "initiator", initiator,
 			     NULL));
 
 	ret = gst_element_set_state(purple_media_get_pipeline(media), GST_STATE_PLAYING);
--- a/libpurple/mediamanager.h	Fri Jan 02 23:14:27 2009 +0000
+++ b/libpurple/mediamanager.h	Sun Jan 04 05:19:54 2009 +0000
@@ -102,7 +102,8 @@
 PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager,
 						PurpleConnection *gc,
 						const char *conference_type,
-						const char *remote_user);
+						const char *remote_user,
+						gboolean initiator);
 
 /**
  * Gets all of the media sessions.
--- a/libpurple/protocols/jabber/google.c	Fri Jan 02 23:14:27 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sun Jan 04 05:19:54 2009 +0000
@@ -217,7 +217,7 @@
 	}
 
 	session->media = purple_media_manager_create_media(purple_media_manager_get(), js->gc,
-							   "fsrtpconference", session->remote_jid);
+							   "fsrtpconference", session->remote_jid, FALSE);
 
 	/* GTalk requires the NICE_COMPATIBILITY_GOOGLE param */
 	param.name = "compatibility-mode";
--- a/libpurple/protocols/jabber/jingle/rtp.c	Fri Jan 02 23:14:27 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sun Jan 04 05:19:54 2009 +0000
@@ -372,7 +372,8 @@
 	gchar *sid = jingle_session_get_sid(session);
 
 	PurpleMedia *media = purple_media_manager_create_media(purple_media_manager_get(), 
-						  js->gc, "fsrtpconference", remote_jid);
+						  js->gc, "fsrtpconference", remote_jid,
+						  jingle_session_is_initiator(session));
 	g_free(remote_jid);
 
 	if (!media) {