From b54982826d0d5784b9660669ccfe9889b9fd3183 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 8 Dec 2011 15:22:06 +0200 Subject: [PATCH] core cleanup: move out is_oof_note flag --- src/core/sipe-core-private.h | 2 ++ src/core/sipe-notify.c | 5 ++++- src/core/sipe-ocs2005.c | 7 ++++--- src/core/sipe-ocs2007.c | 7 +++++-- src/core/sipe-status.c | 2 +- src/core/sipe.h | 1 - 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/core/sipe-core-private.h b/src/core/sipe-core-private.h index e853d95e..413664b3 100644 --- a/src/core/sipe-core-private.h +++ b/src/core/sipe-core-private.h @@ -107,6 +107,8 @@ struct sipe_core_private { #define SIPE_CORE_PRIVATE_FLAG_MPOP 0x20000000 /* if there is support for batched subscription*/ #define SIPE_CORE_PRIVATE_FLAG_BATCHED_SUPPORT 0x10000000 +/* if note is out-of-office note */ +#define SIPE_CORE_PRIVATE_FLAG_OOF_NOTE 0x08000000 #define SIPE_CORE_PUBLIC_FLAG_IS(flag) \ ((sipe_private->public.flags & SIPE_CORE_FLAG_ ## flag) == SIPE_CORE_FLAG_ ## flag) diff --git a/src/core/sipe-notify.c b/src/core/sipe-notify.c index c694a33a..f7834621 100644 --- a/src/core/sipe-notify.c +++ b/src/core/sipe-notify.c @@ -442,7 +442,10 @@ static void process_incoming_notify_msrtc(struct sipe_core_private *sipe_private if (sipe_strcase_equal(sbuddy->name, self_uri)) { if (!sipe_strequal(sbuddy->note, sip->note)) /* not same */ { - sip->is_oof_note = sbuddy->is_oof_note; + if (sbuddy->is_oof_note) + SIPE_CORE_PRIVATE_FLAG_SET(OOF_NOTE); + else + SIPE_CORE_PRIVATE_FLAG_UNSET(OOF_NOTE); g_free(sip->note); sip->note = g_strdup(sbuddy->note); diff --git a/src/core/sipe-ocs2005.c b/src/core/sipe-ocs2005.c index a436a9b8..2a522876 100644 --- a/src/core/sipe-ocs2005.c +++ b/src/core/sipe-ocs2005.c @@ -321,14 +321,15 @@ static void send_presence_soap(struct sipe_core_private *sipe_private, res_oof = SIPE_SOAP_SET_PRESENCE_OOF_XML; cal->published = TRUE; } else if (sip->note) { - if (sip->is_oof_note && !oof_note) { /* stale OOF note, as it's not present in cal already */ + if (SIPE_CORE_PRIVATE_FLAG_IS(OOF_NOTE) && + !oof_note) { /* stale OOF note, as it's not present in cal already */ g_free(sip->note); sip->note = NULL; - sip->is_oof_note = FALSE; + SIPE_CORE_PRIVATE_FLAG_UNSET(OOF_NOTE); sip->note_since = 0; } else { note_pub = sip->note; - res_oof = sip->is_oof_note ? SIPE_SOAP_SET_PRESENCE_OOF_XML : ""; + res_oof = SIPE_CORE_PRIVATE_FLAG_IS(OOF_NOTE) ? SIPE_SOAP_SET_PRESENCE_OOF_XML : ""; } } diff --git a/src/core/sipe-ocs2007.c b/src/core/sipe-ocs2007.c index c312907d..05f53217 100644 --- a/src/core/sipe-ocs2007.c +++ b/src/core/sipe-ocs2007.c @@ -1742,7 +1742,7 @@ void sipe_ocs2007_category_publish(struct sipe_core_private *sipe_private) sipe_publish_get_category_state_machine(sipe_private); gchar *pub_note = sipe_publish_get_category_note(sipe_private, sip->note, - sip->is_oof_note ? "OOF" : "personal", + SIPE_CORE_PRIVATE_FLAG_IS(OOF_NOTE) ? "OOF" : "personal", 0, 0); gchar *publications; @@ -2124,7 +2124,10 @@ void sipe_ocs2007_process_roaming_self(struct sipe_core_private *sipe_private, g_free(sip->note); sip->note = g_strdup(publication->note); sip->note_since = publish_time; - sip->is_oof_note = sipe_strequal(sipe_xml_attribute(xn_body, "type"), "OOF"); + if (sipe_strequal(sipe_xml_attribute(xn_body, "type"), "OOF")) + SIPE_CORE_PRIVATE_FLAG_SET(OOF_NOTE); + else + SIPE_CORE_PRIVATE_FLAG_UNSET(OOF_NOTE); do_update_status = TRUE; } diff --git a/src/core/sipe-status.c b/src/core/sipe-status.c index d684aa6d..3f4efdda 100644 --- a/src/core/sipe-status.c +++ b/src/core/sipe-status.c @@ -181,7 +181,7 @@ void sipe_core_status_set(struct sipe_core_public *sipe_public, /* this will preserve OOF flag as well */ if (!sipe_strequal(tmp, sip->note)) { - sip->is_oof_note = FALSE; + SIPE_CORE_PRIVATE_FLAG_UNSET(OOF_NOTE); g_free(sip->note); sip->note = g_strdup(note); sip->note_since = time(NULL); diff --git a/src/core/sipe.h b/src/core/sipe.h index 18e8ab3c..2a65df3a 100644 --- a/src/core/sipe.h +++ b/src/core/sipe.h @@ -81,7 +81,6 @@ struct sipe_account_data { int presence_method_version; time_t do_not_publish[SIPE_ACTIVITY_NUM_TYPES]; gchar *status; - gboolean is_oof_note; gchar *note; time_t note_since; time_t idle_switch; -- 2.11.4.GIT