From 70a572b8589db37e11ec5773ab2983821ebe80cd Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 8 Dec 2011 16:12:57 +0200 Subject: [PATCH] core cleanup: move out email & user_states field Rename it to ocs2005_user_states to make purpose clear. --- src/core/sipe-cal.c | 2 +- src/core/sipe-core-private.h | 18 +++++++++++++++++- src/core/sipe-core.c | 6 +++--- src/core/sipe-ocs2005.c | 11 +++++------ src/core/sipe-utils.c | 3 +-- src/core/sipe.h | 11 ----------- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/core/sipe-cal.c b/src/core/sipe-cal.c index 8dd0b588..3fe6d4ec 100644 --- a/src/core/sipe-cal.c +++ b/src/core/sipe-cal.c @@ -220,7 +220,7 @@ sipe_cal_calendar_init(struct sipe_core_private *sipe_private, cal = g_new0(struct sipe_calendar, 1); cal->sipe_private = sipe_private; - cal->email = g_strdup(sip->email); + cal->email = g_strdup(sipe_private->email); /* user specified a service URL? */ value = sipe_backend_setting(SIPE_CORE_PUBLIC, SIPE_SETTING_EMAIL_URL); diff --git a/src/core/sipe-core-private.h b/src/core/sipe-core-private.h index a133c18e..41d439a9 100644 --- a/src/core/sipe-core-private.h +++ b/src/core/sipe-core-private.h @@ -48,8 +48,11 @@ struct sipe_core_private { const struct sip_service_data *service_data; guint transport_type; - /* SIPE protocol information */ + /* Account information */ gchar *username; + gchar *email; + + /* SIPE protocol information */ gchar *contact; gchar *epid; gchar *focus_factory_uri; @@ -67,6 +70,19 @@ struct sipe_core_private { /* Calendar and related stuff */ struct sipe_calendar *calendar; + /* + * 2005 Custom XML piece + * + * Possibly set by other point of presence or just other client at + * earlier time. It should be preserved/modified, not overwritten. + * This implies subscription to self-contact. Information kept: + * + * - User note + * - OOF flag + * - User status + */ + gchar *ocs2005_user_states; + /* Scheduling system */ GSList *timeouts; diff --git a/src/core/sipe-core.c b/src/core/sipe-core.c index 579e466c..30beed2f 100644 --- a/src/core/sipe-core.c +++ b/src/core/sipe-core.c @@ -268,7 +268,7 @@ struct sipe_core_public *sipe_core_allocate(const gchar *signin_name, SIPE_CORE_PRIVATE_FLAG_UNSET(SUBSCRIBED_BUDDIES); SIPE_CORE_PRIVATE_FLAG_UNSET(INITIAL_PUBLISH); sipe_private->username = g_strdup(signin_name); - sip->email = is_empty(email) ? g_strdup(signin_name) : g_strdup(email); + sipe_private->email = is_empty(email) ? g_strdup(signin_name) : g_strdup(email); sip->authdomain = is_empty(login_domain) ? NULL : g_strdup(login_domain); sip->authuser = is_empty(login_account) ? NULL : g_strdup(login_account); sip->password = g_strdup(password); @@ -365,13 +365,13 @@ void sipe_core_deallocate(struct sipe_core_public *sipe_public) g_free(sipe_private->public.sip_name); g_free(sipe_private->public.sip_domain); g_free(sipe_private->username); - g_free(sip->email); + g_free(sipe_private->email); g_free(sip->password); g_free(sip->authdomain); g_free(sip->authuser); g_free(sip->status); g_free(sip->note); - g_free(sip->user_states); + g_free(sipe_private->ocs2005_user_states); sipe_buddy_free_all(sipe_private); g_hash_table_destroy(sipe_private->buddies); diff --git a/src/core/sipe-ocs2005.c b/src/core/sipe-ocs2005.c index d4197043..224f4e92 100644 --- a/src/core/sipe-ocs2005.c +++ b/src/core/sipe-ocs2005.c @@ -160,13 +160,12 @@ const gchar *sipe_ocs2005_activity_description(guint activity) void sipe_ocs2005_user_info_has_updated(struct sipe_core_private *sipe_private, const sipe_xml *xn_userinfo) { - struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE; const sipe_xml *xn_states; - g_free(sip->user_states); - sip->user_states = NULL; + g_free(sipe_private->ocs2005_user_states); + sipe_private->ocs2005_user_states = NULL; if ((xn_states = sipe_xml_child(xn_userinfo, "states")) != NULL) { - gchar *orig = sip->user_states = sipe_xml_stringify(xn_states); + gchar *orig = sipe_private->ocs2005_user_states = sipe_xml_stringify(xn_states); /* this is a hack-around to remove added newline after inner element, * state in this case, where it shouldn't be. @@ -358,8 +357,8 @@ static void send_presence_soap(struct sipe_core_private *sipe_private, } else /* preserve existing publication */ { - if (sip->user_states) { - states = g_strdup(sip->user_states); + if (sipe_private->ocs2005_user_states) { + states = g_strdup(sipe_private->ocs2005_user_states); } } } else { diff --git a/src/core/sipe-utils.c b/src/core/sipe-utils.c index e1458507..c976660f 100644 --- a/src/core/sipe-utils.c +++ b/src/core/sipe-utils.c @@ -32,7 +32,6 @@ #include "sipe-core-private.h" #include "sipe-utils.h" #include "uuid.h" -#include "sipe.h" /* Generate 16 random bits */ #define RANDOM16BITS (rand() & 0xFFFF) @@ -163,7 +162,7 @@ sipe_get_pub_instance(struct sipe_core_private *sipe_private, publication_key == SIPE_PUB_NOTE_OOF) { /* First hexadecimal digit is 0x4 */ unsigned calendar_id = 0; - char *mail_hash = sipe_get_epid(SIPE_ACCOUNT_DATA_PRIVATE->email, "", ""); + char *mail_hash = sipe_get_epid(sipe_private->email, "", ""); sscanf(mail_hash, "%08x", &calendar_id); g_free(mail_hash); diff --git a/src/core/sipe.h b/src/core/sipe.h index f04ff958..135cbb73 100644 --- a/src/core/sipe.h +++ b/src/core/sipe.h @@ -64,17 +64,6 @@ struct sipe_account_data { GSList *containers; /* MS-PRES containers */ struct _PurpleAccount *account; gchar *regcallid; - gchar *email; - /** 2005 Custom XML piece. - * Possibly set by other point of presence or just other client at earlier time. - * It should be preserved/modified, not overwritten. This implies subscription - * to self-contasct. - * This XML keeps OC2005: - * - User note - * - OOF flag - * - User status - */ - gchar *user_states; }; /** -- 2.11.4.GIT