From b3ecc50f90a92e72628593b240d4ec13e8b21473 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 8 Dec 2011 21:01:31 +0200 Subject: [PATCH] core cleanup: move out idle_switch field --- src/core/sipe-core-private.h | 1 + src/core/sipe-status.c | 16 ++++++---------- src/core/sipe.h | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core/sipe-core-private.h b/src/core/sipe-core-private.h index fff8d9d6..de5cab8f 100644 --- a/src/core/sipe-core-private.h +++ b/src/core/sipe-core-private.h @@ -62,6 +62,7 @@ struct sipe_core_private { /* Presence */ time_t do_not_publish[SIPE_ACTIVITY_NUM_TYPES]; + time_t idle_switch; /* [MS-SIP] deltaNum counters */ guint deltanum_contacts; diff --git a/src/core/sipe-status.c b/src/core/sipe-status.c index f9dd3bcf..9463ed4d 100644 --- a/src/core/sipe-status.c +++ b/src/core/sipe-status.c @@ -210,16 +210,15 @@ void sipe_core_status_set(struct sipe_core_public *sipe_public, */ gboolean sipe_status_changed_by_user(struct sipe_core_private *sipe_private) { - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; gboolean res; time_t now = time(NULL); - SIPE_DEBUG_INFO("sipe_status_changed_by_user: sip->idle_switch : %s", - asctime(localtime(&(sip->idle_switch)))); + SIPE_DEBUG_INFO("sipe_status_changed_by_user: sipe_private->idle_switch : %s", + asctime(localtime(&(sipe_private->idle_switch)))); SIPE_DEBUG_INFO("sipe_status_changed_by_user: now : %s", asctime(localtime(&now))); - res = ((now - SIPE_IDLE_SET_DELAY * 2) >= sip->idle_switch); + res = ((now - SIPE_IDLE_SET_DELAY * 2) >= sipe_private->idle_switch); SIPE_DEBUG_INFO("sipe_status_changed_by_user: res = %s", res ? "USER" : "MACHINE"); @@ -229,13 +228,10 @@ gboolean sipe_status_changed_by_user(struct sipe_core_private *sipe_private) void sipe_core_status_idle(struct sipe_core_public *sipe_public) { struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE; - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; - if (sip) { - sip->idle_switch = time(NULL); - SIPE_DEBUG_INFO("sipe_core_status_idle: sip->idle_switch : %s", - asctime(localtime(&(sip->idle_switch)))); - } + sipe_private->idle_switch = time(NULL); + SIPE_DEBUG_INFO("sipe_core_status_idle: sipe_private->idle_switch : %s", + asctime(localtime(&(sipe_private->idle_switch)))); } /* diff --git a/src/core/sipe.h b/src/core/sipe.h index ba877764..f6620360 100644 --- a/src/core/sipe.h +++ b/src/core/sipe.h @@ -56,7 +56,6 @@ struct sipe_account_data { gchar *status; gchar *note; time_t note_since; - time_t idle_switch; struct _PurpleAccount *account; }; -- 2.11.4.GIT