changeset 26021:f7cf50180e1d

Duplicate FsCandidate to remove it from the public interface.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 10 Jan 2009 03:58:54 +0000
parents ade5b2c51047
children 8c9db11d82cd
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle/rtp.c
diffstat 4 files changed, 314 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sat Jan 10 01:29:41 2009 +0000
+++ b/libpurple/media.c	Sat Jan 10 03:58:54 2009 +0000
@@ -239,7 +239,7 @@
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
 					 G_TYPE_NONE, 3, G_TYPE_POINTER,
-					 G_TYPE_POINTER, FS_TYPE_CANDIDATE);
+					 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
 	purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__STRING_STRING,
@@ -247,7 +247,8 @@
 	purple_media_signals[CANDIDATE_PAIR] = g_signal_new("candidate-pair", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__BOXED_BOXED,
-					 G_TYPE_NONE, 2, FS_TYPE_CANDIDATE, FS_TYPE_CANDIDATE);
+					 G_TYPE_NONE, 2, PURPLE_TYPE_MEDIA_CANDIDATE,
+					 PURPLE_TYPE_MEDIA_CANDIDATE);
 	purple_media_signals[CODECS_READY] = g_signal_new("codecs-ready", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 g_cclosure_marshal_VOID__STRING,
@@ -413,6 +414,169 @@
 
 }
 
+PurpleMediaCandidate *
+purple_media_candidate_new(const gchar *foundation, guint component_id,
+		PurpleMediaCandidateType type,
+		PurpleMediaNetworkProtocol proto,
+		const gchar *ip, guint port)
+{
+	PurpleMediaCandidate *candidate = g_new0(PurpleMediaCandidate, 1);
+	candidate->foundation = g_strdup(foundation);
+	candidate->component_id = component_id;
+	candidate->type = type;
+	candidate->proto = proto;
+	candidate->ip = g_strdup(ip);
+	candidate->port = port;
+	return candidate;
+}
+
+static PurpleMediaCandidate *
+purple_media_candidate_copy(PurpleMediaCandidate *candidate)
+{
+	PurpleMediaCandidate *new_candidate;
+
+	if (candidate == NULL)
+		return NULL;
+
+	new_candidate = g_new0(PurpleMediaCandidate, 1);
+	new_candidate->foundation = g_strdup(candidate->foundation);
+	new_candidate->component_id = candidate->component_id;
+	new_candidate->ip = g_strdup(candidate->ip);
+	new_candidate->port = candidate->port;
+	new_candidate->base_ip = g_strdup(candidate->base_ip);
+	new_candidate->base_port = candidate->base_port;
+	new_candidate->proto = candidate->proto;
+	new_candidate->priority = candidate->priority;
+	new_candidate->type = candidate->type;
+	new_candidate->username = g_strdup(candidate->username);
+	new_candidate->password = g_strdup(candidate->password);
+	new_candidate->ttl = candidate->ttl;
+	return new_candidate;
+}
+
+static void
+purple_media_candidate_free(PurpleMediaCandidate *candidate)
+{
+	if (candidate == NULL)
+		return;
+
+	g_free((gchar*)candidate->foundation);
+	g_free((gchar*)candidate->ip);
+	g_free((gchar*)candidate->base_ip);
+	g_free((gchar*)candidate->username);
+	g_free((gchar*)candidate->password);
+	g_free(candidate);
+}
+
+static FsCandidate *
+purple_media_candidate_to_fs(PurpleMediaCandidate *candidate)
+{
+	FsCandidate *fscandidate;
+
+	if (candidate == NULL)
+		return NULL;
+
+	fscandidate = fs_candidate_new(candidate->foundation,
+		candidate->component_id, candidate->type,
+		candidate->proto, candidate->ip, candidate->port);
+
+	fscandidate->base_ip = g_strdup(candidate->base_ip);
+	fscandidate->base_port = candidate->base_port;
+	fscandidate->priority = candidate->priority;
+	fscandidate->username = g_strdup(candidate->username);
+	fscandidate->password = g_strdup(candidate->password);
+	fscandidate->ttl = candidate->ttl;
+	return fscandidate;
+}
+
+static PurpleMediaCandidate *
+purple_media_candidate_from_fs(FsCandidate *fscandidate)
+{
+	PurpleMediaCandidate *candidate;
+
+	if (fscandidate == NULL)
+		return NULL;
+
+	candidate = purple_media_candidate_new(fscandidate->foundation,
+		fscandidate->component_id, fscandidate->type,
+		fscandidate->proto, fscandidate->ip, fscandidate->port);
+	candidate->base_ip = g_strdup(fscandidate->base_ip);
+	candidate->base_port = fscandidate->base_port;
+	candidate->priority = fscandidate->priority;
+	candidate->username = g_strdup(fscandidate->username);
+	candidate->password = g_strdup(fscandidate->password);
+	candidate->ttl = fscandidate->ttl;
+	return candidate;
+}
+
+static GList *
+purple_media_candidate_list_from_fs(GList *candidates)
+{
+	GList *new_list = NULL;
+
+	for (; candidates; candidates = g_list_next(candidates)) {
+		new_list = g_list_prepend(new_list,
+				purple_media_candidate_from_fs(
+				candidates->data));
+	}
+
+	new_list = g_list_reverse(new_list);
+	return new_list;
+}
+
+static GList *
+purple_media_candidate_list_to_fs(GList *candidates)
+{
+	GList *new_list = NULL;
+
+	for (; candidates; candidates = g_list_next(candidates)) {
+		new_list = g_list_prepend(new_list,
+				purple_media_candidate_to_fs(
+				candidates->data));
+	}
+
+	new_list = g_list_reverse(new_list);
+	return new_list;
+}
+
+GList *
+purple_media_candidate_list_copy(GList *candidates)
+{
+	GList *new_list = NULL;
+
+	for (; candidates; candidates = g_list_next(candidates)) {
+		new_list = g_list_prepend(new_list, g_boxed_copy(
+				PURPLE_TYPE_MEDIA_CANDIDATE,
+				candidates->data));
+	}
+
+	new_list = g_list_reverse(new_list);
+	return new_list;
+}
+
+void
+purple_media_candidate_list_free(GList *candidates)
+{
+	for (; candidates; candidates =
+			g_list_delete_link(candidates, candidates)) {
+		g_boxed_free(PURPLE_TYPE_MEDIA_CANDIDATE,
+				candidates->data);
+	}
+}
+
+GType
+purple_media_candidate_get_type()
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PurpleMediaCandidate",
+				(GBoxedCopyFunc)purple_media_candidate_copy,
+				(GBoxedFreeFunc)purple_media_candidate_free);
+	}
+	return type;
+}
+
 static FsMediaType
 purple_media_to_fs_media_type(PurpleMediaSessionType type)
 {
@@ -1187,7 +1351,7 @@
 {
 	gchar *name;
 	FsParticipant *participant;
-	FsCandidate *candidate;
+	PurpleMediaCandidate *candidate;
 	purple_debug_info("media", "got new local candidate: %s\n", local_candidate->foundation);
 	g_object_get(stream, "participant", &participant, NULL);
 	g_object_get(participant, "cname", &name, NULL);
@@ -1195,10 +1359,10 @@
 
 	purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate));
 
-	candidate = fs_candidate_copy(local_candidate);
+	candidate = purple_media_candidate_from_fs(local_candidate);
 	g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
 		      0, session->id, name, candidate);
-	fs_candidate_destroy(candidate);
+	purple_media_candidate_free(candidate);
 
 	g_free(name);
 }
@@ -1234,8 +1398,10 @@
 {
 	gchar *name;
 	FsParticipant *participant;
-	FsCandidate *local = fs_candidate_copy(native_candidate);
-	FsCandidate *remote = fs_candidate_copy(remote_candidate);
+	PurpleMediaCandidate *local =
+			purple_media_candidate_copy(native_candidate);
+	PurpleMediaCandidate *remote =
+			purple_media_candidate_copy(remote_candidate);
 	PurpleMediaStream *stream;
 
 	g_object_get(fsstream, "participant", &participant, NULL);
@@ -1251,8 +1417,8 @@
 	g_signal_emit(session->media, purple_media_signals[CANDIDATE_PAIR], 0,
 		      local, remote);
 
-	fs_candidate_destroy(local);
-	fs_candidate_destroy(remote);
+	purple_media_candidate_free(local);
+	purple_media_candidate_free(remote);
 }
 
 static void
@@ -1486,7 +1652,7 @@
 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name)
 {
 	PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
-	return fs_candidate_list_copy(stream->local_candidates);
+	return purple_media_candidate_list_from_fs(stream->local_candidates);
 }
 
 void
@@ -1495,23 +1661,25 @@
 {
 	PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
 	stream->remote_candidates = g_list_concat(stream->remote_candidates,
-			fs_candidate_list_copy(remote_candidates));
+			purple_media_candidate_list_to_fs(remote_candidates));
 
 	if (stream->session->accepted == TRUE) {
 		purple_media_set_remote_candidates(stream);
 	}
 }
 
-FsCandidate *
+PurpleMediaCandidate *
 purple_media_get_local_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
 {
-	return purple_media_get_stream(media, sess_id, name)->local_candidate;
+	return purple_media_candidate_from_fs(purple_media_get_stream(
+			media, sess_id, name)->local_candidate);
 }
 
-FsCandidate *
+PurpleMediaCandidate *
 purple_media_get_remote_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
 {
-	return purple_media_get_stream(media, sess_id, name)->remote_candidate;
+	return purple_media_candidate_from_fs(purple_media_get_stream(
+			media, sess_id, name)->remote_candidate);
 }
 
 gboolean
--- a/libpurple/media.h	Sat Jan 10 01:29:41 2009 +0000
+++ b/libpurple/media.h	Sat Jan 10 03:58:54 2009 +0000
@@ -37,6 +37,7 @@
 G_BEGIN_DECLS
 
 #define PURPLE_TYPE_MEDIA            (purple_media_get_type())
+#define PURPLE_TYPE_MEDIA_CANDIDATE  (purple_media_candidate_get_type())
 #define PURPLE_MEDIA(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia))
 #define PURPLE_MEDIA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass))
 #define PURPLE_IS_MEDIA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA))
@@ -51,6 +52,8 @@
 typedef struct _PurpleMediaClass PurpleMediaClass;
 /** @copydoc _PurpleMediaPrivate */
 typedef struct _PurpleMediaPrivate PurpleMediaPrivate;
+/** @copydoc _PurpleMediaCandidate */
+typedef struct _PurpleMediaCandidate PurpleMediaCandidate;
 
 #else
 
@@ -76,6 +79,25 @@
 	PURPLE_MEDIA_STATE_CHANGED_END,
 } PurpleMediaStateChangedType;
 
+typedef enum {
+	PURPLE_MEDIA_CANDIDATE_TYPE_HOST,
+	PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX,
+	PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX,
+	PURPLE_MEDIA_CANDIDATE_TYPE_RELAY,
+	PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST,
+} PurpleMediaCandidateType;
+
+typedef enum {
+	PURPLE_MEDIA_COMPONENT_NONE = 0,
+	PURPLE_MEDIA_COMPONENT_RTP = 1,
+	PURPLE_MEDIA_COMPONENT_RTCP = 2,
+} PurpleMediaComponentType;
+
+typedef enum {
+	PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
+	PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
+} PurpleMediaNetworkProtocol;
+
 #ifdef USE_VV
 
 /** The media class */
@@ -91,6 +113,22 @@
 	PurpleMediaPrivate *priv;      /**< The private data of this object. */
 };
 
+struct _PurpleMediaCandidate
+{
+	const gchar *foundation;
+	guint component_id;
+	const gchar *ip;
+	guint16 port;
+	const gchar *base_ip;
+	guint16 base_port;
+	PurpleMediaNetworkProtocol proto;
+	guint32 priority;
+	PurpleMediaSessionType type;
+	const gchar *username;
+	const gchar *password;
+	guint ttl;
+};
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -110,6 +148,47 @@
 GType purple_media_state_changed_get_type(void);
 
 /**
+ * Gets the type of the media candidate structure.
+ *
+ * @return The media canditate's GType
+ */
+GType purple_media_candidate_get_type(void);
+
+/**
+ * Creates a PurpleMediaCandidate instance.
+ *
+ * @param foundation The foundation of the candidate.
+ * @param component_id The component this candidate is for.
+ * @param type The type of candidate.
+ * @param proto The protocol this component is for.
+ * @param ip The IP address of this component.
+ * @param port The network port.
+ *
+ * @return The newly created PurpleMediaCandidate instance.
+ */
+PurpleMediaCandidate *purple_media_candidate_new(
+		const gchar *foundation, guint component_id,
+		PurpleMediaCandidateType type,
+		PurpleMediaNetworkProtocol proto,
+		const gchar *ip, guint port);
+
+/**
+ * Copies a GList of PurpleMediaCandidate and its contents.
+ *
+ * @param candidates The list of candidates to be copied.
+ *
+ * @return The copy of the GList.
+ */
+GList *purple_media_candidate_list_copy(GList *candidates);
+
+/**
+ * Frees a GList of PurpleMediaCandidate and its contents.
+ *
+ * @param candidates The list of candidates to be freed.
+ */
+void purple_media_candidate_list_free(GList *candidates);
+
+/**
  * Combines all the separate session types into a single PurpleMediaSessionType.
  *
  * @param media The media session to retrieve session types from.
@@ -388,7 +467,8 @@
  *
  * @return The active candidate retrieved.
  */
-FsCandidate *purple_media_get_local_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name);
+PurpleMediaCandidate *purple_media_get_local_candidate(PurpleMedia *media,
+		const gchar *sess_id, const gchar *name);
 
 /**
  * Gets the active remote candidate for the stream.
@@ -399,7 +479,8 @@
  *
  * @return The remote candidate retrieved.
  */
-FsCandidate *purple_media_get_remote_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name);
+PurpleMediaCandidate *purple_media_get_remote_candidate(PurpleMedia *media,
+		const gchar *sess_id, const gchar *name);
 
 /**
  * Gets remote candidates from the stream.
--- a/libpurple/protocols/jabber/google.c	Sat Jan 10 01:29:41 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sat Jan 10 03:58:54 2009 +0000
@@ -161,7 +161,7 @@
 	JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET);
 	GList *candidates = purple_media_get_local_candidates(session->media, "google-voice",
 							      session->remote_jid);
-	FsCandidate *transport;
+	PurpleMediaCandidate *transport;
 	xmlnode *sess;
 	xmlnode *candidate;
 	sess = google_session_create_xmlnode(session, "candidates");
@@ -171,7 +171,7 @@
 	for (;candidates;candidates = candidates->next) {
 		char port[8];
 		char pref[8];
-		transport = (FsCandidate*)(candidates->data);
+		transport = (PurpleMediaCandidate*)(candidates->data);
 
 		if (!strcmp(transport->ip, "127.0.0.1"))
 			continue;
@@ -194,10 +194,14 @@
 				transport->password != NULL ?
 				transport->password : "");
 		xmlnode_set_attrib(candidate, "preference", pref);
-		xmlnode_set_attrib(candidate, "protocol", transport->proto == FS_NETWORK_PROTOCOL_UDP ? "udp" : "tcp");
-		xmlnode_set_attrib(candidate, "type", transport->type == FS_CANDIDATE_TYPE_HOST ? "local" :
-						      transport->type == FS_CANDIDATE_TYPE_SRFLX ? "stun" :
-					       	      transport->type == FS_CANDIDATE_TYPE_RELAY ? "relay" : NULL);
+		xmlnode_set_attrib(candidate, "protocol", transport->proto ==
+				PURPLE_MEDIA_NETWORK_PROTOCOL_UDP ? "udp" : "tcp");
+		xmlnode_set_attrib(candidate, "type", transport->type ==
+				PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "local" :
+						      transport->type ==
+				PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "stun" :
+					       	      transport->type ==
+				PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : NULL);
 		xmlnode_set_attrib(candidate, "generation", "0");
 		xmlnode_set_attrib(candidate, "network", "0");
 		xmlnode_insert_child(sess, candidate);
@@ -399,17 +403,21 @@
 	char n[4];	
 		
 	for (cand = xmlnode_get_child(sess, "candidate"); cand; cand = xmlnode_get_next_twin(cand)) {
-		FsCandidate *info;
+		PurpleMediaCandidate *info;
 		g_snprintf(n, sizeof(n), "S%d", name++);
-		info = fs_candidate_new(n, FS_COMPONENT_RTP, !strcmp(xmlnode_get_attrib(cand, "type"), "local") ?
-					FS_CANDIDATE_TYPE_HOST :
+		info = purple_media_candidate_new(n, PURPLE_MEDIA_COMPONENT_RTP,
+				!strcmp(xmlnode_get_attrib(cand, "type"), "local") ?
+					PURPLE_MEDIA_CANDIDATE_TYPE_HOST :
 			     		!strcmp(xmlnode_get_attrib(cand, "type"), "stun") ?
-						FS_CANDIDATE_TYPE_PRFLX :
+						PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX :
 			     			!strcmp(xmlnode_get_attrib(cand, "type"), "relay") ?
-							FS_CANDIDATE_TYPE_RELAY : FS_CANDIDATE_TYPE_HOST,
+							PURPLE_MEDIA_CANDIDATE_TYPE_RELAY :
+							PURPLE_MEDIA_CANDIDATE_TYPE_HOST,
 						!strcmp(xmlnode_get_attrib(cand, "protocol"),"udp") ?
-							FS_NETWORK_PROTOCOL_UDP : FS_NETWORK_PROTOCOL_TCP,
-					xmlnode_get_attrib(cand, "address"), atoi(xmlnode_get_attrib(cand, "port")));
+							PURPLE_MEDIA_NETWORK_PROTOCOL_UDP :
+							PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
+					xmlnode_get_attrib(cand, "address"),
+					atoi(xmlnode_get_attrib(cand, "port")));
 
 		info->username = g_strdup(xmlnode_get_attrib(cand, "username"));
 		info->password = g_strdup(xmlnode_get_attrib(cand, "password"));
@@ -418,7 +426,7 @@
 	}
 
 	purple_media_add_remote_candidates(session->media, "google-voice", session->remote_jid, list);
-	fs_candidate_list_destroy(list);
+	purple_media_candidate_list_free(list);
 
 	result = jabber_iq_new(js, JABBER_IQ_RESULT);
 	jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id"));
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sat Jan 10 01:29:41 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sat Jan 10 03:58:54 2009 +0000
@@ -193,7 +193,7 @@
 		JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP);
 		JingleRawUdpCandidate *rawudp_candidate;
 		for (; candidates; candidates = g_list_next(candidates)) {
-			FsCandidate *candidate = candidates->data;
+			PurpleMediaCandidate *candidate = candidates->data;
 			id = jabber_get_next_id(jingle_session_get_js(session));
 			rawudp_candidate = jingle_rawudp_candidate_new(id,
 					generation, candidate->component_id,
@@ -206,14 +206,14 @@
 		JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP);
 		JingleIceUdpCandidate *iceudp_candidate;
 		for (; candidates; candidates = g_list_next(candidates)) {
-			FsCandidate *candidate = candidates->data;
+			PurpleMediaCandidate *candidate = candidates->data;
 			iceudp_candidate = jingle_iceudp_candidate_new(candidate->component_id,
 					candidate->foundation, generation, candidate->ip,
 					0, candidate->port, candidate->priority, "udp",
-					candidate->type == FS_CANDIDATE_TYPE_HOST ? "host" :
-					candidate->type == FS_CANDIDATE_TYPE_SRFLX ? "srflx" :
-					candidate->type == FS_CANDIDATE_TYPE_PRFLX ? "prflx" :
-					candidate->type == FS_CANDIDATE_TYPE_RELAY ? "relay" : "",
+					candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" :
+					candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" :
+					candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" :
+					candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : "",
 					candidate->username, candidate->password);
 			jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), iceudp_candidate);
 		}
@@ -233,8 +233,10 @@
 
 		for (; candidates; candidates = g_list_delete_link(candidates, candidates)) {
 			JingleRawUdpCandidate *candidate = candidates->data;
-			ret = g_list_append(ret, fs_candidate_new("", candidate->component,
-					FS_CANDIDATE_TYPE_SRFLX, FS_NETWORK_PROTOCOL_UDP,
+			ret = g_list_append(ret, purple_media_candidate_new(
+					"", candidate->component,
+					PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX,
+					PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
 					candidate->ip, candidate->port));
 		}
 
@@ -244,17 +246,22 @@
 
 		for (; candidates; candidates = g_list_delete_link(candidates, candidates)) {
 			JingleIceUdpCandidate *candidate = candidates->data;
-			FsCandidate *fscandidate = fs_candidate_new(
+			PurpleMediaCandidate *new_candidate = purple_media_candidate_new(
 					candidate->foundation, candidate->component,
-					!strcmp(candidate->type, "host") ? FS_CANDIDATE_TYPE_HOST :
-					!strcmp(candidate->type, "srflx") ? FS_CANDIDATE_TYPE_SRFLX :
-					!strcmp(candidate->type, "prflx") ? FS_CANDIDATE_TYPE_PRFLX :
-					!strcmp(candidate->type, "relay") ? FS_CANDIDATE_TYPE_RELAY : 0,
-					FS_NETWORK_PROTOCOL_UDP, candidate->ip, candidate->port);
-			fscandidate->username = g_strdup(candidate->username);
-			fscandidate->password = g_strdup(candidate->password);
-			fscandidate->priority = candidate->priority;
-			ret = g_list_append(ret, fscandidate);
+					!strcmp(candidate->type, "host") ?
+					PURPLE_MEDIA_CANDIDATE_TYPE_HOST :
+					!strcmp(candidate->type, "srflx") ?
+					PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX :
+					!strcmp(candidate->type, "prflx") ?
+					PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX :
+					!strcmp(candidate->type, "relay") ?
+					PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0,
+					PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
+					candidate->ip, candidate->port);
+			new_candidate->username = g_strdup(candidate->username);
+			new_candidate->password = g_strdup(candidate->password);
+			new_candidate->priority = candidate->priority;
+			ret = g_list_append(ret, new_candidate);
 		}
 
 		return ret;
@@ -264,7 +271,7 @@
 }
 
 static void
-jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, FsCandidate *candidate, JingleSession *session)
+jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n");
 }