[evolution-data-server/work: 2/3] Handle the case of invalid connections in mailer.
- From: Chenthill Palanisamy <pchen src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-data-server/work: 2/3] Handle the case of invalid connections in mailer.
- Date: Tue, 19 May 2009 09:37:46 -0400 (EDT)
commit 8c6ff4c67cced3e2c72b6a1f9070da2c2b403bb6
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Tue May 19 18:01:32 2009 +0530
Handle the case of invalid connections in mailer.
---
camel/providers/groupwise/camel-groupwise-folder.c | 31 ++++++++++++++++---
camel/providers/groupwise/camel-groupwise-store.c | 19 ++++++++++++
servers/groupwise/e-gw-connection.c | 2 +
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/camel/providers/groupwise/camel-groupwise-folder.c b/camel/providers/groupwise/camel-groupwise-folder.c
index da3b6f2..69f9302 100644
--- a/camel/providers/groupwise/camel-groupwise-folder.c
+++ b/camel/providers/groupwise/camel-groupwise-folder.c
@@ -286,6 +286,10 @@ groupwise_populate_msg_body_from_item (EGwConnection *cnc, CamelMultipart *multi
status = e_gw_connection_get_attachment (cnc,
e_gw_item_get_msg_body_id (item), 0, -1,
(const char **)&temp_body, &len);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_attachment (cnc,
+ e_gw_item_get_msg_body_id (item), 0, -1,
+ (const char **)&temp_body, &len);
if (status != E_GW_CONNECTION_STATUS_OK) {
g_warning ("Could not get Messagebody\n");
}
@@ -558,6 +562,7 @@ update_junk_list (CamelStore *store, CamelMessageInfo *info, int flag)
CamelGroupwiseStore *gw_store= CAMEL_GROUPWISE_STORE(store);
CamelGroupwiseStorePrivate *priv = gw_store->priv;
EGwConnection *cnc = cnc_lookup (priv);
+ EGwConnectionStatus status;
if (!(from = g_strdup (camel_message_info_from (info))))
goto error;
@@ -574,12 +579,19 @@ update_junk_list (CamelStore *store, CamelMessageInfo *info, int flag)
if (!email || !email[index])
goto error;
- if (flag == ADD_JUNK_ENTRY)
- e_gw_connection_create_junk_entry (cnc, email[index], "email", "junk");
- else if (flag == REMOVE_JUNK_ENTRY) {
+ if (flag == ADD_JUNK_ENTRY) {
+ status = e_gw_connection_create_junk_entry (cnc, email[index], "email", "junk");
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_create_junk_entry (cnc, email[index], "email", "junk");
+
+ } else if (flag == REMOVE_JUNK_ENTRY) {
GList *list = NULL;
EGwJunkEntry *entry;
- if (e_gw_connection_get_junk_entries (cnc, &list)== E_GW_CONNECTION_STATUS_OK){
+ status = e_gw_connection_get_junk_entries (cnc, &list);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_junk_entries (cnc, &list);
+
+ if (status == E_GW_CONNECTION_STATUS_OK){
while (list) {
entry = list->data;
if (!g_ascii_strcasecmp (entry->match, email[index])) {
@@ -1005,6 +1017,8 @@ update_update (CamelSession *session, CamelSessionThreadMsg *msg)
camel_operation_start (NULL, _("Checking for deleted messages %s"), m->folder->name);
status = e_gw_connection_create_cursor (m->cnc, m->container_id, "id", NULL, &cursor);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_create_cursor (m->cnc, m->container_id, "id", NULL, &cursor);
if (status != E_GW_CONNECTION_STATUS_OK) {
g_warning ("ERROR update update\n");
goto end1;
@@ -1226,6 +1240,10 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
status = e_gw_connection_get_quick_messages (cnc, container_id,
"peek id",
&t_str, "New", NULL, source, -1, &slist);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_quick_messages (cnc, container_id,
+ "peek id",
+ &t_str, "New", NULL, source, -1, &slist);
if (status != E_GW_CONNECTION_STATUS_OK) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
goto end2;
@@ -1263,7 +1281,10 @@ groupwise_refresh_folder(CamelFolder *folder, CamelException *ex)
status = e_gw_connection_get_quick_messages (cnc, container_id,
"peek id",
&t_str, "Modified", NULL, source, -1, &slist);
-
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_quick_messages (cnc, container_id,
+ "peek id",
+ &t_str, "Modified", NULL, source, -1, &slist);
if (status != E_GW_CONNECTION_STATUS_OK) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
goto end3;
diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c
index 0f26dff..8da055b 100644
--- a/camel/providers/groupwise/camel-groupwise-store.c
+++ b/camel/providers/groupwise/camel-groupwise-store.c
@@ -624,6 +624,12 @@ groupwise_get_folder (CamelStore *store, const char *folder_name, guint32 flags,
CREATE_CURSOR_VIEW,
NULL,
&cursor);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_create_cursor (priv->cnc, container_id,
+ CREATE_CURSOR_VIEW,
+ NULL,
+ &cursor);
+
if (status != E_GW_CONNECTION_STATUS_OK) {
CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
g_free (container_id);
@@ -749,6 +755,11 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store, CamelFolder *folder, guin
CREATE_CURSOR_VIEW,
NULL,
&cursor);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_create_cursor (priv->cnc, container_id,
+ CREATE_CURSOR_VIEW,
+ NULL,
+ &cursor);
if (status != E_GW_CONNECTION_STATUS_OK) {
CAMEL_SERVICE_REC_UNLOCK (gw_store, connect_lock);
g_free (container_id);
@@ -946,6 +957,8 @@ groupwise_folders_sync (CamelGroupwiseStore *store, CamelException *ex)
}
status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
if (status != E_GW_CONNECTION_STATUS_OK) {
g_warning ("Could not get folder list..\n");
return;
@@ -1222,6 +1235,8 @@ create_junk_folder (CamelStore *store)
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
status = e_gw_connection_modify_junk_settings (priv->cnc, JUNK_ENABLE, 0, 0, JUNK_PERSISTENCE);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_modify_junk_settings (priv->cnc, JUNK_ENABLE, 0, 0, JUNK_PERSISTENCE);
if (status == E_GW_CONNECTION_STATUS_OK) {
root = groupwise_build_folder_info(groupwise_store, parent_name, folder_name);
camel_store_summary_save((CamelStoreSummary *)groupwise_store->summary);
@@ -1281,6 +1296,8 @@ groupwise_create_folder(CamelStore *store,
}
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
status = e_gw_connection_create_folder(priv->cnc,parent_id,folder_name, &child_container_id);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_create_folder(priv->cnc,parent_id,folder_name, &child_container_id);
if (status == E_GW_CONNECTION_STATUS_OK) {
root = groupwise_build_folder_info(groupwise_store, parent_name,folder_name);
camel_store_summary_save((CamelStoreSummary *)groupwise_store->summary);
@@ -1315,6 +1332,8 @@ groupwise_delete_folder(CamelStore *store,
container = g_hash_table_lookup (priv->name_hash, folder_name);
status = e_gw_connection_remove_item (priv->cnc, container, container);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_remove_item (priv->cnc, container, container);
if (status == E_GW_CONNECTION_STATUS_OK) {
groupwise_store_set_current_folder (groupwise_store, NULL);
diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c
index 3b6bf7c..fa586a8 100644
--- a/servers/groupwise/e-gw-connection.c
+++ b/servers/groupwise/e-gw-connection.c
@@ -803,6 +803,8 @@ e_gw_connection_get_container_id (EGwConnection *cnc, const char *name)
g_return_val_if_fail (name != NULL, NULL);
status = e_gw_connection_get_container_list (cnc, "folders", &container_list);
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ status = e_gw_connection_get_container_list (cnc, "folders", &container_list);
if (status != E_GW_CONNECTION_STATUS_OK) {
e_gw_connection_free_container_list (container_list);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]