From 6ef4d68665a48ca62d7530379bc3346a0ecc628b Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 8 Dec 2011 21:25:42 +0200 Subject: [PATCH] core cleanup: move out allow_events field Renamed to allowed_events. --- src/core/sip-transport.c | 15 +++++++-------- src/core/sipe-core-private.h | 4 ++++ src/core/sipe-core.c | 8 +++----- src/core/sipe-notify.c | 6 ++---- src/core/sipe.h | 2 -- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/core/sip-transport.c b/src/core/sip-transport.c index 8a5c760e..d686bc90 100644 --- a/src/core/sip-transport.c +++ b/src/core/sip-transport.c @@ -957,7 +957,6 @@ static gboolean process_register_response(struct sipe_core_private *sipe_private SIPE_UNUSED_PARAMETER struct transaction *trans) { struct sip_transport *transport = sipe_private->transport; - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; const gchar *expires_header; int expires, i; GSList *hdr = msg->headers; @@ -1068,7 +1067,7 @@ static gboolean process_register_response(struct sipe_core_private *sipe_private gchar **caps = g_strsplit(elem->value,",",0); i = 0; while (caps[i]) { - sip->allow_events = g_slist_append(sip->allow_events, g_strdup(caps[i])); + sipe_private->allowed_events = g_slist_append(sipe_private->allowed_events, g_strdup(caps[i])); SIPE_DEBUG_INFO("Allow-Events: %s", caps[i]); i++; } @@ -1090,7 +1089,7 @@ static gboolean process_register_response(struct sipe_core_private *sipe_private /* subscriptions */ if (!transport->subscribed) { //do it just once, not every re-register - if (g_slist_find_custom(sip->allow_events, "vnd-microsoft-roaming-contacts", + if (g_slist_find_custom(sipe_private->allowed_events, "vnd-microsoft-roaming-contacts", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_roaming_contacts(sipe_private); } @@ -1103,11 +1102,11 @@ static gboolean process_register_response(struct sipe_core_private *sipe_private */ if (SIPE_CORE_PRIVATE_FLAG_IS(OCS2007)) { - if (g_slist_find_custom(sip->allow_events, "vnd-microsoft-roaming-self", + if (g_slist_find_custom(sipe_private->allowed_events, "vnd-microsoft-roaming-self", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_roaming_self(sipe_private); } - if (g_slist_find_custom(sip->allow_events, "vnd-microsoft-provisioning-v2", + if (g_slist_find_custom(sipe_private->allowed_events, "vnd-microsoft-provisioning-v2", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_roaming_provisioning_v2(sipe_private); } @@ -1117,15 +1116,15 @@ static gboolean process_register_response(struct sipe_core_private *sipe_private { //sipe_options_request(sip, sipe_private->public.sip_domain); - if (g_slist_find_custom(sip->allow_events, "vnd-microsoft-roaming-ACL", + if (g_slist_find_custom(sipe_private->allowed_events, "vnd-microsoft-roaming-ACL", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_roaming_acl(sipe_private); } - if (g_slist_find_custom(sip->allow_events, "vnd-microsoft-provisioning", + if (g_slist_find_custom(sipe_private->allowed_events, "vnd-microsoft-provisioning", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_roaming_provisioning(sipe_private); } - if (g_slist_find_custom(sip->allow_events, "presence.wpending", + if (g_slist_find_custom(sipe_private->allowed_events, "presence.wpending", (GCompareFunc)g_ascii_strcasecmp)) { sipe_subscribe_presence_wpending(sipe_private, NULL); diff --git a/src/core/sipe-core-private.h b/src/core/sipe-core-private.h index 9aa29714..ea299217 100644 --- a/src/core/sipe-core-private.h +++ b/src/core/sipe-core-private.h @@ -59,6 +59,10 @@ struct sipe_core_private { gchar *focus_factory_uri; GSList *sessions; GSList *sessions_to_accept; + /* from REGISTER response: server events + * we're allowed to subscribe to + */ + GSList *allowed_events; /* Presence */ gchar *status; diff --git a/src/core/sipe-core.c b/src/core/sipe-core.c index 9edbc768..3a7cfa09 100644 --- a/src/core/sipe-core.c +++ b/src/core/sipe-core.c @@ -287,8 +287,6 @@ struct sipe_core_public *sipe_core_allocate(const gchar *signin_name, void sipe_core_connection_cleanup(struct sipe_core_private *sipe_private) { - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; - g_free(sipe_private->epid); sipe_private->epid = NULL; @@ -296,14 +294,14 @@ void sipe_core_connection_cleanup(struct sipe_core_private *sipe_private) sipe_schedule_cancel_all(sipe_private); - if (sip->allow_events) { - GSList *entry = sip->allow_events; + if (sipe_private->allowed_events) { + GSList *entry = sipe_private->allowed_events; while (entry) { g_free(entry->data); entry = entry->next; } } - g_slist_free(sip->allow_events); + g_slist_free(sipe_private->allowed_events); sipe_ocs2007_free(sipe_private); diff --git a/src/core/sipe-notify.c b/src/core/sipe-notify.c index 93074688..cd0215b2 100644 --- a/src/core/sipe-notify.c +++ b/src/core/sipe-notify.c @@ -58,7 +58,6 @@ #include "sipe-subscriptions.h" #include "sipe-utils.h" #include "sipe-xml.h" -#include "sipe.h" /* OCS2005 */ static void sipe_process_provisioning(struct sipe_core_private *sipe_private, @@ -1427,7 +1426,6 @@ void process_incoming_notify(struct sipe_core_private *sipe_private, struct sipmsg *msg, gboolean request, gboolean benotify) { - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; const gchar *content_type = sipmsg_find_header(msg, "Content-Type"); const gchar *event = sipmsg_find_header(msg, "Event"); const gchar *subscription_state = sipmsg_find_header(msg, "subscription-state"); @@ -1505,7 +1503,7 @@ void process_incoming_notify(struct sipe_core_private *sipe_private, timeout = (timeout - 120) > 120 ? (timeout - 120) : timeout; if (sipe_strcase_equal(event, "presence.wpending") && - g_slist_find_custom(sip->allow_events, "presence.wpending", (GCompareFunc)g_ascii_strcasecmp)) + g_slist_find_custom(sipe_private->allowed_events, "presence.wpending", (GCompareFunc)g_ascii_strcasecmp)) { gchar *action_name = g_strdup_printf("<%s>", "presence.wpending"); sipe_schedule_seconds(sipe_private, @@ -1517,7 +1515,7 @@ void process_incoming_notify(struct sipe_core_private *sipe_private, g_free(action_name); } else if (sipe_strcase_equal(event, "presence") && - g_slist_find_custom(sip->allow_events, "presence", (GCompareFunc)g_ascii_strcasecmp)) + g_slist_find_custom(sipe_private->allowed_events, "presence", (GCompareFunc)g_ascii_strcasecmp)) { gchar *who = parse_from(sipmsg_find_header(msg, "To")); gchar *action_name = sipe_utils_presence_key(who); diff --git a/src/core/sipe.h b/src/core/sipe.h index 34ff2ca6..e9a6cd5e 100644 --- a/src/core/sipe.h +++ b/src/core/sipe.h @@ -50,8 +50,6 @@ struct sipe_account_data { gchar *authdomain; gchar *authuser; gchar *password; - /** Allowed server events to subscribe. From register OK response. */ - GSList *allow_events; struct _PurpleAccount *account; }; -- 2.11.4.GIT