[evolution-kolab/ek-wip-porting] KolabMailImapClient: build fixes (pt. I)
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting] KolabMailImapClient: build fixes (pt. I)
- Date: Thu, 8 Dec 2011 14:19:19 +0000 (UTC)
commit 24b65f0ccd583068aec0e415ebfb35ec52210602
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Thu Dec 8 12:33:47 2011 +0100
KolabMailImapClient: build fixes (pt. I)
* replaced CamelException with GError
* replaced CamelObject with GObject
* removed set-but-not-used variables
* pending: Camel API changes
src/libekolab/kolab-mail-imap-client.c | 338 ++++++++++++-------------------
1 files changed, 131 insertions(+), 207 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index aecdc34..0c2392e 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -29,9 +29,8 @@
#include <camel/camel-kolab-imapx-store.h>
#include <camel/camel-kolab-imapx-folder.h>
#include <camel/camel-kolab-session.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-mime-message.h>
+#include <libekolabutil/camel-system-headers.h>
#include <libekolabutil/kolab-util-glib.h>
#include <libekolabutil/kolab-util-error.h>
#include <libekolabutil/kolab-util-camel.h>
@@ -129,16 +128,17 @@ kolab_mail_imap_client_dispose (GObject *object)
priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
if (priv->folder != NULL)
- camel_object_unref (priv->folder);
+ g_object_unref (priv->folder);
if (priv->store != NULL)
- camel_object_unref (priv->store);
+ g_object_unref (priv->store);
if (priv->session != NULL)
- camel_object_unref (priv->session);
+ g_object_unref (priv->session);
if (priv->ksettings != NULL) /* ref'd in configure() */
g_object_unref (priv->ksettings);
+
if (priv->mimebuilder != NULL)
g_object_unref (priv->mimebuilder);
@@ -188,7 +188,7 @@ kolab_mail_imap_client_camel_get_folder (KolabMailImapClient *self,
{
KolabMailImapClientPrivate *priv = NULL;
CamelFolder *folder = NULL;
- CamelException *tmp_ex = NULL;
+ GError *tmp_err = NULL;
guint32 flags = 0; /* TODO check which flags to set */
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
@@ -200,29 +200,23 @@ kolab_mail_imap_client_camel_get_folder (KolabMailImapClient *self,
/* return cached CamelFolder, if it exists and is the required one */
if (priv->foldername != NULL) {
if (g_strcmp0 (priv->foldername, foldername) == 0) {
- camel_object_ref (priv->folder);
+ g_object_ref (priv->folder);
return priv->folder;
}
}
- tmp_ex = camel_exception_new ();
-
/* get new CamelFolder */
folder = camel_store_get_folder (CAMEL_STORE (priv->store),
foldername,
flags,
- tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
+ &tmp_err);
+ if (tmp_err != NULL) {
if (folder != NULL)
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return NULL;
}
- camel_exception_free (tmp_ex);
-
if (folder == NULL) {
g_set_error (err,
KOLAB_CAMEL_ERROR,
@@ -235,11 +229,11 @@ kolab_mail_imap_client_camel_get_folder (KolabMailImapClient *self,
/* bind new cached folder object */
if (priv->foldername != NULL) {
g_free (priv->foldername);
- camel_object_unref (priv->folder);
+ g_object_unref (priv->folder);
}
priv->foldername = g_strdup (foldername);
priv->folder = folder;
- camel_object_ref (priv->folder);
+ g_object_ref (priv->folder);
return priv->folder;
}
@@ -251,7 +245,7 @@ kolab_mail_imap_client_camel_gen_summaries (KolabMailImapClient *self,
KolabFolderContextID foldercontext,
GError **err)
{
- KolabMailImapClientPrivate *priv = NULL;
+ /* KolabMailImapClientPrivate *priv = NULL; */
CamelFolder *folder = NULL;
GHashTable *summaries = NULL;
GPtrArray *imap_uids = NULL;
@@ -267,7 +261,7 @@ kolab_mail_imap_client_camel_gen_summaries (KolabMailImapClient *self,
(foldercontext < KOLAB_FOLDER_LAST_CONTEXT));
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
+ /* priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self); */
folder = kolab_mail_imap_client_camel_get_folder (self,
foldername,
@@ -280,7 +274,7 @@ kolab_mail_imap_client_camel_gen_summaries (KolabMailImapClient *self,
/* get folder message info */
imap_uids = camel_folder_get_uids (folder);
if (imap_uids == NULL) {
- camel_object_unref (folder);
+ g_object_unref (folder);
g_debug ("%s: empty folder (%s)", __func__, foldername);
return NULL;
}
@@ -352,7 +346,7 @@ kolab_mail_imap_client_camel_gen_summaries (KolabMailImapClient *self,
}
camel_folder_free_uids (folder, imap_uids);
- camel_object_unref (folder);
+ g_object_unref (folder);
if (! have_entries) {
g_hash_table_destroy (summaries);
@@ -373,7 +367,6 @@ kolab_mail_imap_client_camel_get_msg_imap_uid (KolabMailImapClient *self,
CamelFolder *folder = NULL;
CamelMimeMessage *message = NULL;
CamelMessageInfo *mi = NULL;
- CamelException *tmp_ex = NULL;
GError *tmp_err = NULL;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
@@ -400,7 +393,7 @@ kolab_mail_imap_client_camel_get_msg_imap_uid (KolabMailImapClient *self,
*/
mi = camel_folder_get_message_info (folder, imap_uid);
if (mi == NULL) {
- camel_object_unref (folder);
+ g_object_unref (folder);
/* the message with the stored imap_uid may well no longer exist */
g_debug ("%s: Kolab UID (%s) IMAP UID (%s) could not get CamelMessageInfo",
__func__, kolab_uid, imap_uid);
@@ -411,14 +404,14 @@ kolab_mail_imap_client_camel_get_msg_imap_uid (KolabMailImapClient *self,
const gchar *subject = camel_message_info_subject (mi);
if (subject == NULL) {
camel_folder_free_message_info (folder, mi);
- camel_object_unref (folder);
+ g_object_unref (folder);
g_warning ("%s: Kolab UID (%s) IMAP UID (%s) have message with NULL subject",
__func__, kolab_uid, imap_uid);
return NULL;
}
if (g_strcmp0 (subject, kolab_uid) != 0) {
camel_folder_free_message_info (folder, mi);
- camel_object_unref (folder);
+ g_object_unref (folder);
g_debug ("%s: IMAP UID (%s) does not carry expected Kolab UID (%s)",
__func__, imap_uid, kolab_uid);
return NULL;
@@ -427,20 +420,15 @@ kolab_mail_imap_client_camel_get_msg_imap_uid (KolabMailImapClient *self,
camel_folder_free_message_info (folder, mi);
- tmp_ex = camel_exception_new ();
-
- message = camel_folder_get_message (folder, imap_uid, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
+ message = camel_folder_get_message (folder, imap_uid, &tmp_err);
+ if (tmp_err != NULL) {
if (message != NULL)
- camel_object_unref (message);
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_object_unref (message);
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return NULL;
}
- camel_exception_free (tmp_ex);
- camel_object_unref (folder);
+ g_object_unref (folder);
if (message == NULL) {
g_warning ("%s: IMAP UID (%s) NULL message in camel folder",
@@ -467,7 +455,6 @@ kolab_mail_imap_client_camel_get_msg_kolab_uid (KolabMailImapClient *self,
CamelFolder *folder = NULL;
CamelMimeMessage *message = NULL;
GPtrArray *imap_uids = NULL;
- CamelException *tmp_ex = NULL;
GError *tmp_err = NULL;
guint ii = 0;
@@ -488,14 +475,10 @@ kolab_mail_imap_client_camel_get_msg_kolab_uid (KolabMailImapClient *self,
return NULL;
}
- tmp_ex = camel_exception_new ();
-
- camel_folder_refresh_info (folder, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ camel_folder_refresh_info (folder, &tmp_err);
+ if (tmp_err != NULL) {
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return NULL;
}
@@ -521,7 +504,7 @@ kolab_mail_imap_client_camel_get_msg_kolab_uid (KolabMailImapClient *self,
&tmp_err);
if (tmp_err != NULL) {
if (message != NULL) {
- camel_object_unref (message);
+ g_object_unref (message);
message = NULL;
}
g_warning ("%s: %s", __func__, tmp_err->message);
@@ -535,7 +518,7 @@ kolab_mail_imap_client_camel_get_msg_kolab_uid (KolabMailImapClient *self,
msg_subject = camel_mime_message_get_subject (message);
if (msg_subject == NULL) {
- camel_object_unref (message);
+ g_object_unref (message);
message = NULL;
g_warning ("%s: NULL message subject in camel folder",
__func__);
@@ -544,13 +527,12 @@ kolab_mail_imap_client_camel_get_msg_kolab_uid (KolabMailImapClient *self,
if (g_strcmp0 (msg_subject, kolab_uid) == 0)
break; /* message found */
- camel_object_unref (message);
+ g_object_unref (message);
message = NULL;
}
camel_folder_free_uids (folder, imap_uids);
- camel_object_unref (folder);
- camel_exception_free (tmp_ex);
+ g_object_unref (folder);
return message;
}
@@ -565,7 +547,6 @@ kolab_mail_imap_client_update_folder (KolabMailImapClient *self,
{
KolabMailImapClientPrivate *priv = NULL;
CamelFolder *folder = NULL;
- CamelException *tmp_ex = NULL;
GError *tmp_err = NULL;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
@@ -588,52 +569,41 @@ kolab_mail_imap_client_update_folder (KolabMailImapClient *self,
* that folder in offline mode
*/
if (priv->is_online == FALSE) {
- camel_object_unref (folder);
+ g_object_unref (folder);
return TRUE;
}
- tmp_ex = camel_exception_new ();
-
camel_offline_folder_downsync (CAMEL_OFFLINE_FOLDER (folder),
NULL,
- tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ &tmp_err);
+ if (tmp_err != NULL) {
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_folder_sync (folder, TRUE, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ camel_folder_sync (folder, TRUE, &tmp_err);
+ if (tmp_err != NULL) {
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_folder_expunge (folder, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ camel_folder_expunge (folder, &tmp_err);
+ if (tmp_err != NULL) {
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_folder_refresh_info (folder, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- camel_object_unref (folder);
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ camel_folder_refresh_info (folder, &tmp_err);
+ if (tmp_err != NULL) {
+ g_object_unref (folder);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_exception_free (tmp_ex);
- camel_object_unref (folder);
+ g_object_unref (folder);
return TRUE;
}
@@ -689,7 +659,7 @@ kolab_mail_imap_client_configure (KolabMailImapClient *self,
}
/* create session object */
- priv->session = camel_kolab_session_new ();
+ priv->session = g_object_new (CAMEL_TYPE_KOLAB_SESSION, NULL /* FIXME set CamelSession properties */);
/* set up session object directories (create if not existing) */
@@ -709,7 +679,7 @@ kolab_mail_imap_client_configure (KolabMailImapClient *self,
g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_kolab_session_set_config_dir (priv->session, g_strdup(tmp_str));
+ camel_kolab_session_set_config_dir (priv->session, tmp_str);
/* set to offline state first */
camel_session_set_online (CAMEL_SESSION (priv->session), FALSE);
@@ -726,7 +696,6 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
CamelURL *camel_url = NULL;
gchar *camel_url_string = NULL;
const gchar *tmp_str = NULL;
- CamelException *tmp_ex = NULL;
KolabTLSVariantID tlsvariant = KOLAB_TLS_VARIANT_NONE;
const gchar *variant_str = NULL;
gchar *dbpath = NULL;
@@ -799,6 +768,7 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
g_propagate_error (err, tmp_err);
return FALSE;
}
+
switch (tlsvariant) {
case KOLAB_TLS_VARIANT_SSL:
variant_str = KOLAB_MAIL_IMAP_CLIENT_TLSVARIANT_SSL;
@@ -809,27 +779,27 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
default:
variant_str = KOLAB_MAIL_IMAP_CLIENT_TLSVARIANT_NONE;
}
+
camel_url_set_param (camel_url,
KOLAB_MAIL_IMAP_CLIENT_CAMELURL_PARAM_SSL,
variant_str);
/* camel_url_string = camel_url_to_string (camel_url, CAMEL_URL_HIDE_ALL); */
- camel_url_string = camel_url_to_string (camel_url, CAMEL_URL_HIDE_PASSWORD);
+ camel_url_string = camel_url_to_string (camel_url, 0);
g_debug ("%s: CamelURL: (%s)", __func__, camel_url_string);
/* bring up imapx object */
- tmp_ex = camel_exception_new ();
service = camel_session_get_service (CAMEL_SESSION (priv->session),
camel_url_string,
CAMEL_PROVIDER_STORE,
- tmp_ex);
+ &tmp_err);
g_free (camel_url_string);
camel_url_free (camel_url);
- if (camel_exception_is_set (tmp_ex)) {
+ if (tmp_err != NULL) {
g_debug ("%s: exception set", __func__);
- kolab_gerror_propagate_from_camelexception (err, tmp_ex, KOLAB_BACKEND_ERROR);
+ g_propagate_error (err, tmp_err);
if (service != NULL)
- camel_object_unref (service);
+ g_object_unref (service);
return FALSE;
}
if (service == NULL) {
@@ -843,8 +813,8 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
}
priv->store = CAMEL_KOLAB_IMAPX_STORE (service);
- ok = kolab_imapx_store_set_folder_context (priv->store,
- priv->context);
+ ok = camel_kolab_imapx_store_set_folder_context (priv->store,
+ priv->context);
if (! ok) {
g_set_error (err,
KOLAB_BACKEND_ERROR,
@@ -855,16 +825,13 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
}
/* set offline state */
- camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (priv->store),
- CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
- tmp_ex);
+ ok = camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (priv->store),
+ CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
+ &tmp_err);
if (! ok) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_exception_free (tmp_ex);
camel_session_set_online (CAMEL_SESSION (priv->session), FALSE);
/* store the data path for the configured account into the
@@ -896,8 +863,8 @@ kolab_mail_imap_client_shutdown (KolabMailImapClient *self,
GError **err)
{
KolabMailImapClientPrivate *priv = NULL;
- gboolean ok = FALSE;
GError *tmp_err = NULL;
+ gboolean ok = FALSE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
@@ -931,10 +898,9 @@ kolab_mail_imap_client_go_online (KolabMailImapClient *self,
GError **err)
{
KolabMailImapClientPrivate *priv = NULL;
- CamelException *tmp_ex = NULL;
const gchar *tmp_str = NULL;
- gboolean ok = FALSE;
GError *tmp_err = NULL;
+ gboolean ok = FALSE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
@@ -970,32 +936,26 @@ kolab_mail_imap_client_go_online (KolabMailImapClient *self,
/* remove local CamelFolder object */
if (priv->folder != NULL) {
- camel_object_unref (priv->folder);
+ g_object_unref (priv->folder);
priv->folder = NULL;
}
g_free (priv->foldername);
priv->foldername = NULL;
/* connect the camel service */
- tmp_ex = camel_exception_new ();
- ok = camel_service_connect (CAMEL_SERVICE (priv->store), tmp_ex);
+ ok = camel_service_connect (CAMEL_SERVICE (priv->store), &tmp_err);
camel_kolab_session_set_token_pin (priv->session, NULL); /* forget pin */
if (! ok) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (priv->store),
CAMEL_OFFLINE_STORE_NETWORK_AVAIL,
- tmp_ex);
+ &tmp_err);
if (! ok) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_exception_free (tmp_ex);
camel_session_set_online (CAMEL_SESSION (priv->session), TRUE);
g_debug ("KolabMailImapClient: changed state: online operation");
@@ -1009,7 +969,7 @@ kolab_mail_imap_client_go_offline (KolabMailImapClient *self,
GError **err)
{
KolabMailImapClientPrivate *priv = NULL;
- CamelException *tmp_ex = NULL;
+ GError *tmp_err = NULL;
gboolean ok = FALSE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
@@ -1024,21 +984,17 @@ kolab_mail_imap_client_go_offline (KolabMailImapClient *self,
/* remove local CamelFolder object */
if (priv->folder != NULL) {
- camel_object_unref (priv->folder);
+ g_object_unref (priv->folder);
priv->folder = NULL;
}
g_free (priv->foldername);
priv->foldername = NULL;
/* disconnect the camel service */
- tmp_ex = camel_exception_new ();
-
camel_offline_store_prepare_for_offline (CAMEL_OFFLINE_STORE (priv->store),
- tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ &tmp_err);
+ if (tmp_err != NULL) {
+ g_propagate_error (err, tmp_err);
return FALSE;
}
@@ -1053,25 +1009,20 @@ kolab_mail_imap_client_go_offline (KolabMailImapClient *self,
*/
/* issue LOGOUT message so we can get a BYE from server */
- kolab_imapx_store_logout_sync (priv->store);
+ camel_kolab_imapx_store_logout_sync (priv->store);
- ok = camel_service_disconnect (CAMEL_SERVICE (priv->store), TRUE, tmp_ex);
+ ok = camel_service_disconnect (CAMEL_SERVICE (priv->store), TRUE, &tmp_err);
if (! ok) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (priv->store),
CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL,
- tmp_ex);
+ &tmp_err);
if (! ok) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ g_propagate_error (err, tmp_err);
return FALSE;
}
- camel_exception_free (tmp_ex);
camel_session_set_online (CAMEL_SESSION (priv->session), FALSE);
g_debug ("KolabMailImapClient: changed state: offline operation");
@@ -1091,7 +1042,7 @@ kolab_mail_imap_client_query_foldernames (KolabMailImapClient *self,
CamelFolderInfo *fi = NULL;
GList *folder_list = NULL;
guint32 flags = 0;
- CamelException *tmp_ex = NULL;
+ GError *tmp_err = NULL;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
@@ -1100,28 +1051,22 @@ kolab_mail_imap_client_query_foldernames (KolabMailImapClient *self,
g_assert (priv->is_up == TRUE);
- tmp_ex = camel_exception_new ();
-
flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL;
fi = camel_store_get_folder_info (CAMEL_STORE (priv->store),
NULL,
flags,
- tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ &tmp_err);
+ if (tmp_err != NULL) {
+ g_propagate_error (err, tmp_err);
return NULL;
}
- camel_exception_free (tmp_ex);
-
if (fi == NULL)
return NULL;
camel_store_free_folder_info (CAMEL_STORE (priv->store), fi);
- folder_list = kolab_imapx_store_resect_folder_list (priv->store);
+ folder_list = camel_kolab_imapx_store_resect_folder_list (priv->store);
return folder_list;
}
@@ -1140,9 +1085,9 @@ kolab_mail_imap_client_get_folder_type (KolabMailImapClient *self,
priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
- foldertype = kolab_imapx_store_get_folder_type (priv->store,
- foldername,
- &tmp_err);
+ foldertype = camel_kolab_imapx_store_get_folder_type (priv->store,
+ foldername,
+ &tmp_err);
if (tmp_err != NULL) {
g_propagate_error (err, tmp_err);
return KOLAB_FOLDER_TYPE_INVAL;
@@ -1190,9 +1135,9 @@ kolab_mail_imap_client_get_folder_uidvalidity (KolabMailImapClient *self,
* read 0 (zero), so we cannot detect a change
* there presently
*/
- uidvalidity = camel_kolab_imapx_folder_get_uidvalidity (folder,
+ uidvalidity = camel_kolab_imapx_folder_get_uidvalidity (CAMEL_KOLAB_IMAPX_FOLDER (folder),
&tmp_err);
- camel_object_unref (folder);
+ g_object_unref (folder);
if (tmp_err != NULL) {
g_propagate_error (err, tmp_err);
return 0;
@@ -1206,7 +1151,7 @@ kolab_mail_imap_client_query_folder_summary (KolabMailImapClient *self,
const gchar *foldername,
GError **err)
{
- KolabMailImapClientPrivate *priv = NULL;
+ /* KolabMailImapClientPrivate *priv = NULL; */
KolabFolderTypeID foldertype = KOLAB_FOLDER_TYPE_INVAL;
KolabFolderSummary *summary = NULL;
guint64 uidvalidity = 0;
@@ -1216,7 +1161,7 @@ kolab_mail_imap_client_query_folder_summary (KolabMailImapClient *self,
g_assert (foldername != NULL);
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
- priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
+ /* priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self); */
foldertype = kolab_mail_imap_client_get_folder_type (self,
foldername,
@@ -1346,8 +1291,8 @@ kolab_mail_imap_client_query_summaries (KolabMailImapClient *self,
GHashTable *summaries = NULL;
KolabFolderTypeID foldertype = KOLAB_FOLDER_TYPE_INVAL;
KolabFolderContextID foldercontext = KOLAB_FOLDER_CONTEXT_INVAL;
- gboolean ok = FALSE;
GError *tmp_err = NULL;
+ gboolean ok = FALSE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_assert (foldername != NULL);
@@ -1420,9 +1365,8 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
CamelMimeMessage *orig_message = NULL;
CamelMimeMessage *stored_message = NULL;
CamelFolder *folder = NULL;
- CamelException *tmp_ex = NULL;
- gboolean ok = TRUE;
GError *tmp_err = NULL;
+ gboolean ok = TRUE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_assert ((kmailhandle != NULL) || (foldername != NULL));
@@ -1548,14 +1492,12 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
if (! ok)
goto cleanup;
- tmp_ex = camel_exception_new ();
-
/* append the new message to the imap folder */
camel_folder_append_message (folder,
new_message,
NULL,
/* new IMAP UID never reported by IMAPX */ NULL,
- tmp_ex);
+ &tmp_err);
/* FIXME CamelIMAPX error reporting is not working in all cases
* - tmp_ex is not set here if the server rejects the message
@@ -1564,7 +1506,7 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
* - IMAPX currently never reports the IMAP UID of a freshly
* stored message
*/
- if (camel_exception_is_set (tmp_ex))
+ if (tmp_err != NULL)
goto cleanup;
/* FIXME need to read-back email from the server right away for several reasons:
@@ -1623,8 +1565,6 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
camel_medium_set_header (CAMEL_MEDIUM (orig_message),
KOLAB_MAIL_IMAP_CLIENT_X_EVO_UID_HEADER,
NULL);
- if (camel_exception_is_set (tmp_ex))
- goto cleanup;
} else {
g_warning ("%s: Kolab UID (%s) Folder (%s) IMAP UID not set on camel message",
__func__, kolab_uid, foldername);
@@ -1632,13 +1572,13 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
}
/* update folder */
- camel_folder_sync (folder, TRUE, tmp_ex);
- if (camel_exception_is_set (tmp_ex))
+ camel_folder_sync (folder, TRUE, &tmp_err);
+ if (tmp_err != NULL)
goto cleanup;
/* refresh folder info */
- camel_folder_refresh_info (folder, tmp_ex);
- if (camel_exception_is_set (tmp_ex))
+ camel_folder_refresh_info (folder, &tmp_err);
+ if (tmp_err != NULL)
goto cleanup;
kolab_mail_summary_set_char_field (summary,
@@ -1652,28 +1592,18 @@ kolab_mail_imap_client_store (KolabMailImapClient *self,
kolab_mail_handle_drop_kconvmail (kmailhandle);
cleanup:
- /* !! a set CamelException and a set GError are mutually exclusive here !! */
- if (camel_exception_is_set (tmp_ex)) {
- ok = FALSE;
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
- } else {
- camel_exception_free (tmp_ex);
- ok = TRUE;
- }
if (tmp_err != NULL) {
ok = FALSE;
g_propagate_error (err, tmp_err);
}
if (orig_message != NULL)
- camel_object_unref (orig_message);
+ g_object_unref (orig_message);
if (new_message != NULL)
- camel_object_unref (new_message);
+ g_object_unref (new_message);
if (stored_message != NULL)
- camel_object_unref (stored_message);
+ g_object_unref (stored_message);
if (folder != NULL)
- camel_object_unref (folder);
+ g_object_unref (folder);
if (stored_imap_uid != NULL)
g_free (stored_imap_uid);
@@ -1697,8 +1627,8 @@ kolab_mail_imap_client_retrieve (KolabMailImapClient *self,
const gchar *foldername = NULL;
CamelMimeMessage *camel_message = NULL;
Kolab_conv_mail *kconvmail = NULL;
- gboolean ok = TRUE;
GError *tmp_err = NULL;
+ gboolean ok = TRUE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_assert (KOLAB_IS_MAIL_HANDLE (kmailhandle));
@@ -1809,7 +1739,7 @@ kolab_mail_imap_client_retrieve (KolabMailImapClient *self,
kconvmail = kolab_mail_mime_builder_conv_new_from_camel (priv->mimebuilder,
camel_message,
&tmp_err);
- camel_object_unref (camel_message);
+ g_object_unref (camel_message);
if (kconvmail == NULL) {
g_propagate_error (err, tmp_err);
@@ -1849,9 +1779,8 @@ kolab_mail_imap_client_delete (KolabMailImapClient *self,
gchar *imap_uid = NULL;
CamelFolder *folder = NULL;
CamelMimeMessage *camel_message = NULL;
- CamelException *tmp_ex = NULL;
- gboolean ok = TRUE;
GError *tmp_err = NULL;
+ gboolean ok = TRUE;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
g_assert (KOLAB_IS_MAIL_HANDLE (kmailhandle));
@@ -1950,21 +1879,21 @@ kolab_mail_imap_client_delete (KolabMailImapClient *self,
if (camel_message == NULL) {
g_warning ("%s: UID (%s) not found in folder (%s)",
__func__, kolab_uid, foldername);
- camel_folder_sync (folder, TRUE, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
+ camel_folder_sync (folder, TRUE, &tmp_err);
+ if (tmp_err != NULL) {
g_warning ("%s: %s",
- __func__,
- camel_exception_get_description (tmp_ex));
+ __func__, tmp_err->message);
+ g_error_free (tmp_err);
+ tmp_err = NULL;
}
- camel_exception_clear (tmp_ex);
- camel_folder_refresh_info (folder, tmp_ex);
- if (camel_exception_is_set (tmp_ex)) {
+ camel_folder_refresh_info (folder, &tmp_err);
+ if (tmp_err != NULL) {
g_warning ("%s: %s",
- __func__,
- camel_exception_get_description (tmp_ex));
+ __func__, tmp_err->message);
+ g_error_free (tmp_err);
+ tmp_err = NULL;
}
- camel_exception_free (tmp_ex);
- camel_object_unref (folder);
+ g_object_unref (folder);
if (imap_uid != NULL)
g_free (imap_uid);
return TRUE;
@@ -1977,9 +1906,7 @@ kolab_mail_imap_client_delete (KolabMailImapClient *self,
camel_medium_set_header (CAMEL_MEDIUM (camel_message),
KOLAB_MAIL_IMAP_CLIENT_X_EVO_UID_HEADER,
NULL);
- camel_object_unref (camel_message);
-
- tmp_ex = camel_exception_new ();
+ g_object_unref (camel_message);
if (imap_uid != NULL) {
g_debug ("%s: Kolab UID (%s) Folder (%s) IMAP UID (%s) marking for deletion",
@@ -1990,26 +1917,23 @@ kolab_mail_imap_client_delete (KolabMailImapClient *self,
g_warning ("%s: Kolab UID (%s) IMAP UID not set on camel message",
__func__, kolab_uid);
- camel_folder_sync (folder, TRUE, tmp_ex);
- if (camel_exception_is_set (tmp_ex))
+ camel_folder_sync (folder, TRUE, &tmp_err);
+ if (tmp_err != NULL)
goto cleanup;
- camel_folder_refresh_info (folder, tmp_ex);
+ camel_folder_refresh_info (folder, &tmp_err);
cleanup:
- if (camel_exception_is_set (tmp_ex)) {
- kolab_gerror_propagate_from_camelexception (err,
- tmp_ex,
- KOLAB_CAMEL_ERROR);
+ if (tmp_err != NULL) {
+ g_propagate_error (err, tmp_err);
ok = FALSE;
} else {
- camel_exception_free (tmp_ex);
+ g_debug ("%s: Kolab UID (%s) Folder (%s) IMAP UID (%s) deleted",
+ __func__, kolab_uid, foldername, imap_uid);
ok = TRUE;
}
- g_debug ("%s: Kolab UID (%s) Folder (%s) IMAP UID (%s) deleted",
- __func__, kolab_uid, foldername, imap_uid);
if (imap_uid != NULL)
g_free (imap_uid);
- camel_object_unref (folder);
+ g_object_unref (folder);
return ok; /* TRUE or FALSE */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]