From 20fe916184db8b163147bc4b016d7353a48b5f5c Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Mon, 8 Apr 2013 23:49:04 +0300 Subject: [PATCH] conference: move out subscription code That was the last external user of sipe_subscribe(), which is now internalized. --- src/core/sipe-conf.c | 26 ++++++-------------------- src/core/sipe-subscriptions.c | 33 ++++++++++++++++++++++++++------- src/core/sipe-subscriptions.h | 10 +++------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/core/sipe-conf.c b/src/core/sipe-conf.c index b64d8e6a..1ae3cb3c 100644 --- a/src/core/sipe-conf.c +++ b/src/core/sipe-conf.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2010-12 SIPE Project + * Copyright (C) 2010-2013 SIPE Project * Copyright (C) 2009 pier11 * * @@ -207,23 +207,6 @@ rand_guid() rand() % 0xAAFF + 0x1111); } -/** - * @param expires not respected if set to negative value (E.g. -1) - */ -static void -sipe_subscribe_conference(struct sipe_core_private *sipe_private, - struct sip_session *session, - gboolean expires) -{ - sipe_subscribe(sipe_private, - session->chat_session->id, - "conference", - "application/conference-info+xml", - expires ? "Expires: 0\r\n" : NULL, - NULL, - NULL); -} - /** Invite us to the focus callback */ static gboolean process_invite_conf_focus_response(struct sipe_core_private *sipe_private, @@ -274,7 +257,9 @@ process_invite_conf_focus_response(struct sipe_core_private *sipe_private, const gchar *code = sipe_xml_attribute(xn_response, "code"); if (sipe_strequal(code, "success")) { /* subscribe to focus */ - sipe_subscribe_conference(sipe_private, session, FALSE); + sipe_subscribe_conference(sipe_private, + session->chat_session->id, + FALSE); #ifdef HAVE_VV if (session->is_call) sipe_core_media_connect_conference(SIPE_CORE_PUBLIC, @@ -1192,7 +1177,8 @@ conf_session_close(struct sipe_core_private *sipe_private, { if (session) { /* unsubscribe from focus */ - sipe_subscribe_conference(sipe_private, session, TRUE); + sipe_subscribe_conference(sipe_private, + session->chat_session->id, TRUE); if (session->focus_dialog) { /* send BYE to focus */ diff --git a/src/core/sipe-subscriptions.c b/src/core/sipe-subscriptions.c index f6a331c8..9eec171c 100644 --- a/src/core/sipe-subscriptions.c +++ b/src/core/sipe-subscriptions.c @@ -204,13 +204,13 @@ static gboolean process_subscribe_response(struct sipe_core_private *sipe_privat /** * common subscription code */ -void sipe_subscribe(struct sipe_core_private *sipe_private, - const gchar *uri, - const gchar *event, - const gchar *accept, - const gchar *addheaders, - const gchar *body, - struct sip_dialog *dialog) +static void sipe_subscribe(struct sipe_core_private *sipe_private, + const gchar *uri, + const gchar *event, + const gchar *accept, + const gchar *addheaders, + const gchar *body, + struct sip_dialog *dialog) { gchar *contact = get_contact(sipe_private); gchar *hdr = g_strdup_printf( @@ -572,6 +572,25 @@ static void sipe_subscription_expiration(struct sipe_core_private *sipe_private, } } + +/** + * @param expires not respected if set to negative value (E.g. -1) + */ +void sipe_subscribe_conference(struct sipe_core_private *sipe_private, + const gchar *id, + gboolean expires) +{ + sipe_subscribe(sipe_private, + id, + "conference", + "application/conference-info+xml", + expires ? "Expires: 0\r\n" : NULL, + NULL, + NULL); +} + + + /** * Single Category SUBSCRIBE [MS-PRES] ; To send when the server returns a 200 OK message with state="resubscribe" in response. * The user sends a single SUBSCRIBE request to the subscribed contact. diff --git a/src/core/sipe-subscriptions.h b/src/core/sipe-subscriptions.h index 880f3860..e6e45d03 100644 --- a/src/core/sipe-subscriptions.h +++ b/src/core/sipe-subscriptions.h @@ -45,13 +45,9 @@ void sipe_subscription_terminate(struct sipe_core_private *sipe_private, /** * Subscriptions */ -void sipe_subscribe(struct sipe_core_private *sipe_private, - const gchar *uri, - const gchar *event, - const gchar *accept, - const gchar *addheaders, - const gchar *body, - struct sip_dialog *dialog); +void sipe_subscribe_conference(struct sipe_core_private *sipe_private, + const gchar *id, + gboolean expires); void sipe_subscribe_presence_single(struct sipe_core_private *sipe_private, gpointer buddy_name); -- 2.11.4.GIT