[evolution-exchange] Adapt to sealed up CamelService.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-exchange] Adapt to sealed up CamelService.
- Date: Sun, 17 Apr 2011 18:07:23 +0000 (UTC)
commit a9ef44b4fed90c1c45a34fb96a19c1357cd334f9
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Apr 17 13:33:56 2011 -0400
Adapt to sealed up CamelService.
camel/camel-exchange-store.c | 43 ++++++++++++++++++++++++-------------
camel/camel-exchange-transport.c | 8 +++++-
camel/camel-exchange-utils.c | 22 +++++++++++++++----
3 files changed, 51 insertions(+), 22 deletions(-)
---
diff --git a/camel/camel-exchange-store.c b/camel/camel-exchange-store.c
index 4ccc2a7..10a98ca 100644
--- a/camel/camel-exchange-store.c
+++ b/camel/camel-exchange-store.c
@@ -283,14 +283,18 @@ static gchar *
exchange_store_get_name (CamelService *service,
gboolean brief)
{
+ CamelURL *url;
+
+ url = camel_service_get_camel_url (service);
+
if (brief) {
return g_strdup_printf (
_("Exchange server %s"),
- service->url->host);
+ url->host);
} else {
return g_strdup_printf (
_("Exchange account for %s on %s"),
- service->url->user, service->url->host);
+ url->user, url->host);
}
}
@@ -303,7 +307,8 @@ exchange_store_connect_sync (CamelService *service,
gchar *password = NULL;
guint32 connect_status;
gboolean online_mode = FALSE;
- CamelSession *session = camel_service_get_session (service);
+ CamelSession *session;
+ CamelURL *url;
GError *local_error = NULL;
/* This lock is only needed for offline operation.
@@ -311,10 +316,13 @@ exchange_store_connect_sync (CamelService *service,
g_mutex_lock (exch->connect_lock);
+ url = camel_service_get_camel_url (service);
+ session = camel_service_get_session (service);
+
online_mode = camel_session_get_online (session);
if (online_mode) {
- if (!service->url->passwd) {
+ if (!url->passwd) {
gchar *prompt;
guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
@@ -322,23 +330,23 @@ exchange_store_connect_sync (CamelService *service,
prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
prompt = camel_session_build_password_prompt (
- "Exchange", service->url->user, service->url->host);
+ "Exchange", url->user, url->host);
- service->url->passwd = camel_session_get_password (
+ url->passwd = camel_session_get_password (
session, service, "Exchange", prompt,
"password", prompt_flags, error);
g_free (prompt);
- exch->reprompt_password = service->url->passwd == NULL;
+ exch->reprompt_password = url->passwd == NULL;
}
- if (service->url->passwd == NULL) {
+ if (url->passwd == NULL) {
g_mutex_unlock (exch->connect_lock);
return FALSE;
}
- password = service->url->passwd;
+ password = url->passwd;
}
/* Initialize the stub connection */
@@ -360,9 +368,9 @@ exchange_store_connect_sync (CamelService *service,
if (!connect_status) {
exch->reprompt_password = TRUE;
- if (service->url->passwd) {
- g_free (service->url->passwd);
- service->url->passwd = NULL;
+ if (url->passwd) {
+ g_free (url->passwd);
+ url->passwd = NULL;
}
g_clear_error (error);
@@ -409,12 +417,15 @@ exchange_store_can_refresh_folder (CamelStore *store,
GError **error)
{
CamelStoreClass *store_class;
+ CamelURL *url;
gboolean res;
store_class = CAMEL_STORE_CLASS (camel_exchange_store_parent_class);
+ url = camel_service_get_camel_url (CAMEL_SERVICE (store));
+
res = store_class->can_refresh_folder (store, info, error) ||
- (camel_url_get_param (((CamelService *)store)->url, "check_all") != NULL);
+ (camel_url_get_param (url, "check_all") != NULL);
return res;
}
@@ -823,15 +834,17 @@ camel_exchange_store_connected (CamelExchangeStore *store,
GCancellable *cancellable,
GError **error)
{
+ CamelServiceConnectionStatus status;
CamelService *service;
CamelSession *session;
g_return_val_if_fail (CAMEL_IS_EXCHANGE_STORE (store), FALSE);
service = CAMEL_SERVICE (store);
- session = service->session;
+ session = camel_service_get_session (service);
+ status = camel_service_get_connection_status (service);
- if (service->status != CAMEL_SERVICE_CONNECTED &&
+ if (status != CAMEL_SERVICE_CONNECTED &&
camel_session_get_online (session) &&
!camel_service_connect_sync (service, error)) {
return FALSE;
diff --git a/camel/camel-exchange-transport.c b/camel/camel-exchange-transport.c
index 82c4aac..172f5a7 100644
--- a/camel/camel-exchange-transport.c
+++ b/camel/camel-exchange-transport.c
@@ -39,7 +39,8 @@ exchange_transport_send_to_sync (CamelTransport *transport,
GCancellable *cancellable,
GError **error)
{
- CamelService *service = CAMEL_SERVICE (transport);
+ CamelService *service;
+ CamelSession *session;
CamelStore *store = NULL;
gchar *url_string;
CamelInternetAddress *cia;
@@ -54,8 +55,11 @@ exchange_transport_send_to_sync (CamelTransport *transport,
GSList *h, *bcc = NULL;
gint len, i;
+ service = CAMEL_SERVICE (transport);
+ session = camel_service_get_session (service);
+
url_string = camel_session_get_password (
- service->session, service, NULL,
+ session, service, NULL,
"ignored", "popb4smtp_uri", 0, error);
if (!url_string)
return FALSE;
diff --git a/camel/camel-exchange-utils.c b/camel/camel-exchange-utils.c
index 3eb15b7..e0b40a3 100644
--- a/camel/camel-exchange-utils.c
+++ b/camel/camel-exchange-utils.c
@@ -109,8 +109,12 @@ static const gchar *mapi_message_props[] = {
};
static gboolean
-is_same_ed (CamelExchangeStore *estore, ExchangeAccount *eaccount, CamelService *service)
+is_same_ed (CamelExchangeStore *estore,
+ ExchangeAccount *eaccount,
+ CamelService *service)
{
+ CamelURL *service_url;
+
g_return_val_if_fail (eaccount != NULL, FALSE);
g_return_val_if_fail (service != NULL, FALSE);
g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
@@ -118,8 +122,16 @@ is_same_ed (CamelExchangeStore *estore, ExchangeAccount *eaccount, CamelService
if (CAMEL_IS_EXCHANGE_STORE (service) && estore && estore == CAMEL_EXCHANGE_STORE (service))
return TRUE;
- if (service->url) {
- if (estore && camel_url_equal (CAMEL_SERVICE (estore)->url, service->url))
+ service_url = camel_service_get_camel_url (service);
+
+ if (service_url) {
+ CamelURL *estore_url = NULL;
+
+ if (estore != NULL)
+ estore_url = camel_service_get_camel_url (
+ CAMEL_SERVICE (estore));
+
+ if (estore_url != NULL && camel_url_equal (estore_url, service_url))
return TRUE;
if (eaccount) {
@@ -132,8 +144,8 @@ is_same_ed (CamelExchangeStore *estore, ExchangeAccount *eaccount, CamelService
if (url) {
CamelProvider *provider = camel_service_get_provider (service);
- if ((provider && provider->url_equal && provider->url_equal (url, service->url))
- || camel_url_equal (url, service->url)) {
+ if ((provider && provider->url_equal && provider->url_equal (url, service_url))
+ || camel_url_equal (url, service_url)) {
camel_url_free (url);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]