From 82ffa70531eb4a4d746b8166364980ed55c6ad1e Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Wed, 1 Jul 2015 11:14:25 +0200 Subject: [PATCH] conf: factor out session URI formation --- src/core/sipe-conf.c | 15 +++++++++++++++ src/core/sipe-conf.h | 11 +++++++++++ src/core/sipe-media.c | 10 +++++----- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/core/sipe-conf.c b/src/core/sipe-conf.c index 551e6c3b..98fc6931 100644 --- a/src/core/sipe-conf.c +++ b/src/core/sipe-conf.c @@ -1413,6 +1413,21 @@ void sipe_core_conf_remove_from(struct sipe_core_public *sipe_public, sipe_conf_delete_user(sipe_private, session, buddy_name); } +gchar * +sipe_conf_build_uri(const gchar *focus_uri, const gchar *session_type) +{ + gchar **parts = g_strsplit(focus_uri, ":focus:", 2); + gchar *result = NULL; + + if (g_strv_length(parts) == 2) { + result = g_strconcat(parts[0], ":", session_type, ":", parts[1], + NULL); + } + + g_strfreev(parts); + return result; +} + static gchar * access_numbers_info(struct sipe_core_public *sipe_public) { diff --git a/src/core/sipe-conf.h b/src/core/sipe-conf.h index 7f52a7d0..106bddd4 100644 --- a/src/core/sipe-conf.h +++ b/src/core/sipe-conf.h @@ -127,6 +127,17 @@ sipe_conf_cancel_unaccepted(struct sipe_core_private *sipe_private, struct sipmsg *msg); /** + * Creates URI for given session type within a conference specified by its + * focus URI. + * + * @param focus_uri conference focus URI + * @param session_type type of session for which to build the URI, + * e.g. "audio-video" + */ +gchar * +sipe_conf_build_uri(const gchar *focus_uri, const gchar *session_type); + +/** * Invokes when we leave conversation. * Usually by closing chat wingow. */ diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index c2e19ea2..500d641f 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -1153,7 +1153,6 @@ void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, struct sipe_media_call_private *call_private; struct sip_session *session; SipeIceVersion ice_version; - gchar **parts; gchar *av_uri; if (!sipe_conf_supports_mcu_type(sipe_private, "audio-video")) { @@ -1168,11 +1167,12 @@ void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, return; } - session->is_call = TRUE; + av_uri = sipe_conf_build_uri(chat_session->id, "audio-video"); + if (!av_uri) { + return; + } - parts = g_strsplit(chat_session->id, "app:conf:focus:", 2); - av_uri = g_strjoinv("app:conf:audio-video:", parts); - g_strfreev(parts); + session->is_call = TRUE; ice_version = SIPE_CORE_PRIVATE_FLAG_IS(LYNC2013) ? SIPE_ICE_RFC_5245 : SIPE_ICE_DRAFT_6; -- 2.11.4.GIT