[telepathy-gabble/master] Translate candidate types between the D-Bus AddCandidate message and Jingle.
Mike Ruprecht
mike.ruprecht at collabora.co.uk
Tue Dec 29 05:34:58 PST 2009
At the time of this commit there is no defined standard for candidate types.
Here I'm using values of FsCandidateType since that's what the new-call-demo
is passing it.
---
src/call-stream.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/call-stream.c b/src/call-stream.c
index f44882e..2b08adc 100644
--- a/src/call-stream.c
+++ b/src/call-stream.c
@@ -458,16 +458,36 @@ gabble_call_stream_add_candidates (GabbleSvcCallStreamInterfaceMedia *iface,
GValueArray *va;
JingleCandidate *c;
GHashTable *info;
+ guint fstype, type;
va = g_ptr_array_index (candidates, i);
info = g_value_get_boxed (va->values + 3);
+ fstype = tp_asv_get_uint32 (info, "Type", NULL);
+
+ switch (fstype)
+ {
+ case 0: /* FS_CANDIDATE_TYPE_HOST */
+ type = JINGLE_CANDIDATE_TYPE_LOCAL;
+ break;
+ case 1: /* FS_CANDIDATE_TYPE_SRFLX */
+ case 2: /* FS_CANDIDATE_TYPE_PRFLX */
+ type = JINGLE_CANDIDATE_TYPE_STUN;
+ break;
+ case 3: /* FS_CANDIDATE_TYPE_RELAY */
+ type = JINGLE_CANDIDATE_TYPE_RELAY;
+ break;
+ case 4: /* FS_CANDIDATE_TYPE_MULTICAST */
+ default:
+ g_assert_not_reached ();
+ }
+
c = jingle_candidate_new (
/* transport protocol */
tp_asv_get_uint32 (info, "Protocol", NULL),
/* Candidate type */
- tp_asv_get_uint32 (info, "Type", NULL),
+ type,
/* id/foundation */
tp_asv_get_string (info, "Foundation"),
/* component */
--
1.5.6.5
More information about the telepathy-commits
mailing list