changeset 26403:f0de2405c2f1

Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 02 Apr 2009 01:12:23 +0000
parents 081a819bc710
children 217574ec2a34
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/jingle/rtp.c
diffstat 3 files changed, 20 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Thu Apr 02 00:11:49 2009 +0000
+++ b/libpurple/media.c	Thu Apr 02 01:12:23 2009 +0000
@@ -753,13 +753,13 @@
 purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec,
 		const gchar *name, const gchar *value)
 {
-	PurpleMediaCodecParameter *new_param;
+	PurpleKeyValuePair *new_param;
 
 	g_return_if_fail(codec != NULL);
 	g_return_if_fail(name != NULL && value != NULL);
 
-	new_param = g_new0(PurpleMediaCodecParameter, 1);
-	new_param->name = g_strdup(name);
+	new_param = g_new0(PurpleKeyValuePair, 1);
+	new_param->key = g_strdup(name);
 	new_param->value = g_strdup(value);
 	codec->optional_params = g_list_append(
 			codec->optional_params, new_param);
@@ -767,11 +767,11 @@
 
 void
 purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
-		PurpleMediaCodecParameter *param)
+		PurpleKeyValuePair *param)
 {
 	g_return_if_fail(codec != NULL && param != NULL);
 
-	g_free(param->name);
+	g_free(param->key);
 	g_free(param->value);
 	g_free(param);
 
@@ -779,7 +779,7 @@
 			g_list_remove(codec->optional_params, param);
 }
 
-PurpleMediaCodecParameter *
+PurpleKeyValuePair *
 purple_media_codec_get_optional_parameter(PurpleMediaCodec *codec,
 		const gchar *name, const gchar *value)
 {
@@ -789,8 +789,8 @@
 	g_return_val_if_fail(name != NULL, NULL);
 
 	for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
-		PurpleMediaCodecParameter *param = iter->data;
-		if (!g_ascii_strcasecmp(param->name, name) &&
+		PurpleKeyValuePair *param = iter->data;
+		if (!g_ascii_strcasecmp(param->key, name) &&
 				(value == NULL ||
 				!g_ascii_strcasecmp(param->value, value)))
 			return param;
@@ -826,10 +826,10 @@
 	new_codec->channels = codec->channels;
 
 	for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
-		PurpleMediaCodecParameter *param =
-				(PurpleMediaCodecParameter*)iter->data;
+		PurpleKeyValuePair *param =
+				(PurpleKeyValuePair*)iter->data;
 		purple_media_codec_add_optional_parameter(new_codec,
-				param->name, param->value);
+				param->key, param->value);
 	}
 
 	return new_codec;
@@ -869,10 +869,9 @@
 	new_codec->channels = codec->channels;
 
 	for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
-		PurpleMediaCodecParameter *param =
-				(PurpleMediaCodecParameter*)iter->data;
+		PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
 		fs_codec_add_optional_parameter(new_codec,
-				param->name, param->value);
+				param->key, param->value);
 	}
 
 	return new_codec;
--- a/libpurple/media.h	Thu Apr 02 00:11:49 2009 +0000
+++ b/libpurple/media.h	Thu Apr 02 01:12:23 2009 +0000
@@ -27,6 +27,9 @@
 #ifndef __MEDIA_H_
 #define __MEDIA_H_
 
+#include "signals.h"
+#include "util.h"
+
 #include <glib.h>
 #include <glib-object.h>
 
@@ -54,8 +57,6 @@
 typedef struct _PurpleMediaCandidate PurpleMediaCandidate;
 /** @copydoc _PurpleMediaCodec */
 typedef struct _PurpleMediaCodec PurpleMediaCodec;
-/** @copydoc _PurpleMediaCodecParameter */
-typedef struct _PurpleMediaCodecParameter PurpleMediaCodecParameter;
 
 /** Media caps */
 typedef enum {
@@ -133,12 +134,6 @@
 	guint ttl;
 };
 
-struct _PurpleMediaCodecParameter
-{
-	gchar *name;
-	gchar *value;
-};
-
 struct _PurpleMediaCodec
 {
 	gint id;
@@ -261,7 +256,7 @@
  * @param param A pointer to the parameter to remove.
  */
 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
-		PurpleMediaCodecParameter *param);
+		PurpleKeyValuePair *param);
 
 /**
  * Gets an optional parameter based on the values given.
@@ -272,7 +267,7 @@
  *
  * @return The value found or NULL.
  */
-PurpleMediaCodecParameter *purple_media_codec_get_optional_parameter(
+PurpleKeyValuePair *purple_media_codec_get_optional_parameter(
 		PurpleMediaCodec *codec, const gchar *name,
 		const gchar *value);
 
--- a/libpurple/protocols/jabber/jingle/rtp.c	Thu Apr 02 00:11:49 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Thu Apr 02 01:12:23 2009 +0000
@@ -681,9 +681,9 @@
 		xmlnode_set_attrib(payload, "channels", channels);
 
 		for (; iter; iter = g_list_next(iter)) {
-			PurpleMediaCodecParameter *mparam = iter->data;
+			PurpleKeyValuePair *mparam = iter->data;
 			xmlnode *param = xmlnode_new_child(payload, "parameter");
-			xmlnode_set_attrib(param, "name", mparam->name);
+			xmlnode_set_attrib(param, "name", mparam->key);
 			xmlnode_set_attrib(param, "value", mparam->value);
 		}