changeset 26122:e411aad4346b

Add a prpl-data property to PurpleMedia.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 25 Feb 2009 02:40:10 +0000
parents 7738f530a967
children 75a02ffb0139
files libpurple/media.c libpurple/media.h
diffstat 2 files changed, 47 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Wed Feb 25 01:58:57 2009 +0000
+++ b/libpurple/media.c	Wed Feb 25 02:40:10 2009 +0000
@@ -90,6 +90,7 @@
 	PurpleConnection *pc;
 	FsConference *conference;
 	gboolean initiator;
+	gpointer prpl_data;
 
 	GHashTable *sessions;	/* PurpleMediaSession table */
 	GHashTable *participants; /* FsParticipant table */
@@ -139,6 +140,7 @@
 	PROP_CONNECTION,
 	PROP_CONFERENCE,
 	PROP_INITIATOR,
+	PROP_PRPL_DATA,
 };
 
 GType
@@ -218,6 +220,12 @@
 			FALSE,
 			G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 
+	g_object_class_install_property(gobject_class, PROP_PRPL_DATA,
+			g_param_spec_pointer("prpl-data",
+			"gpointer",
+			"Data the prpl plugin set on the media session.",
+			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,
@@ -430,6 +438,9 @@
 		case PROP_INITIATOR:
 			media->priv->initiator = g_value_get_boolean(value);
 			break;
+		case PROP_PRPL_DATA:
+			media->priv->prpl_data = g_value_get_pointer(value);
+			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 			break;
@@ -457,6 +468,9 @@
 		case PROP_INITIATOR:
 			g_value_set_boolean(value, media->priv->initiator);
 			break;
+		case PROP_PRPL_DATA:
+			g_value_set_pointer(value, media->priv->prpl_data);
+			break;
 		default:	
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);	
 			break;
@@ -1383,6 +1397,22 @@
 	return pc;
 }
 
+gpointer
+purple_media_get_prpl_data(PurpleMedia *media)
+{
+	gpointer prpl_data;
+	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
+	g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL);
+	return prpl_data;
+}
+
+void
+purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data)
+{
+	g_return_if_fail(PURPLE_IS_MEDIA(media));
+	g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL);
+}
+
 void
 purple_media_error(PurpleMedia *media, const gchar *error, ...)
 {
--- a/libpurple/media.h	Wed Feb 25 01:58:57 2009 +0000
+++ b/libpurple/media.h	Wed Feb 25 02:40:10 2009 +0000
@@ -392,6 +392,23 @@
 PurpleConnection *purple_media_get_connection(PurpleMedia *media);
 
 /**
+ * Gets the prpl data from the media session.
+ *
+ * @param media The media session to retrieve the prpl data from.
+ *
+ * @return The prpl data retrieved.
+ */
+gpointer purple_media_get_prpl_data(PurpleMedia *media);
+
+/**
+ * Sets the prpl data on the media session.
+ *
+ * @param media The media session to set the prpl data on.
+ * @param prpl_data The data to set on the media session.
+ */
+void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data);
+
+/**
  * Signals an error in the media session.
  *
  * @param media The media object to set the state on.