[evolution-ews] Coding style and whitespace cleanup.



commit 274d41029ceaaf054ba1631ec79417371407cfe3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Aug 18 17:39:44 2012 -0400

    Coding style and whitespace cleanup.

 src/addressbook/ews-book-backend-sqlitedb-test.c   |   24 +++--
 src/addressbook/ews-oab-decoder.c                  |   82 ++++++++++----
 src/addressbook/ews-oab-decoder.h                  |   61 ++++++-----
 src/calendar/e-cal-backend-ews.c                   |    2 +-
 src/camel/camel-ews-folder.c                       |    4 +-
 src/camel/camel-ews-provider.c                     |   11 +-
 src/camel/camel-ews-store-summary.c                |   52 ++++++---
 src/camel/camel-ews-store-summary.h                |    4 +-
 src/camel/camel-ews-store.c                        |   23 ++--
 src/camel/camel-ews-transport.c                    |   15 ++-
 src/camel/camel-ews-utils.c                        |  119 +++++++++++++-------
 src/camel/camel-ews-utils.h                        |   68 +++++++-----
 src/collection/e-ews-backend.c                     |   17 ++-
 src/configuration/e-ews-config-utils.c             |    3 +-
 src/configuration/e-ews-subscribe-foreign-folder.c |   89 +++++++++------
 src/server/e-ews-connection.c                      |   68 ++++++------
 src/server/e-ews-connection.h                      |   29 ++++--
 src/server/e-ews-folder.c                          |   84 +++++++-------
 src/server/e-ews-item-change.c                     |    6 +-
 src/server/e-soap-message.c                        |   14 ++-
 src/server/e-source-ews-folder.c                   |    5 +-
 src/server/tests/test-cuditem.c                    |   28 +++--
 src/server/tests/test-syncfolder.c                 |   26 ++++-
 src/utils/ews-test-finditem-query.c                |   44 +++++---
 24 files changed, 549 insertions(+), 329 deletions(-)
---
diff --git a/src/addressbook/ews-book-backend-sqlitedb-test.c b/src/addressbook/ews-book-backend-sqlitedb-test.c
index e24b42c..2daf937 100644
--- a/src/addressbook/ews-book-backend-sqlitedb-test.c
+++ b/src/addressbook/ews-book-backend-sqlitedb-test.c
@@ -81,7 +81,8 @@ add_contacts (EwsBookBackendSqliteDB *ebsdb)
 
 	con = e_contact_new_from_vcard (vcard_str);
 	contacts = g_slist_append (contacts, con);
-	ews_book_backend_sqlitedb_add_contacts (ebsdb, folderid, contacts, FALSE, &error);
+	ews_book_backend_sqlitedb_add_contacts (
+		ebsdb, folderid, contacts, FALSE, &error);
 
 	g_object_unref (con);
 }
@@ -96,7 +97,8 @@ search_db (EwsBookBackendSqliteDB *ebsdb,
 
 	g_print ("%s - query: %s \n", type, sexp);
 	op = type;
-	vcards = ews_book_backend_sqlitedb_search (ebsdb, folderid, sexp, NULL, NULL, NULL, &error);
+	vcards = ews_book_backend_sqlitedb_search (
+		ebsdb, folderid, sexp, NULL, NULL, NULL, &error);
 	if (error)
 		return;
 
@@ -129,32 +131,37 @@ start_tests (gpointer data)
 
 	g_print ("Getting is_populated \n");
 	op = "set is_populated";
-	ews_book_backend_sqlitedb_set_is_populated (ebsdb, folderid, TRUE, &error);
+	ews_book_backend_sqlitedb_set_is_populated (
+		ebsdb, folderid, TRUE, &error);
 	if (error)
 		goto exit;
 
 	g_print ("Setting is_populated \n");
 	op = "set is_populated";
-	populated = ews_book_backend_sqlitedb_get_is_populated (ebsdb, folderid, &error);
+	populated = ews_book_backend_sqlitedb_get_is_populated (
+		ebsdb, folderid, &error);
 	if (error)
 		goto exit;
 	g_print ("Populated: %d \n", populated);
 
 	g_print ("Setting key value \n");
 	op = "set key/value";
-	ews_book_backend_sqlitedb_set_key_value (ebsdb, folderid, "customkey", "stored", &error);
+	ews_book_backend_sqlitedb_set_key_value (
+		ebsdb, folderid, "customkey", "stored", &error);
 	if (error)
 		goto exit;
 
 	g_print ("Get Vcard string \n");
 	op = "get vcard string";
-	vcard_str = ews_book_backend_sqlitedb_get_vcard_string (ebsdb, folderid, uid, NULL, NULL, &error);
+	vcard_str = ews_book_backend_sqlitedb_get_vcard_string (
+		ebsdb, folderid, uid, NULL, NULL, &error);
 	if (error)
 		goto exit;
 	g_print ("VCard: %s \n", vcard_str);
 	g_free (vcard_str);
 
-	q = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_CONTAINS, "test");
+	q = e_book_query_field_test (
+		E_CONTACT_FULL_NAME, E_BOOK_QUERY_CONTAINS, "test");
 	sexp = e_book_query_to_string (q);
 	search_db (ebsdb, "summary query", sexp);
 	e_book_query_unref (q);
@@ -175,7 +182,8 @@ start_tests (gpointer data)
 	g_print ("Delete contact \n");
 	op = "delete contact";
 	uids = g_slist_append (uids, (gchar *) uid);
-	ews_book_backend_sqlitedb_remove_contacts (ebsdb, folderid, uids, &error);
+	ews_book_backend_sqlitedb_remove_contacts (
+		ebsdb, folderid, uids, &error);
 	g_slist_free (uids);
 	if (error)
 		goto exit;
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index 12bbadc..4878333 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -459,7 +459,10 @@ ews_decode_hdr_props (EwsOabDecoder *eod,
 	GSList **props;
 
 	/* number of properties */
-	num_props = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
+	num_props = ews_oab_read_uint32 (
+		G_INPUT_STREAM (priv->fis),
+		cancellable, error);
+
 	if (*error)
 		return FALSE;
 
@@ -474,15 +477,22 @@ ews_decode_hdr_props (EwsOabDecoder *eod,
 	}
 
 	for (i = 0; i < num_props; i++) {
-		guint32 prop_id, flags;
+		guint32 prop_id;
+
+		prop_id = ews_oab_read_uint32 (
+			G_INPUT_STREAM (priv->fis),
+			cancellable, error);
 
-		prop_id = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
-		d (g_print ("%X \n", prop_id);)
 		*props = g_slist_prepend (*props, GUINT_TO_POINTER (prop_id));
 
 		if (*error)
 			return FALSE;
-		flags = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
+
+		/* eat the flags */
+		ews_oab_read_uint32 (
+			G_INPUT_STREAM (priv->fis),
+			cancellable, error);
+
 		if (*error)
 			return FALSE;
 
@@ -502,10 +512,12 @@ ews_decode_metadata (EwsOabDecoder *eod,
 {
 	EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
 	gboolean ret = TRUE;
-	guint32 size;
 
-	/* Size */
-	size = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
+	/* eat the size */
+	ews_oab_read_uint32 (
+		G_INPUT_STREAM (priv->fis),
+		cancellable, error);
+
 	if (*error)
 		return FALSE;
 
@@ -691,10 +703,8 @@ ews_decode_oab_prop (EwsOabDecoder *eod,
 
 					if (prop_type == EWS_PTYP_MULTIPLEBINARY) {
 						val = ews_decode_binary (eod, cancellable, error);
-						d (g_print ("prop id %X prop type: multi-string %s \n", prop_id, val);)
 					} else {
 						val = ews_oab_read_upto (G_INPUT_STREAM (priv->fis), '\0', cancellable, error);
-						d (g_print ("prop id %X prop type: multi-string %s \n", prop_id, val);)
 					}
 
 					if (*error) {
@@ -832,10 +842,16 @@ ews_decode_and_store_oab_records (EwsOabDecoder *eod,
 {
 	EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
 	gboolean ret = TRUE;
-	guint32 size, i;
+	guint32 i;
+
+	/* eat the size */
+	ews_oab_read_uint32 (
+		G_INPUT_STREAM (priv->fis),
+		cancellable, error);
+
+	ews_decode_addressbook_record (
+		eod, NULL, NULL, priv->hdr_props, cancellable, error);
 
-	size = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
-	ews_decode_addressbook_record (eod, NULL, NULL, priv->hdr_props, cancellable, error);
 	if (*error) {
 		ret = FALSE;
 		goto exit;
@@ -849,25 +865,37 @@ ews_decode_and_store_oab_records (EwsOabDecoder *eod,
 
 		contact = e_contact_new ();
 		dset = g_new0 (EwsDeferredSet, 1);
-		size = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
+
+		/* eat the size */
+		ews_oab_read_uint32 (
+			G_INPUT_STREAM (priv->fis),
+			cancellable, error);
 
 		/* fetch the offset */
 		offset = g_seekable_tell ((GSeekable *) priv->fis);
 
-		ews_decode_addressbook_record (eod, contact, dset, priv->oab_props, cancellable, error);
+		ews_decode_addressbook_record (
+			eod, contact, dset,
+			priv->oab_props, cancellable, error);
+
 		if (*error)
 			goto error;
 
 		if (dset->addr)
-			e_contact_set (contact, E_CONTACT_ADDRESS_WORK, dset->addr);
+			e_contact_set (
+				contact,
+				E_CONTACT_ADDRESS_WORK,
+				dset->addr);
 
 		/* set the smtp address as contact's uid */
 		uid = (gchar *) e_contact_get (contact, E_CONTACT_EMAIL_1);
 		if (uid && *uid) {
 			e_contact_set (contact, E_CONTACT_UID, uid);
 
-			cb (contact, offset, ((gfloat) (i + 1) / priv->total_records) * 100, user_data, error);
-			d (g_print ("%s \n", e_vcard_to_string ((EVCard *) contact, EVC_FORMAT_VCARD_30));)
+			cb (
+				contact, offset,
+				((gfloat) (i + 1) / priv->total_records) * 100,
+				user_data, error);
 		}
 
 error:
@@ -895,12 +923,14 @@ ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
 	GSList *l;
 
 	if (!priv->oab_props) {
-		g_set_error_literal (error, EOD_ERROR, 1, "Oab props not found");
+		g_set_error_literal (
+			error, EOD_ERROR, 1,
+			"Oab props not found");
 		return NULL;
 	}
 
-	/* Ideally i would liked to store int as int instead of converting to string,
-	 * but sqlite db doesn't yet support storing keys as blob */
+	/* Ideally i would liked to store int as int instead of converting to
+	 * string, but sqlite db doesn't yet support storing keys as blob. */
 	for (l = priv->oab_props; l != NULL; l = g_slist_next (l)) {
 		guint32 prop_id = GPOINTER_TO_UINT (l->data);
 		g_string_append_printf (str, "%"G_GUINT32_FORMAT, prop_id);
@@ -928,7 +958,9 @@ ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
 
 	/* hmm is there a better way to check ? */
 	if (len < 2) {
-		g_set_error_literal (error, EOD_ERROR, 1, "Does not contain oab properties");
+		g_set_error_literal (
+			error, EOD_ERROR, 1,
+			"Does not contain oab properties");
 		return FALSE;
 	}
 
@@ -941,7 +973,8 @@ ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
 		guint32 prop_id;
 
 		sscanf (vals[i],"%"G_GUINT32_FORMAT,&prop_id);
-		priv->oab_props = g_slist_prepend (priv->oab_props, GUINT_TO_POINTER (prop_id));
+		priv->oab_props = g_slist_prepend (
+			priv->oab_props, GUINT_TO_POINTER (prop_id));
 		d (printf ("%X\n", prop_id);)
 	}
 
@@ -987,7 +1020,8 @@ ews_oab_decoder_decode (EwsOabDecoder *eod,
 	if (!ret)
 		goto exit;
 
-	ret = ews_decode_and_store_oab_records (eod, cb, user_data, cancellable, &err);
+	ret = ews_decode_and_store_oab_records (
+		eod, cb, user_data, cancellable, &err);
 exit:
 	if (o_hdr)
 		g_free (o_hdr);
diff --git a/src/addressbook/ews-oab-decoder.h b/src/addressbook/ews-oab-decoder.h
index f9ccba5..e4f034d 100644
--- a/src/addressbook/ews-oab-decoder.h
+++ b/src/addressbook/ews-oab-decoder.h
@@ -19,42 +19,50 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef _EWS_OAB_DECODER
-#define _EWS_OAB_DECODER
+#ifndef EWS_OAB_DECODER_H
+#define EWS_OAB_DECODER_H
 
 #include <libebook/libebook.h>
 
-G_BEGIN_DECLS
-
-#define EWS_TYPE_OAB_DECODER ews_oab_decoder_get_type()
-
+/* Standard GObject macros */
+#define EWS_TYPE_OAB_DECODER \
+	(ews_oab_decoder_get_type ())
 #define EWS_OAB_DECODER(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EWS_TYPE_OAB_DECODER, EwsOabDecoder))
-
-#define EWS_OAB_DECODER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EWS_TYPE_OAB_DECODER, EwsOabDecoderClass))
-
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EWS_TYPE_OAB_DECODER, EwsOabDecoder))
+#define EWS_OAB_DECODER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EWS_TYPE_OAB_DECODER, EwsOabDecoderClass))
 #define EWS_IS_OAB_DECODER(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EWS_TYPE_OAB_DECODER))
-
-#define EWS_IS_OAB_DECODER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EWS_TYPE_OAB_DECODER))
-
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EWS_TYPE_OAB_DECODER))
+#define EWS_IS_OAB_DECODER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EWS_TYPE_OAB_DECODER))
 #define EWS_OAB_DECODER_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EWS_TYPE_OAB_DECODER, EwsOabDecoderClass))
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), EWS_TYPE_OAB_DECODER, EwsOabDecoderClass))
 
-typedef struct {
-  GObject parent;
-} EwsOabDecoder;
+G_BEGIN_DECLS
+
+typedef struct _EwsOabDecoder EwsOabDecoder;
+typedef struct _EwsOabDecoderClass EwsOabDecoderClass;
 
-typedef struct {
-  GObjectClass parent_class;
-} EwsOabDecoderClass;
+struct _EwsOabDecoder {
+	GObject parent;
+};
 
-GType ews_oab_decoder_get_type (void);
+struct _EwsOabDecoderClass {
+	GObjectClass parent_class;
+};
 
-typedef void (*EwsOabContactAddedCb) (EContact *contact, goffset offset, guint percent_complete, gpointer user_data, GError **error);
+typedef void	(*EwsOabContactAddedCb)		(EContact *contact,
+						 goffset offset,
+						 guint percent_complete,
+						 gpointer user_data,
+						 GError **error);
 
+GType		ews_oab_decoder_get_type	(void);
 EwsOabDecoder *	ews_oab_decoder_new		(const gchar *oab_filename,
 						 const gchar *cache_dir,
 						 GError **error);
@@ -79,4 +87,5 @@ gboolean	ews_oab_decoder_set_oab_prop_string
 
 G_END_DECLS
 
-#endif /* _EWS_OAB_DECODER */
+#endif /* EWS_OAB_DECODER_H */
+
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 3e45353..30c2d87 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -705,7 +705,7 @@ e_cal_backend_ews_get_object (ECalBackend *backend,
 	comp = e_cal_backend_store_get_component (priv->store, uid, rid);
 	if (!comp) {
 		/* maybe a meeting invitation, for which the calendar item is not downloaded yet,
-		   thus synchronize local cache first */
+		 * thus synchronize local cache first */
 		ews_start_sync (cbews);
 
 		PRIV_UNLOCK (priv);
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index c310e59..7c656af 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -1079,12 +1079,12 @@ ews_folder_count_notify_cb (CamelFolderSummary *folder_summary,
 
 static gboolean
 folder_has_inbox_type (CamelEwsStore *ews_store,
-		       const gchar *folder_name)
+                       const gchar *folder_name)
 {
 	gchar *folder_id;
 	guint64 flags;
 
-	g_return_val_if_fail (CAMEL_IS_EWS_STORE( ews_store), FALSE);
+	g_return_val_if_fail (CAMEL_IS_EWS_STORE (ews_store), FALSE);
 	g_return_val_if_fail (folder_name != NULL, FALSE);
 
 	folder_id = camel_ews_store_summary_get_folder_id_from_name (ews_store->summary, folder_name);
diff --git a/src/camel/camel-ews-provider.c b/src/camel/camel-ews-provider.c
index 22300f1..b4641cc 100644
--- a/src/camel/camel-ews-provider.c
+++ b/src/camel/camel-ews-provider.c
@@ -63,7 +63,8 @@ static CamelProviderConfEntry ews_conf_entries[] = {
 
 	{ CAMEL_PROVIDER_CONF_SECTION_START, "connection", NULL, N_("Connection") },
 	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "timeout", NULL,
-	  /* Translators: '%s' is preplaced with a widget, where user can select how long the timeout should be */
+	  /* Translators: '%s' is preplaced with a widget, where "
+	   * user can select how long the timeout should be. */
 	  N_("Connection _timeout (in seconds) %s"), "0:1:0:32768" },
 	{ CAMEL_PROVIDER_CONF_SECTION_END },
 
@@ -113,11 +114,13 @@ camel_provider_module_init (void)
 {
 	ews_provider.url_hash = ews_url_hash;
 	ews_provider.url_equal = ews_url_equal;
-	ews_provider.authtypes = g_list_prepend (g_list_prepend (NULL, &camel_ews_basic_authtype), &camel_ews_ntlm_authtype);
+	ews_provider.authtypes = g_list_prepend (
+		g_list_prepend (NULL, &camel_ews_basic_authtype),
+		&camel_ews_ntlm_authtype);
 	ews_provider.translation_domain = GETTEXT_PACKAGE;
 
-	ews_provider.object_types[CAMEL_PROVIDER_STORE] =  camel_ews_store_get_type ();
-	ews_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_ews_transport_get_type ();
+	ews_provider.object_types[CAMEL_PROVIDER_STORE] =  CAMEL_TYPE_EWS_STORE;
+	ews_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = CAMEL_TYPE_EWS_TRANSPORT;
 
 	camel_provider_register (&ews_provider);
 }
diff --git a/src/camel/camel-ews-store-summary.c b/src/camel/camel-ews-store-summary.c
index 0ebbbfd..e96fc5d 100644
--- a/src/camel/camel-ews-store-summary.c
+++ b/src/camel/camel-ews-store-summary.c
@@ -160,13 +160,20 @@ camel_ews_store_summary_new (const gchar *path)
 
 	ews_summary->priv->path = g_strdup (path);
 	file = g_file_new_for_path (path);
-	ews_summary->priv->monitor_delete = g_file_monitor_file (file, G_FILE_MONITOR_SEND_MOVED, NULL, &error);
-
-	/* Remove this once we have camel_store_remove_storage api, which should be available from 3.2 */
-	if (!error)
-		g_signal_connect (ews_summary->priv->monitor_delete, "changed", G_CALLBACK (monitor_delete_cb), ews_summary);
-	else {
-		g_warning ("CamelEwsStoreSummary: Error create monitor_delete: %s \n", error->message);
+	ews_summary->priv->monitor_delete = g_file_monitor_file (
+		file, G_FILE_MONITOR_SEND_MOVED, NULL, &error);
+
+	/* Remove this once we have camel_store_remove_storage api,
+	 * which should be available from 3.2 */
+	if (!error) {
+		g_signal_connect (
+			ews_summary->priv->monitor_delete, "changed",
+			G_CALLBACK (monitor_delete_cb), ews_summary);
+	} else {
+		g_warning (
+			"CamelEwsStoreSummary: "
+			"Error create monitor_delete: %s \n",
+			error->message);
 		g_clear_error (&error);
 	}
 
@@ -181,17 +188,23 @@ camel_ews_store_summary_load (CamelEwsStoreSummary *ews_summary,
 {
 	CamelEwsStoreSummaryPrivate *priv = ews_summary->priv;
 	gboolean ret;
+	gint version;
 
 	S_LOCK (ews_summary);
 
 	ret = g_key_file_load_from_file (
 		priv->key_file, priv->path, 0, error);
 
-	if (CURRENT_SUMMARY_VERSION != g_key_file_get_integer (priv->key_file, STORE_GROUP_NAME, "Version", NULL)) {
+	version = g_key_file_get_integer (
+		priv->key_file, STORE_GROUP_NAME, "Version", NULL);
+
+	if (version != CURRENT_SUMMARY_VERSION) {
 		/* version doesn't match, get folders again */
 		camel_ews_store_summary_clear (ews_summary);
 
-		g_key_file_set_integer (priv->key_file, STORE_GROUP_NAME, "Version", CURRENT_SUMMARY_VERSION);
+		g_key_file_set_integer (
+			priv->key_file, STORE_GROUP_NAME,
+			"Version", CURRENT_SUMMARY_VERSION);
 	}
 
 	load_id_fname_hash (ews_summary);
@@ -369,7 +382,7 @@ camel_ews_store_summary_new_folder (CamelEwsStoreSummary *ews_summary,
                                     EEwsFolderType folder_type,
                                     guint64 folder_flags,
                                     guint64 total,
-				    gboolean foreign)
+                                    gboolean foreign)
 {
 	const gchar *folder_type_nick;
 
@@ -531,8 +544,8 @@ camel_ews_store_summary_set_folder_type (CamelEwsStoreSummary *ews_summary,
 
 void
 camel_ews_store_summary_set_foreign (CamelEwsStoreSummary *ews_summary,
-				     const gchar *folder_id,
-				     gboolean is_foreign)
+                                     const gchar *folder_id,
+                                     gboolean is_foreign)
 {
 	S_LOCK (ews_summary);
 
@@ -733,14 +746,15 @@ camel_ews_store_summary_get_folder_type (CamelEwsStoreSummary *ews_summary,
 
 gboolean
 camel_ews_store_summary_get_foreign (CamelEwsStoreSummary *ews_summary,
-				     const gchar *folder_id,
-				     GError **error)
+                                     const gchar *folder_id,
+                                     GError **error)
 {
 	gboolean ret;
 
 	S_LOCK (ews_summary);
 
-	ret = g_key_file_get_boolean (ews_summary->priv->key_file, folder_id, "Foreign", error);
+	ret = g_key_file_get_boolean (
+		ews_summary->priv->key_file, folder_id, "Foreign", error);
 
 	S_UNLOCK (ews_summary);
 
@@ -788,7 +802,10 @@ camel_ews_store_summary_get_folders (CamelEwsStoreSummary *ews_summary,
 		if (!g_ascii_strcasecmp (groups[i], STORE_GROUP_NAME))
 			continue;
 		if (prefixlen) {
-			const gchar *fname = g_hash_table_lookup (ews_summary->priv->id_fname_hash, groups[i]);
+			const gchar *fname;
+
+			fname = g_hash_table_lookup (
+				ews_summary->priv->id_fname_hash, groups[i]);
 
 			if (!fname || strncmp (fname, prefix, prefixlen) ||
 			    (fname[prefixlen] && fname[prefixlen] != '/'))
@@ -869,7 +886,8 @@ camel_ews_store_summary_get_folder_id_from_folder_type (CamelEwsStoreSummary *ew
 		gchar *id = l->data;
 		guint64 folder_flags;
 
-		folder_flags = camel_ews_store_summary_get_folder_flags (ews_summary, id, NULL);
+		folder_flags = camel_ews_store_summary_get_folder_flags (
+			ews_summary, id, NULL);
 		if ((folder_flags & CAMEL_FOLDER_TYPE_MASK) == folder_type &&
 		    (folder_flags & CAMEL_FOLDER_SYSTEM) != 0) {
 			folder_id = id;
diff --git a/src/camel/camel-ews-store-summary.h b/src/camel/camel-ews-store-summary.h
index 524b483..47e68eb 100644
--- a/src/camel/camel-ews-store-summary.h
+++ b/src/camel/camel-ews-store-summary.h
@@ -25,7 +25,9 @@
 	((obj), CAMEL_TYPE_EWS_STORE_SUMMARY, CamelEwsStoreSummaryClass))
 
 /* the last possible value from CAMEL_FOLDER_TYPE_MASK range */
-#define CAMEL_EWS_FOLDER_TYPE_JOURNAL (((CAMEL_FOLDER_TYPE_MASK >> CAMEL_FOLDER_TYPE_BIT) - 1) << CAMEL_FOLDER_TYPE_BIT)
+#define CAMEL_EWS_FOLDER_TYPE_JOURNAL \
+	(((CAMEL_FOLDER_TYPE_MASK >> CAMEL_FOLDER_TYPE_BIT) - 1) << \
+	CAMEL_FOLDER_TYPE_BIT)
 
 G_BEGIN_DECLS
 
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index 3546649..e80e3a2 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -274,16 +274,18 @@ camel_ews_store_ensure_virtual_folders (CamelEwsStore *ews_store)
 			g_free (use_name);
 
 			/* Translators: This composes a "Foreign Folders" folder name for case when
-			   user has such in his store already. The %s is replaced with "Foreign Folders",
-			   the %d with counter, thus it composes name like "Foreign Folders_1"
+			 * user has such in his store already. The %s is replaced with "Foreign Folders",
+			 * the %d with counter, thus it composes name like "Foreign Folders_1"
 			*/
-			use_name = g_strdup_printf (C_("ForeignFolders", "%s_%d"),
+			use_name = g_strdup_printf (
+				C_("ForeignFolders", "%s_%d"),
 				EWS_FOREIGN_FOLDER_ROOT_DISPLAY_NAME, counter);
 
 			tmp_fid = camel_ews_store_summary_get_folder_id_from_name (ews_store->summary, use_name);
 		}
 
-		camel_ews_store_summary_new_folder (ews_store->summary,
+		camel_ews_store_summary_new_folder (
+			ews_store->summary,
 			EWS_FOREIGN_FOLDER_ROOT_ID, NULL, NULL,
 			use_name ? use_name : EWS_FOREIGN_FOLDER_ROOT_DISPLAY_NAME,
 			E_EWS_FOLDER_TYPE_MAILBOX,
@@ -310,7 +312,7 @@ camel_ews_store_ensure_virtual_folders (CamelEwsStore *ews_store)
 
 void
 camel_ews_store_ensure_unique_path (CamelEwsStore *ews_store,
-				    gchar **ppath)
+                                    gchar **ppath)
 {
 	gboolean done;
 	guint counter = 0;
@@ -832,10 +834,11 @@ ews_get_folder_info_sync (CamelStore *store,
 	GError *local_error = NULL;
 
 	if ((flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) != 0) {
-		g_set_error_literal (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+		g_set_error_literal (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Cannot list folders available for subscription of Exchange Web Services account, "
-			  "use 'Subscribe to folder of other user' context menu option above the account node "
-			  "in the folder tree instead."));
+			"use 'Subscribe to folder of other user' context menu option above the account node "
+			"in the folder tree instead."));
 		return NULL;
 	}
 
@@ -1041,7 +1044,7 @@ ews_delete_folder_sync (CamelStore *store,
 
 	if (camel_ews_store_summary_get_foreign (ews_store->summary, fid, NULL)) {
 		/* do not delete foreign folders,
-		   just remove them from local store */
+		 * just remove them from local store */
 		success = TRUE;
 	} else {
 		EEwsConnection *connection;
@@ -1404,7 +1407,7 @@ ews_can_refresh_folder (CamelStore *store,
 
 static gboolean
 ews_store_folder_is_subscribed (CamelSubscribable *subscribable,
-				const gchar *folder_name)
+                                const gchar *folder_name)
 {
 	CamelEwsStore *ews_store = CAMEL_EWS_STORE (subscribable);
 	gchar *fid;
diff --git a/src/camel/camel-ews-transport.c b/src/camel/camel-ews-transport.c
index 195bd05..3f39051 100644
--- a/src/camel/camel-ews-transport.c
+++ b/src/camel/camel-ews-transport.c
@@ -124,11 +124,13 @@ ews_send_to_sync (CamelTransport *transport,
 	} else if (camel_address_length (CAMEL_ADDRESS (used_from)) > 1) {
 		g_set_error_literal (
 			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-			_("Exchange server cannot send message with multiple From addresses"));
+			_("Exchange server cannot send message with "
+			"multiple From addresses"));
 		goto exit;
 
 	} else {
 		const gchar *used_email = NULL;
+		gboolean addresses_match;
 
 		if (!camel_internet_address_get (used_from, 0, NULL, &used_email)) {
 			g_set_error_literal (
@@ -137,10 +139,17 @@ ews_send_to_sync (CamelTransport *transport,
 			goto exit;
 		}
 
-		if (!ews_email || !used_email || g_ascii_strcasecmp (ews_email, used_email) != 0) {
+		addresses_match =
+			(ews_email != NULL) &&
+			(used_email != NULL) &&
+			(g_ascii_strcasecmp (ews_email, used_email) == 0);
+
+		if (!addresses_match) {
 			g_set_error (
 				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-				_("Exchange server cannot send message as '%s', when the account was configured for address '%s'"),
+				_("Exchange server cannot send message as "
+				"'%s', when the account was configured for "
+				"address '%s'"),
 				used_email ? used_email : "NULL",
 				ews_email ? ews_email : "NULL");
 			goto exit;
diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c
index c783c8b..bd84c83 100644
--- a/src/camel/camel-ews-utils.c
+++ b/src/camel/camel-ews-utils.c
@@ -143,12 +143,11 @@ find_folders_recursive (const gchar *physical_path,
 		if (!callback (physical_path, path, data))
 			return FALSE;
 
-		subfolder_directory_path = g_strdup_printf ("%s/%s", physical_path, SUBFOLDER_DIR_NAME);
+		subfolder_directory_path = g_strdup_printf (
+			"%s/%s", physical_path, SUBFOLDER_DIR_NAME);
 	} else {
 		/* On the top level, we have no folders and,
-		 * consequently, no subfolder directory.
-		 */
-
+		 * consequently, no subfolder directory. */
 		subfolder_directory_path = g_strdup (physical_path);
 	}
 
@@ -170,7 +169,8 @@ find_folders_recursive (const gchar *physical_path,
 		if (dirent == NULL)
 			break;
 
-		file_path = g_strdup_printf ("%s/%s", subfolder_directory_path, dirent);
+		file_path = g_strdup_printf (
+			"%s/%s", subfolder_directory_path, dirent);
 
 		if (g_stat (file_path, &file_stat) < 0 ||
 		    !S_ISDIR (file_stat.st_mode)) {
@@ -180,7 +180,8 @@ find_folders_recursive (const gchar *physical_path,
 
 		new_path = g_strdup_printf ("%s/%s", path, dirent);
 
-		ok = find_folders_recursive (file_path, new_path, callback, data);
+		ok = find_folders_recursive (
+			file_path, new_path, callback, data);
 
 		g_free (file_path);
 		g_free (new_path);
@@ -334,14 +335,17 @@ sync_deleted_folders (CamelEwsStore *store,
 		if (!camel_ews_store_summary_has_folder (ews_summary, fid))
 			continue;
 
-		ftype = camel_ews_store_summary_get_folder_type (ews_summary, fid, NULL);
+		ftype = camel_ews_store_summary_get_folder_type (
+			ews_summary, fid, NULL);
 		if (ftype == E_EWS_FOLDER_TYPE_MAILBOX) {
 			fi = camel_ews_utils_build_folder_info (store, fid);
 
-			camel_ews_store_summary_remove_folder (ews_summary, fid, &error);
+			camel_ews_store_summary_remove_folder (
+				ews_summary, fid, &error);
 
-			camel_subscribable_folder_unsubscribed (CAMEL_SUBSCRIBABLE (store), fi);
-			camel_store_folder_deleted ((CamelStore *) store, fi);
+			camel_subscribable_folder_unsubscribed (
+				CAMEL_SUBSCRIBABLE (store), fi);
+			camel_store_folder_deleted (CAMEL_STORE (store), fi);
 
 			g_clear_error (&error);
 		}
@@ -363,13 +367,15 @@ ews_utils_rename_folder (CamelEwsStore *store,
 
 	camel_ews_store_summary_set_change_key (ews_summary, fid, changekey);
 	if (display_name)
-		camel_ews_store_summary_set_folder_name (ews_summary, fid, display_name);
+		camel_ews_store_summary_set_folder_name (
+			ews_summary, fid, display_name);
 	if (pfid)
-		camel_ews_store_summary_set_parent_folder_id (ews_summary, fid, pfid);
+		camel_ews_store_summary_set_parent_folder_id (
+			ews_summary, fid, pfid);
 
 	if (ftype == E_EWS_FOLDER_TYPE_MAILBOX) {
 		fi = camel_ews_utils_build_folder_info (store, fid);
-		camel_store_folder_renamed ((CamelStore *) store, old_fname, fi);
+		camel_store_folder_renamed (CAMEL_STORE (store), old_fname, fi);
 	}
 
 	return TRUE;
@@ -383,7 +389,7 @@ sync_updated_folders (CamelEwsStore *store,
 	GSList *l;
 
 	for (l = updated_folders; l != NULL; l = g_slist_next (l)) {
-		EEwsFolder *ews_folder = (EEwsFolder *)	l->data;
+		EEwsFolder *ews_folder = (EEwsFolder *) l->data;
 		EEwsFolderType ftype;
 		gchar *folder_name;
 		gchar *display_name;
@@ -394,7 +400,8 @@ sync_updated_folders (CamelEwsStore *store,
 			continue;
 
 		fid = e_ews_folder_get_id (ews_folder);
-		folder_name = camel_ews_store_summary_get_folder_full_name (ews_summary, fid->id, NULL);
+		folder_name = camel_ews_store_summary_get_folder_full_name (
+			ews_summary, fid->id, NULL);
 
 		pfid = e_ews_folder_get_parent_id (ews_folder);
 		display_name = g_strdup (e_ews_folder_get_name (ews_folder));
@@ -417,12 +424,14 @@ sync_updated_folders (CamelEwsStore *store,
 				if (!display_name)
 					goto done;
 
-				pfname = camel_ews_store_summary_get_folder_full_name (ews_summary, pfid->id, NULL);
+				pfname = camel_ews_store_summary_get_folder_full_name (
+					ews_summary, pfid->id, NULL);
 
 				/* If the lookup failed, it'll be because the new parent folder
 				 * is the message folder root. */
 				if (pfname) {
-					new_fname = g_strconcat (pfname, "/", display_name, NULL);
+					new_fname = g_strconcat (
+						pfname, "/", display_name, NULL);
 					g_free (pfname);
 				} else
 					new_fname = g_strdup (display_name);
@@ -480,7 +489,8 @@ add_folder_to_summary (CamelEwsStore *store,
 		pfid->id, fid->change_key,
 		dname, ftype, 0, total,
 		e_ews_folder_get_foreign (folder));
-	camel_ews_store_summary_set_folder_unread (ews_summary, fid->id, unread);
+	camel_ews_store_summary_set_folder_unread (
+		ews_summary, fid->id, unread);
 }
 
 static void
@@ -509,9 +519,12 @@ sync_created_folders (CamelEwsStore *ews_store,
 		add_folder_to_summary (ews_store, folder);
 
 		if (ftype == E_EWS_FOLDER_TYPE_MAILBOX) {
-			fi = camel_ews_utils_build_folder_info (ews_store, fid->id);
-			camel_store_folder_created ((CamelStore *) ews_store, fi);
-			camel_subscribable_folder_subscribed (CAMEL_SUBSCRIBABLE (ews_store), fi);
+			fi = camel_ews_utils_build_folder_info (
+				ews_store, fid->id);
+			camel_store_folder_created (
+				CAMEL_STORE (ews_store), fi);
+			camel_subscribable_folder_subscribed (
+				CAMEL_SUBSCRIBABLE (ews_store), fi);
 			camel_folder_info_free (fi);
 		}
 	}
@@ -531,16 +544,18 @@ ews_utils_sync_folders (CamelEwsStore *ews_store,
 
 	camel_ews_store_summary_save (ews_store->summary, &error);
 	if (error != NULL) {
-		g_print ("Error while saving store summary %s \n", error->message);
+		g_print (
+			"Error while saving store summary %s \n",
+			error->message);
 		g_clear_error (&error);
 	}
-	return;
 }
 
 void
 camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder,
                                     GSList *items_deleted)
 {
+	CamelStore *store;
 	CamelFolder *folder;
 	const gchar *full_name;
 	CamelFolderChangeInfo *ci;
@@ -549,22 +564,27 @@ camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder,
 	GList *items_deleted_list = NULL;
 
 	ci = camel_folder_change_info_new ();
-	ews_store = (CamelEwsStore *) camel_folder_get_parent_store ((CamelFolder *) ews_folder);
 
-	folder = (CamelFolder *) ews_folder;
+	folder = CAMEL_FOLDER (ews_folder);
 	full_name = camel_folder_get_full_name (folder);
 
+	store = camel_folder_get_parent_store (folder);
+	ews_store = CAMEL_EWS_STORE (store);
+
 	for (l = items_deleted; l != NULL; l = g_slist_next (l)) {
 		const gchar *id = l->data;
 
-		items_deleted_list = g_list_prepend (items_deleted_list, (gpointer) id);
+		items_deleted_list = g_list_prepend (
+			items_deleted_list, (gpointer) id);
 
 		camel_folder_summary_remove_uid (folder->summary, id);
 		camel_folder_change_info_remove_uid (ci, id);
 	}
 
 	items_deleted_list = g_list_reverse (items_deleted_list);
-	camel_db_delete_uids (((CamelStore *) ews_store)->cdb_w, full_name, items_deleted_list, NULL);
+	camel_db_delete_uids (
+		CAMEL_STORE (ews_store)->cdb_w,
+		full_name, items_deleted_list, NULL);
 	g_list_free (items_deleted_list);
 
 	if (camel_folder_change_info_changed (ci)) {
@@ -799,7 +819,9 @@ ews_set_threading_data (CamelEwsMessageInfo *mi,
 	msgid = camel_header_msgid_decode (message_id);
 	if (msgid) {
 		digest = get_md5_digest ((const guchar *) msgid);
-		memcpy (mi->info.message_id.id.hash, digest, sizeof (mi->info.message_id.id.hash));
+		memcpy (
+			mi->info.message_id.id.hash,
+			digest, sizeof (mi->info.message_id.id.hash));
 		g_free (digest);
 		g_free (msgid);
 	}
@@ -819,13 +841,17 @@ ews_set_threading_data (CamelEwsMessageInfo *mi,
 		return;
 
 	count = camel_header_references_list_size (&refs);
-	mi->info.references = g_malloc (sizeof (*mi->info.references) + ((count - 1) * sizeof (mi->info.references->references[0])));
+	mi->info.references = g_malloc (
+		sizeof (*mi->info.references) + ((count - 1) *
+		sizeof (mi->info.references->references[0])));
 	scan = refs;
 	count = 0;
 
 	while (scan) {
 		digest = get_md5_digest ((const guchar *) scan->id);
-		memcpy (mi->info.references->references[count].id.hash, digest, sizeof (mi->info.message_id.id.hash));
+		memcpy (
+			mi->info.references->references[count].id.hash,
+			digest, sizeof (mi->info.message_id.id.hash));
 		g_free (digest);
 
 		count++;
@@ -845,7 +871,7 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
 	GSList *l;
 
 	ci = camel_folder_change_info_new ();
-	folder = (CamelFolder *) ews_folder;
+	folder = CAMEL_FOLDER (ews_folder);
 
 	for (l = items_updated; l != NULL; l = g_slist_next (l)) {
 		EEwsItem *item = (EEwsItem *) l->data;
@@ -858,7 +884,8 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
 		}
 
 		id = e_ews_item_get_id (item);
-		mi = (CamelEwsMessageInfo *) camel_folder_summary_get (folder->summary, id->id);
+		mi = (CamelEwsMessageInfo *)
+			camel_folder_summary_get (folder->summary, id->id);
 		if (mi) {
 			gint server_flags;
 
@@ -884,7 +911,7 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
 	if (camel_folder_change_info_changed (ci)) {
 		camel_folder_summary_touch (folder->summary);
 		camel_folder_summary_save_to_db (folder->summary, NULL);
-		camel_folder_changed ((CamelFolder *) ews_folder, ci);
+		camel_folder_changed (CAMEL_FOLDER (ews_folder), ci);
 	}
 	camel_folder_change_info_free (ci);
 	g_slist_free (items_updated);
@@ -903,7 +930,7 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 		return;
 
 	ci = camel_folder_change_info_new ();
-	folder = (CamelFolder *) ews_folder;
+	folder = CAMEL_FOLDER (ews_folder);
 
 	for (l = items_created; l != NULL; l = g_slist_next (l)) {
 		EEwsItem *item = (EEwsItem *) l->data;
@@ -924,18 +951,23 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 		}
 
 		id = e_ews_item_get_id (item);
-		mi = (CamelEwsMessageInfo *) camel_folder_summary_get (folder->summary, id->id);
+		mi = (CamelEwsMessageInfo *)
+			camel_folder_summary_get (folder->summary, id->id);
 		if (mi) {
 			camel_message_info_free (mi);
 			g_object_unref (item);
 			continue;
 		}
 
-		mi = (CamelEwsMessageInfo *) camel_message_info_new (folder->summary);
+		mi = (CamelEwsMessageInfo *)
+			camel_message_info_new (folder->summary);
 
 		if (mi->info.content == NULL) {
-			mi->info.content = camel_folder_summary_content_info_new (folder->summary);
-			mi->info.content->type = camel_content_type_new ("multipart", "mixed");
+			mi->info.content =
+				camel_folder_summary_content_info_new (
+				folder->summary);
+			mi->info.content->type =
+				camel_content_type_new ("multipart", "mixed");
 		}
 
 		item_type = e_ews_item_get_item_type (item);
@@ -944,11 +976,13 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 			 item_type == E_EWS_ITEM_TYPE_MEETING_REQUEST ||
 			 item_type == E_EWS_ITEM_TYPE_MEETING_RESPONSE ||
 			 item_type == E_EWS_ITEM_TYPE_MEETING_RESPONSE)
-			camel_message_info_set_user_flag ((CamelMessageInfo *) mi, "$has_cal", TRUE);
+			camel_message_info_set_user_flag (
+				(CamelMessageInfo *) mi, "$has_cal", TRUE);
 
 		mi->info.uid = camel_pstring_strdup (id->id);
 		mi->info.size = e_ews_item_get_size (item);
-		mi->info.subject = camel_pstring_strdup (e_ews_item_get_subject (item));
+		mi->info.subject = camel_pstring_strdup (
+			e_ews_item_get_subject (item));
 		mi->item_type = item_type;
 		mi->change_key = g_strdup (id->change_key);
 
@@ -977,7 +1011,8 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 		mi->info.flags |= server_flags;
 		mi->server_flags = server_flags;
 
-		camel_folder_summary_add (folder->summary, (CamelMessageInfo *) mi);
+		camel_folder_summary_add (
+			folder->summary, (CamelMessageInfo *) mi);
 
 		/* camel_folder_summary_add() sets folder_flagged flag
 		 * on the message info, but this is a fresh item downloaded
@@ -995,7 +1030,7 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 	if (camel_folder_change_info_changed (ci)) {
 		camel_folder_summary_touch (folder->summary);
 		camel_folder_summary_save_to_db (folder->summary, NULL);
-		camel_folder_changed ((CamelFolder *) ews_folder, ci);
+		camel_folder_changed (CAMEL_FOLDER (ews_folder), ci);
 	}
 	camel_folder_change_info_free (ci);
 	g_slist_free (items_created);
diff --git a/src/camel/camel-ews-utils.h b/src/camel/camel-ews-utils.h
index 5ee80c3..09f2532 100644
--- a/src/camel/camel-ews-utils.h
+++ b/src/camel/camel-ews-utils.h
@@ -58,41 +58,55 @@ typedef struct {
 } flags_diff_t;
 
 /* FIXME: deprecated
- * This is used exclusively for the legacy imap cache code.  DO NOT use this in any new code */
-
-typedef gboolean (*EPathFindFoldersCallback) (const gchar *physical_path,
-					      const gchar *path,
-					      gpointer user_data);
-
-gchar *   e_path_to_physical  (const gchar *prefix, const gchar *vpath);
-
-gboolean e_path_find_folders (const gchar *prefix,
-			      EPathFindFoldersCallback callback,
-			      gpointer data);
-
-gint      e_path_rmdir        (const gchar *prefix, const gchar *vpath);
-
-void do_flags_diff (flags_diff_t *diff, guint32 old, guint32 _new);
-gchar *ews_concat ( const gchar *prefix, const gchar *suffix);
-void strip_lt_gt (gchar **string, gint s_offset, gint e_offset);
-
-void	ews_utils_sync_folders	(CamelEwsStore *ews_store,
-				 GSList *created_folders,
-				 GSList *deleted_folders,
-				 GSList *updated_folders);
+ * This is used exclusively for the legacy imap cache code.
+ * DO NOT use this in any new code. */
+
+typedef gboolean
+		(*EPathFindFoldersCallback)	(const gchar *physical_path,
+						 const gchar *path,
+						 gpointer user_data);
+
+gchar *		e_path_to_physical		(const gchar *prefix,
+						 const gchar *vpath);
+
+gboolean	e_path_find_folders		(const gchar *prefix,
+						 EPathFindFoldersCallback callback,
+						 gpointer data);
+
+gint		e_path_rmdir			(const gchar *prefix,
+						 const gchar *vpath);
+
+void		do_flags_diff			(flags_diff_t *diff,
+						 guint32 old,
+						 guint32 _new);
+gchar *		ews_concat			(const gchar *prefix,
+						 const gchar *suffix);
+void		strip_lt_gt			(gchar **string,
+						 gint s_offset,
+						 gint e_offset);
+
+void		ews_utils_sync_folders		(CamelEwsStore *ews_store,
+						 GSList *created_folders,
+						 GSList *deleted_folders,
+						 GSList *updated_folders);
 
 CamelFolderInfo *
-	camel_ews_utils_build_folder_info	(CamelEwsStore *store,
+		camel_ews_utils_build_folder_info
+						(CamelEwsStore *store,
 						 const gchar *fid);
 
-void	camel_ews_utils_sync_deleted_items	(CamelEwsFolder *ews_folder,
+void		camel_ews_utils_sync_deleted_items
+						(CamelEwsFolder *ews_folder,
 						 GSList *items_deleted);
-void	camel_ews_utils_sync_created_items	(CamelEwsFolder *ews_folder,
+void		camel_ews_utils_sync_created_items
+						(CamelEwsFolder *ews_folder,
 						 EEwsConnection *cnc,
 						 GSList *items_created);
-void	camel_ews_utils_sync_updated_items	(CamelEwsFolder *ews_folder,
+void		camel_ews_utils_sync_updated_items
+						(CamelEwsFolder *ews_folder,
 						 GSList *items_updated);
-void	ews_utils_replace_server_user_flags	(ESoapMessage *msg,
+void		ews_utils_replace_server_user_flags
+						(ESoapMessage *msg,
 						 CamelEwsMessageInfo *mi);
 
 G_END_DECLS
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index 11704ee..89facbe 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -459,18 +459,24 @@ add_remote_sources (EEwsBackend *backend)
 {
 	GList *old_sources, *iter;
 	ESourceRegistryServer *registry;
+	const gchar *extension_name;
+
+	registry = e_collection_backend_ref_server (
+		E_COLLECTION_BACKEND (backend));
+	old_sources = e_collection_backend_claim_all_resources (
+		E_COLLECTION_BACKEND (backend));
+
+	extension_name = E_SOURCE_EXTENSION_EWS_FOLDER;
 
-	registry = e_collection_backend_ref_server (E_COLLECTION_BACKEND (backend));
-	old_sources = e_collection_backend_claim_all_resources (E_COLLECTION_BACKEND (backend));
 	for (iter = old_sources; iter; iter = iter->next) {
 		ESource *source = iter->data;
 		ESourceEwsFolder *extension;
 
-		if (!e_source_has_extension (source, E_SOURCE_EXTENSION_EWS_FOLDER))
+		if (!e_source_has_extension (source, extension_name))
 			continue;
 
 		/* foreign folders are just added */
-		extension = e_source_get_extension (source, E_SOURCE_EXTENSION_EWS_FOLDER);
+		extension = e_source_get_extension (source, extension_name);
 		if (e_source_ews_folder_get_foreign (extension)) {
 			e_server_side_source_set_writable (
 				E_SERVER_SIDE_SOURCE (source), TRUE);
@@ -479,6 +485,7 @@ add_remote_sources (EEwsBackend *backend)
 			e_source_registry_server_add_source (registry, source);
 		}
 	}
+
 	g_list_free_full (old_sources, g_object_unref);
 	g_object_unref (registry);
 }
@@ -835,7 +842,7 @@ ews_backend_delete_resource_sync (ECollectionBackend *backend,
 
 	if (e_source_ews_folder_get_foreign (extension)) {
 		/* do not delete foreign folders,
-		   just remove them from local store */
+		 * just remove them from local store */
 		success = TRUE;
 	} else {
 		gchar *folder_id;
diff --git a/src/configuration/e-ews-config-utils.c b/src/configuration/e-ews-config-utils.c
index 17bead9..8675193 100644
--- a/src/configuration/e-ews-config-utils.c
+++ b/src/configuration/e-ews-config-utils.c
@@ -678,7 +678,8 @@ ews_ui_init_mail (GtkUIManager *ui_manager,
 	action_group = e_shell_window_get_action_group (shell_window, "mail");
 
 	/* Add actions to the "mail" action group. */
-	e_action_group_add_actions_localized (action_group, GETTEXT_PACKAGE,
+	e_action_group_add_actions_localized (
+		action_group, GETTEXT_PACKAGE,
 		mail_account_context_entries, G_N_ELEMENTS (mail_account_context_entries), shell_view);
 	e_action_group_add_actions_localized (
 		action_group, GETTEXT_PACKAGE,
diff --git a/src/configuration/e-ews-subscribe-foreign-folder.c b/src/configuration/e-ews-subscribe-foreign-folder.c
index ab2bdda..5523270 100644
--- a/src/configuration/e-ews-subscribe-foreign-folder.c
+++ b/src/configuration/e-ews-subscribe-foreign-folder.c
@@ -47,7 +47,7 @@
 
 static void
 announce_new_folder (CamelEwsStore *ews_store,
-		     const gchar *fid)
+                     const gchar *fid)
 {
 	CamelFolderInfo *fi;
 
@@ -63,11 +63,11 @@ announce_new_folder (CamelEwsStore *ews_store,
 
 static gboolean
 add_foreign_folder_to_camel (CamelEwsStore *ews_store,
-			     const gchar *foreign_email,
-			     EEwsFolder *folder,
-			     const gchar *display_username,
-			     const gchar *display_foldername,
-			     GError **perror)
+                             const gchar *foreign_email,
+                             EEwsFolder *folder,
+                             const gchar *display_username,
+                             const gchar *display_foldername,
+                             GError **perror)
 {
 	gchar *foreign_mailbox_id;
 	gchar *mailbox, *fullname;
@@ -90,7 +90,8 @@ add_foreign_folder_to_camel (CamelEwsStore *ews_store,
 	if (camel_ews_store_summary_has_folder (ews_store->summary, fid->id)) {
 		gchar *full_name = camel_ews_store_summary_get_folder_full_name (ews_store->summary, fid->id, NULL);
 
-		g_propagate_error (perror,
+		g_propagate_error (
+			perror,
 			g_error_new (EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_FOLDEREXISTS,
 			_("Cannot add folder, folder already exists as '%s'"), full_name));
 
@@ -100,13 +101,14 @@ add_foreign_folder_to_camel (CamelEwsStore *ews_store,
 	}
 
 	/* Translators: The '%s' is replaced with user name, to whom the foreign mailbox belongs.
-	   Example result: "Mailbox - John Smith"
+	 * Example result: "Mailbox - John Smith"
 	*/
 	mailbox = g_strdup_printf (C_("ForeignFolder", "Mailbox - %s"), display_username);
 
 	foreign_mailbox_id = g_strdup_printf ("ForeignMailbox::%s", foreign_email);
 	if (!camel_ews_store_summary_has_folder (ews_store->summary, foreign_mailbox_id)) {
-		camel_ews_store_summary_new_folder (ews_store->summary,
+		camel_ews_store_summary_new_folder (
+			ews_store->summary,
 			foreign_mailbox_id, EWS_FOREIGN_FOLDER_ROOT_ID, NULL,
 			mailbox, E_EWS_FOLDER_TYPE_MAILBOX,
 			CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_NOSELECT,
@@ -114,7 +116,8 @@ add_foreign_folder_to_camel (CamelEwsStore *ews_store,
 	}
 
 	if (camel_ews_store_summary_has_folder (ews_store->summary, parent_fid->id)) {
-		camel_ews_store_summary_new_folder (ews_store->summary,
+		camel_ews_store_summary_new_folder (
+			ews_store->summary,
 			fid->id, parent_fid->id, fid->change_key,
 			display_foldername, E_EWS_FOLDER_TYPE_MAILBOX,
 			CAMEL_FOLDER_SUBSCRIBED, e_ews_folder_get_total_count (folder), TRUE);
@@ -129,7 +132,8 @@ add_foreign_folder_to_camel (CamelEwsStore *ews_store,
 		displayname = strrchr (fullname, '/');
 		displayname++;
 
-		camel_ews_store_summary_new_folder (ews_store->summary,
+		camel_ews_store_summary_new_folder (
+			ews_store->summary,
 			fid->id, foreign_mailbox_id, fid->change_key,
 			displayname, E_EWS_FOLDER_TYPE_MAILBOX,
 			CAMEL_FOLDER_SUBSCRIBED, e_ews_folder_get_total_count (folder), TRUE);
@@ -168,7 +172,8 @@ enable_ok_button_by_data (GObject *dialog)
 	entry_text = gtk_entry_get_text (entry);
 	combo_text = gtk_combo_box_text_get_active_text (combo);
 
-	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK,
+	gtk_dialog_set_response_sensitive (
+		GTK_DIALOG (dialog), GTK_RESPONSE_OK,
 		entry_text && *entry_text && *entry_text != ' ' && *entry_text != ',' &&
 		combo_text && *combo_text);
 
@@ -222,7 +227,7 @@ e_ews_check_foreign_folder_data_free (gpointer ptr)
 	g_free (cffd->use_foldername);
 
 	/* folder tells whether successfully finished,
-	   then the dialog can be destroyed */
+	 * then the dialog can be destroyed */
 	if (cffd->folder && cffd->dialog)
 		gtk_widget_destroy (cffd->dialog);
 
@@ -234,9 +239,9 @@ e_ews_check_foreign_folder_data_free (gpointer ptr)
 
 static void
 check_foreign_folder_thread (GObject *with_object,
-			     gpointer user_data,
-			     GCancellable *cancellable,
-			     GError **perror)
+                             gpointer user_data,
+                             GCancellable *cancellable,
+                             GError **perror)
 {
 	struct EEwsCheckForeignFolderData *cffd = user_data;
 	GError *local_error = NULL;
@@ -337,7 +342,8 @@ check_foreign_folder_thread (GObject *with_object,
 		if (g_error_matches (local_error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_ITEMNOTFOUND) ||
 		    g_error_matches (local_error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_FOLDERNOTFOUND)) {
 			g_clear_error (&local_error);
-			local_error = g_error_new (EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_FOLDERNOTFOUND,
+			local_error = g_error_new (
+				EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_FOLDERNOTFOUND,
 				_("Folder '%s' not found. Either it does not exist or you do not have permission to access it."),
 				cffd->orig_foldername);
 		}
@@ -354,7 +360,8 @@ check_foreign_folder_thread (GObject *with_object,
 	}
 
 	if (e_ews_folder_get_folder_type (folder) == E_EWS_FOLDER_TYPE_UNKNOWN) {
-		g_propagate_error (perror, g_error_new_literal (EWS_CONNECTION_ERROR,
+		g_propagate_error (
+			perror, g_error_new_literal (EWS_CONNECTION_ERROR,
 			EWS_CONNECTION_ERROR_FOLDERNOTFOUND, _("Cannot add folder, cannot determine folder's type")));
 		g_object_unref (folder);
 		g_object_unref (conn);
@@ -369,9 +376,9 @@ check_foreign_folder_thread (GObject *with_object,
 
 static void
 check_foreign_folder_idle (GObject *with_object,
-			   gpointer user_data,
-			   GCancellable *cancellable,
-			   GError **perror)
+                           gpointer user_data,
+                           GCancellable *cancellable,
+                           GError **perror)
 {
 	struct EEwsCheckForeignFolderData *cffd = user_data;
 	gchar *folder_name;
@@ -396,9 +403,9 @@ check_foreign_folder_idle (GObject *with_object,
 	base_foldername = e_ews_folder_get_name (cffd->folder) ? e_ews_folder_get_name (cffd->folder) : cffd->orig_foldername;
 
 	/* Translators: This is used to name foreign folder.
-	   The first '%s' is replaced with user name to whom the folder belongs,
-	   the second '%s' is replaced with folder name.
-	   Example result: "John Smith - Calendar"
+	 * The first '%s' is replaced with user name to whom the folder belongs,
+	 * the second '%s' is replaced with folder name.
+	 * Example result: "John Smith - Calendar"
 	*/
 	folder_name = g_strdup_printf (C_("ForeignFolder", "%s - %s"), base_username, base_foldername);
 	if (folder_type != E_EWS_FOLDER_TYPE_MAILBOX)
@@ -438,7 +445,7 @@ check_foreign_folder_idle (GObject *with_object,
 
 static void
 subscribe_foreign_response_cb (GObject *dialog,
-			       gint response_id)
+                               gint response_id)
 {
 	struct EEwsCheckForeignFolderData *cffd;
 	ENameSelectorEntry *entry;
@@ -513,7 +520,8 @@ subscribe_foreign_response_cb (GObject *dialog,
 	cffd->use_foldername = use_foldername;
 	cffd->folder = NULL;
 
-	description = g_strdup_printf (_("Testing availability of folder '%s' of user '%s', please wait..."),
+	description = g_strdup_printf (
+		_("Testing availability of folder '%s' of user '%s', please wait..."),
 		show_foldername ? show_foldername : cffd->orig_foldername, cffd->email);
 
 	e_ews_config_utils_run_in_thread_with_feedback (
@@ -531,7 +539,7 @@ subscribe_foreign_response_cb (GObject *dialog,
 
 static void
 pick_gal_user_clicked_cb (GtkButton *button,
-			  GObject *dialog)
+                          GObject *dialog)
 {
 	GtkEntry *entry;
 	CamelEwsStore *ews_store;
@@ -567,11 +575,11 @@ pick_gal_user_clicked_cb (GtkButton *button,
 }
 
 /* Opens dialog to subscribe to folders of other
-   users in the given store */
+ * users in the given store */
 void
 e_ews_subscribe_foreign_folder (GtkWindow *parent,
-				CamelSession *session,
-				CamelStore *store)
+                                CamelSession *session,
+                                CamelStore *store)
 {
 	PangoAttrList *attrs;
 	ENameSelector *name_selector;
@@ -611,7 +619,8 @@ e_ews_subscribe_foreign_folder (GtkWindow *parent,
 	row = 0;
 
 	label = gtk_label_new (_("Account:"));
-	g_object_set (G_OBJECT (label),
+	g_object_set (
+		G_OBJECT (label),
 		"hexpand", FALSE,
 		"vexpand", FALSE,
 		"xalign", 0.0,
@@ -621,7 +630,8 @@ e_ews_subscribe_foreign_folder (GtkWindow *parent,
 	attrs = pango_attr_list_new ();
 	pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
 	widget = gtk_label_new (camel_service_get_display_name (CAMEL_SERVICE (store)));
-	g_object_set (G_OBJECT (widget),
+	g_object_set (
+		G_OBJECT (widget),
 		"hexpand", TRUE,
 		"vexpand", FALSE,
 		"use-underline", FALSE,
@@ -646,20 +656,23 @@ e_ews_subscribe_foreign_folder (GtkWindow *parent,
 	g_object_set_data_full (dialog, "e-ews-name-selector", name_selector, g_object_unref);
 
 	label = gtk_label_new_with_mnemonic (_("_User:"));
-	g_object_set (G_OBJECT (label),
+	g_object_set (
+		G_OBJECT (label),
 		"hexpand", FALSE,
 		"vexpand", FALSE,
 		"xalign", 0.0,
 		NULL);
 
 	entry = GTK_WIDGET (e_name_selector_peek_section_entry (name_selector, "User"));
-	g_object_set (G_OBJECT (entry),
+	g_object_set (
+		G_OBJECT (entry),
 		"hexpand", TRUE,
 		"vexpand", FALSE,
 		NULL);
 
 	widget = gtk_button_new_with_mnemonic (_("C_hoose..."));
-	g_object_set (G_OBJECT (entry),
+	g_object_set (
+		G_OBJECT (entry),
 		"hexpand", TRUE,
 		"vexpand", FALSE,
 		NULL);
@@ -674,13 +687,15 @@ e_ews_subscribe_foreign_folder (GtkWindow *parent,
 	row++;
 
 	label = gtk_label_new_with_mnemonic (_("_Folder name:"));
-	g_object_set (G_OBJECT (label),
+	g_object_set (
+		G_OBJECT (label),
 		"hexpand", FALSE,
 		"vexpand", FALSE,
 		"xalign", 0.0,
 		NULL);
 
-	widget = GTK_WIDGET (g_object_new (gtk_combo_box_text_get_type (),
+	widget = GTK_WIDGET (
+		g_object_new (gtk_combo_box_text_get_type (),
 		"has-entry", TRUE,
 		"entry-text-column", 0,
 		"hexpand", TRUE,
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index a3c5739..4924a96 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1964,10 +1964,10 @@ exit:
 	g_simple_async_result_complete_in_idle (simple);
 
 	/* This function is processed within e_ews_soup_thread() and the 'simple'
-	   holds reference to EEwsConnection. For cases when this is the last
-	   reference to 'simple' the unref would cause crash, because of g_thread_join()
-	   in connection's dispose, trying to wait on the end of itself, thus it's
-	   safer to unref the 'simple' in a dedicated thread.
+	 * holds reference to EEwsConnection. For cases when this is the last
+	 * reference to 'simple' the unref would cause crash, because of g_thread_join()
+	 * in connection's dispose, trying to wait on the end of itself, thus it's
+	 * safer to unref the 'simple' in a dedicated thread.
 	*/
 	ews_unref_in_thread (simple);
 }
@@ -7192,7 +7192,7 @@ e_ews_connection_set_folder_permissions_sync (EEwsConnection *cnc,
 
 static void
 get_password_expiration_response_cb (ESoapResponse *response,
-				     GSimpleAsyncResult *simple)
+                                     GSimpleAsyncResult *simple)
 {
 	EwsAsyncData *async_data;
 	ESoapParameter *param;
@@ -7230,11 +7230,11 @@ get_password_expiration_response_cb (ESoapResponse *response,
  **/
 void
 e_ews_connection_get_password_expiration (EEwsConnection *cnc,
-					  gint pri,
-					  const gchar *mail_id,
-					  GCancellable *cancellable,
-					  GAsyncReadyCallback callback,
-					  gpointer user_data)
+                                          gint pri,
+                                          const gchar *mail_id,
+                                          GCancellable *cancellable,
+                                          GAsyncReadyCallback callback,
+                                          gpointer user_data)
 {
 	ESoapMessage *msg;
 	GSimpleAsyncResult *simple;
@@ -7261,9 +7261,9 @@ e_ews_connection_get_password_expiration (EEwsConnection *cnc,
 
 gboolean
 e_ews_connection_get_password_expiration_finish (EEwsConnection *cnc,
-						 GAsyncResult *result,
-						 gchar **exp_date,
-						 GError **error)
+                                                 GAsyncResult *result,
+                                                 gchar **exp_date,
+                                                 GError **error)
 {
 	GSimpleAsyncResult *simple;
 	EwsAsyncData *async_data;
@@ -7298,11 +7298,11 @@ e_ews_connection_get_password_expiration_finish (EEwsConnection *cnc,
  **/
 gboolean
 e_ews_connection_get_password_expiration_sync (EEwsConnection *cnc,
-					       gint pri,
-					       const gchar *mail_id,
-					       gchar **exp_date,
-					       GCancellable *cancellable,
-					       GError **error)
+                                               gint pri,
+                                               const gchar *mail_id,
+                                               gchar **exp_date,
+                                               GCancellable *cancellable,
+                                               GError **error)
 {
 	EAsyncClosure *closure;
 	GAsyncResult *result;
@@ -7329,7 +7329,7 @@ e_ews_connection_get_password_expiration_sync (EEwsConnection *cnc,
 
 static void
 get_folder_info_response_cb (ESoapResponse *response,
-			     GSimpleAsyncResult *simple)
+                             GSimpleAsyncResult *simple)
 {
 	EwsAsyncData *async_data;
 	ESoapParameter *param;
@@ -7381,12 +7381,12 @@ get_folder_info_response_cb (ESoapResponse *response,
 
 void
 e_ews_connection_get_folder_info (EEwsConnection *cnc,
-				  gint pri,
-				  const gchar *mail_id,
-				  const EwsFolderId *folder_id,
-				  GCancellable *cancellable,
-				  GAsyncReadyCallback callback,
-				  gpointer user_data)
+                                  gint pri,
+                                  const gchar *mail_id,
+                                  const EwsFolderId *folder_id,
+                                  GCancellable *cancellable,
+                                  GAsyncReadyCallback callback,
+                                  gpointer user_data)
 {
 	ESoapMessage *msg;
 	GSimpleAsyncResult *simple;
@@ -7431,9 +7431,9 @@ e_ews_connection_get_folder_info (EEwsConnection *cnc,
 
 gboolean
 e_ews_connection_get_folder_info_finish (EEwsConnection *cnc,
-					 GAsyncResult *result,
-					 EEwsFolder **folder,
-					 GError **error)
+                                         GAsyncResult *result,
+                                         EEwsFolder **folder,
+                                         GError **error)
 {
 	GSimpleAsyncResult *simple;
 	EwsAsyncData *async_data;
@@ -7464,12 +7464,12 @@ e_ews_connection_get_folder_info_finish (EEwsConnection *cnc,
 
 gboolean
 e_ews_connection_get_folder_info_sync (EEwsConnection *cnc,
-				       gint pri,
-				       const gchar *mail_id,
-				       const EwsFolderId *folder_id,
-				       EEwsFolder **folder,
-				       GCancellable *cancellable,
-				       GError **error)
+                                       gint pri,
+                                       const gchar *mail_id,
+                                       const EwsFolderId *folder_id,
+                                       EEwsFolder **folder,
+                                       GCancellable *cancellable,
+                                       GError **error)
 {
 	EAsyncClosure *closure;
 	GAsyncResult *result;
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 923bd30..646de20 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -33,16 +33,29 @@
 #include "e-ews-item.h"
 #include "camel-ews-settings.h"
 
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_EWS_CONNECTION \
+	(e_ews_connection_get_type ())
+#define E_EWS_CONNECTION(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_EWS_CONNECTION, EEwsConnection))
+#define E_EWS_CONNECTION_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_EWS_CONNECTION, EEwsConnectionClass))
+#define E_IS_EWS_CONNECTION(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_EWS_CONNECTION))
+#define E_IS_EWS_CONNECTION_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_EWS_CONNECTION))
+#define E_EWS_CONNECTION_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_EWS_CONNECTION, EEwsConnectionClass))
 
-#define E_TYPE_EWS_CONNECTION            (e_ews_connection_get_type ())
-#define E_EWS_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_EWS_CONNECTION, EEwsConnection))
-#define E_EWS_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_EWS_CONNECTION, EEwsConnectionClass))
-#define E_IS_EWS_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_EWS_CONNECTION))
-#define E_IS_EWS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_EWS_CONNECTION))
+G_BEGIN_DECLS
 
-typedef struct _EEwsConnection        EEwsConnection;
-typedef struct _EEwsConnectionClass   EEwsConnectionClass;
+typedef struct _EEwsConnection EEwsConnection;
+typedef struct _EEwsConnectionClass EEwsConnectionClass;
 typedef struct _EEwsConnectionPrivate EEwsConnectionPrivate;
 
 struct _EEwsConnection {
diff --git a/src/server/e-ews-folder.c b/src/server/e-ews-folder.c
index 77440d3..80d2e0c 100644
--- a/src/server/e-ews-folder.c
+++ b/src/server/e-ews-folder.c
@@ -399,7 +399,7 @@ e_ews_folder_get_foreign (EEwsFolder *folder)
 
 void
 e_ews_folder_set_foreign (EEwsFolder *folder,
-			  gboolean is_foreign)
+                          gboolean is_foreign)
 {
 	g_return_if_fail (E_IS_EWS_FOLDER (folder));
 
@@ -408,7 +408,7 @@ e_ews_folder_set_foreign (EEwsFolder *folder,
 
 gchar *
 e_ews_folder_utils_pick_color_spec (gint move_by,
-				    gboolean around_middle)
+                                    gboolean around_middle)
 {
 	static gint color_mover = 0;
 	static gint color_indexer = -1;
@@ -462,14 +462,14 @@ e_ews_folder_utils_pick_color_spec (gint move_by,
 
 gboolean
 e_ews_folder_utils_populate_esource (ESource *source,
-				     const GList *sources,
-				     const gchar *master_hosturl,
-				     const gchar *master_username,
-				     EEwsFolder *folder,
-				     gboolean offline_sync,
-				     gint color_seed,
-				     GCancellable *cancellable,
-				     GError **perror)
+                                     const GList *sources,
+                                     const gchar *master_hosturl,
+                                     const gchar *master_username,
+                                     EEwsFolder *folder,
+                                     gboolean offline_sync,
+                                     gint color_seed,
+                                     GCancellable *cancellable,
+                                     GError **perror)
 {
 	ESource *master_source;
 	gboolean res = FALSE;
@@ -525,7 +525,8 @@ e_ews_folder_utils_populate_esource (ESource *source,
 			if (folder_type != E_EWS_FOLDER_TYPE_CONTACTS) {
 				gchar *color_str;
 
-				color_str = e_ews_folder_utils_pick_color_spec (1 + g_list_length ((GList *) sources),
+				color_str = e_ews_folder_utils_pick_color_spec (
+					1 + g_list_length ((GList *) sources),
 					folder_type != E_EWS_FOLDER_TYPE_CALENDAR);
 				e_source_selectable_set_color (E_SOURCE_SELECTABLE (backend_ext), color_str);
 				g_free (color_str);
@@ -533,11 +534,13 @@ e_ews_folder_utils_populate_esource (ESource *source,
 
 			res = TRUE;
 		} else {
-			g_propagate_error (perror, g_error_new_literal (EWS_CONNECTION_ERROR,
+			g_propagate_error (
+				perror, g_error_new_literal (EWS_CONNECTION_ERROR,
 				EWS_CONNECTION_ERROR_NORESPONSE, _("Cannot add folder, unsupported folder type")));
 		}
 	} else {
-		g_propagate_error (perror, g_error_new_literal (EWS_CONNECTION_ERROR,
+		g_propagate_error (
+			perror, g_error_new_literal (EWS_CONNECTION_ERROR,
 			EWS_CONNECTION_ERROR_NORESPONSE, _("Cannot add folder, master source not found")));
 	}
 
@@ -546,13 +549,13 @@ e_ews_folder_utils_populate_esource (ESource *source,
 
 gboolean
 e_ews_folder_utils_add_as_esource (ESourceRegistry *pregistry,
-				   const gchar *master_hosturl,
-				   const gchar *master_username,
-				   EEwsFolder *folder,
-				   gboolean offline_sync,
-				   gint color_seed,
-				   GCancellable *cancellable,
-				   GError **perror)
+                                   const gchar *master_hosturl,
+                                   const gchar *master_username,
+                                   EEwsFolder *folder,
+                                   gboolean offline_sync,
+                                   gint color_seed,
+                                   GCancellable *cancellable,
+                                   GError **perror)
 {
 	ESourceRegistry *registry;
 	GList *sources;
@@ -575,7 +578,8 @@ e_ews_folder_utils_add_as_esource (ESourceRegistry *pregistry,
 	if (old_source) {
 		res = FALSE;
 
-		g_propagate_error (perror,
+		g_propagate_error (
+			perror,
 			g_error_new (EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_FOLDEREXISTS,
 			_("Cannot add folder, folder already exists as '%s'"), e_source_get_display_name (old_source)));
 	} else if (e_ews_folder_utils_populate_esource (
@@ -601,11 +605,11 @@ e_ews_folder_utils_add_as_esource (ESourceRegistry *pregistry,
 
 gboolean
 e_ews_folder_utils_remove_as_esource (ESourceRegistry *pregistry,
-				      const gchar *master_hosturl,
-				      const gchar *master_username,
-				      const gchar *folder_id,
-				      GCancellable *cancellable,
-				      GError **perror)
+                                      const gchar *master_hosturl,
+                                      const gchar *master_username,
+                                      const gchar *folder_id,
+                                      GCancellable *cancellable,
+                                      GError **perror)
 {
 	ESourceRegistry *registry;
 	ESource *source;
@@ -634,17 +638,17 @@ e_ews_folder_utils_remove_as_esource (ESourceRegistry *pregistry,
 
 gboolean
 e_ews_folder_utils_is_subscribed_as_esource (const GList *esources,
-					     const gchar *master_hosturl,
-					     const gchar *master_username,
-					     const gchar *folder_id)
+                                             const gchar *master_hosturl,
+                                             const gchar *master_username,
+                                             const gchar *folder_id)
 {
 	return e_ews_folder_utils_get_source_for_folder (esources, master_hosturl, master_username, folder_id) != NULL;
 }
 
 static gboolean
 is_for_account (ESource *source,
-		const gchar *master_hosturl,
-		const gchar *master_username)
+                const gchar *master_hosturl,
+                const gchar *master_username)
 {
 	ESourceCamel *camel_extension;
 	ESourceAuthentication *auth_extension;
@@ -676,11 +680,11 @@ is_for_account (ESource *source,
 }
 
 /* filters @esources thus the resulting list will contain ESource-s only for @profile;
-   free returned list with g_list_free_full (list, g_object_unref); */
+ * free returned list with g_list_free_full (list, g_object_unref); */
 GList *
 e_ews_folder_utils_filter_sources_for_account (const GList *esources,
-					       const gchar *master_hosturl,
-					       const gchar *master_username)
+                                               const gchar *master_hosturl,
+                                               const gchar *master_username)
 {
 	GList *found = NULL;
 	const GList *iter;
@@ -704,13 +708,13 @@ e_ews_folder_utils_filter_sources_for_account (const GList *esources,
 /* returns (not-reffed) member of @esources, which is for @profile and @folder_id */
 ESource *
 e_ews_folder_utils_get_source_for_folder (const GList *esources,
-					  const gchar *master_hosturl,
-					  const gchar *master_username,
-					  const gchar *folder_id)
+                                          const gchar *master_hosturl,
+                                          const gchar *master_username,
+                                          const gchar *folder_id)
 {
 	ESource *master_source;
 	const GList *iter;
-	
+
 	master_source = e_ews_folder_utils_get_master_source (esources, master_hosturl, master_username);
 	if (!master_source)
 		return NULL;
@@ -736,8 +740,8 @@ e_ews_folder_utils_get_source_for_folder (const GList *esources,
 /* returns (not-reffed) member of @esources, which is master (with no parent) source for @profile */
 ESource *
 e_ews_folder_utils_get_master_source (const GList *esources,
-				      const gchar *master_hosturl,
-				      const gchar *master_username)
+                                      const gchar *master_hosturl,
+                                      const gchar *master_username)
 {
 	const GList *iter;
 
diff --git a/src/server/e-ews-item-change.c b/src/server/e-ews-item-change.c
index 58e8f35..6a75652 100644
--- a/src/server/e-ews-item-change.c
+++ b/src/server/e-ews-item-change.c
@@ -105,7 +105,8 @@ e_ews_message_start_set_item_field (ESoapMessage *msg,
 	fielduri = g_strconcat (fielduri_prefix, ":", name, NULL);
 
 	e_soap_message_start_element (msg, "SetItemField", NULL, NULL);
-	e_ews_message_write_string_parameter_with_attribute (msg, "FieldURI", NULL, NULL, "FieldURI", fielduri);
+	e_ews_message_write_string_parameter_with_attribute (
+		msg, "FieldURI", NULL, NULL, "FieldURI", fielduri);
 	e_soap_message_start_element (msg, field_kind, NULL, NULL);
 
 	g_free (fielduri);
@@ -164,7 +165,8 @@ e_ews_message_add_delete_item_field (ESoapMessage *msg,
 	fielduri = g_strconcat (fielduri_prefix, ":", name, NULL);
 
 	e_soap_message_start_element (msg, "DeleteItemField", NULL, NULL);
-	e_ews_message_write_string_parameter_with_attribute (msg, "FieldURI", NULL, NULL, "FieldURI", fielduri);
+	e_ews_message_write_string_parameter_with_attribute (
+		msg, "FieldURI", NULL, NULL, "FieldURI", fielduri);
 	e_soap_message_end_element (msg); /* DeleteItemField */
 
 	g_free (fielduri);
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index d3e63e1..c2a900a 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -114,11 +114,19 @@ fetch_ns (ESoapMessage *msg,
 	xmlNsPtr ns = NULL;
 
 	if (prefix && ns_uri)
-		ns = xmlNewNs (priv->last_node, (const xmlChar *) ns_uri, (const xmlChar *) prefix);
+		ns = xmlNewNs (
+			priv->last_node,
+			(const xmlChar *) ns_uri,
+			(const xmlChar *) prefix);
 	else if (prefix && !ns_uri) {
-		ns = xmlSearchNs (priv->doc, priv->last_node, (const xmlChar *) prefix);
+		ns = xmlSearchNs (
+			priv->doc, priv->last_node,
+			(const xmlChar *) prefix);
 		if (!ns)
-			ns = xmlNewNs (priv->last_node, (const xmlChar *) "", (const xmlChar *) prefix);
+			ns = xmlNewNs (
+				priv->last_node,
+				(const xmlChar *) "",
+				(const xmlChar *) prefix);
 	}
 
 	return ns;
diff --git a/src/server/e-source-ews-folder.c b/src/server/e-source-ews-folder.c
index eef7306..107c378 100644
--- a/src/server/e-source-ews-folder.c
+++ b/src/server/e-source-ews-folder.c
@@ -300,7 +300,8 @@ e_source_ews_folder_dup_folder_id (ESourceEwsFolder *extension)
 
 	g_mutex_lock (extension->priv->property_lock);
 
-	folder_id = e_ews_folder_id_new (extension->priv->id, extension->priv->change_key, FALSE);
+	folder_id = e_ews_folder_id_new (
+		extension->priv->id, extension->priv->change_key, FALSE);
 
 	g_mutex_unlock (extension->priv->property_lock);
 
@@ -317,7 +318,7 @@ e_source_ews_folder_get_foreign (ESourceEwsFolder *extension)
 
 void
 e_source_ews_folder_set_foreign (ESourceEwsFolder *extension,
-				 gboolean is_foreign)
+                                 gboolean is_foreign)
 {
 	g_return_if_fail (E_IS_SOURCE_EWS_FOLDER (extension));
 
diff --git a/src/server/tests/test-cuditem.c b/src/server/tests/test-cuditem.c
index 92dadbc..3c66d2f 100644
--- a/src/server/tests/test-cuditem.c
+++ b/src/server/tests/test-cuditem.c
@@ -50,7 +50,9 @@ create_item_ready_callback (GObject *object,
 	e_ews_connection_create_items_finish (cnc, res, &ids, &error);
 
 	if (error != NULL) {
-		g_print ("Unable to get item: %s :%d \n", error->message, error->code);
+		g_print (
+			"Unable to get item: %s :%d \n",
+			error->message, error->code);
 		goto quit;
 	}
 
@@ -73,14 +75,20 @@ op_test_create_item_get_soap_msg (ESoapMessage *msg,
 	xmlChar *xmlbuff;
 	gint size;
 
-	//creating XML node for create item
-	e_soap_message_start_element (msg, "CalendarItem", NULL, NULL);
-
-	e_ews_message_write_string_parameter (msg, "Subject", NULL,  "Test Summary");
-	e_ews_message_write_string_parameter_with_attribute (msg, "Body", NULL, "Test Body", "BodyType", "Text");
-	e_ews_message_write_string_parameter (msg, "Start", NULL, "2011-03-01T15:00:00");
-	e_ews_message_write_string_parameter (msg, "End", NULL, "2011-03-01T16:00:00");
-	e_ews_message_write_string_parameter (msg, "Location", NULL,  "Test Location");
+	/* creating XML node for create item */
+	e_soap_message_start_element (
+		msg, "CalendarItem", NULL, NULL);
+
+	e_ews_message_write_string_parameter (
+		msg, "Subject", NULL,  "Test Summary");
+	e_ews_message_write_string_parameter_with_attribute (
+		msg, "Body", NULL, "Test Body", "BodyType", "Text");
+	e_ews_message_write_string_parameter (
+		msg, "Start", NULL, "2011-03-01T15:00:00");
+	e_ews_message_write_string_parameter (
+		msg, "End", NULL, "2011-03-01T16:00:00");
+	e_ews_message_write_string_parameter (
+		msg, "Location", NULL,  "Test Location");
 
 	e_soap_message_end_element (msg);
 
@@ -118,7 +126,7 @@ op_test_create_item ()
 
 	g_object_unref (settings);
 
-	//to check how to change to real data
+	/* to check how to change to real data */
 	folderid = "AQASAG1hbmR5Lnd1QGludGVsLmNvbQAuAAADnUl3sZrICU6Xd1qXV+rpVwEAJvRPgQpR30KhJ7wqBr4YXgAAAY6W+gAAAA==";
 
 	e_ews_connection_create_items (
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index 6ef9da3..8df5bc5 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -59,7 +59,9 @@ folder_items_ready_callback (GObject *object,
 		&items_deleted, &error);
 
 	if (error != NULL) {
-		g_print ("Unable to sync the folder items: %s :%d \n", error->message, error->code);
+		g_print (
+			"Unable to sync the folder items: %s :%d \n",
+			error->message, error->code);
 		return;
 	}
 
@@ -70,7 +72,10 @@ folder_items_ready_callback (GObject *object,
 		EEwsItem *item = l->data;
 		const EwsId *item_id = e_ews_item_get_id (item);
 
-		g_print ("Subject: %s \n Id: %s  \n ChangeKey: %s \n\n", e_ews_item_get_subject (item), item_id->id, item_id->change_key);
+		g_print (
+			"Subject: %s \n Id: %s  \n ChangeKey: %s \n\n",
+			e_ews_item_get_subject (item),
+			item_id->id, item_id->change_key);
 		ids = g_slist_append (ids, g_strdup (item_id->id));
 		g_object_unref (item);
 	}
@@ -137,7 +142,9 @@ folder_hierarchy_ready_callback (GObject *object,
 		&folders_deleted, &error);
 
 	if (error != NULL) {
-		g_print ("Unable to fetch the folder hierarchy: %s :%d \n", error->message, error->code);
+		g_print (
+			"Unable to fetch the folder hierarchy: %s :%d \n",
+			error->message, error->code);
 		return;
 	}
 
@@ -148,7 +155,10 @@ folder_hierarchy_ready_callback (GObject *object,
 		EEwsFolder *folder = l->data;
 		const EwsFolderId *fid = e_ews_folder_get_id (folder);
 
-		g_print ("Name: %s \n Id: %s  \n ChangeKey: %s \n\n", e_ews_folder_get_name (folder), fid->id, fid->change_key);
+		g_print (
+			"Name: %s \n Id: %s  \n ChangeKey: %s \n\n",
+			e_ews_folder_get_name (folder),
+			fid->id, fid->change_key);
 		if (!strcmp (e_ews_folder_get_name (folder), "Contacts")) {
 			folder_id = g_new0 (EwsFolderId, 1);
 			folder_id->id = g_strdup (fid->id);
@@ -211,7 +221,9 @@ get_item_ready_callback (GObject *object,
 	e_ews_connection_get_items_finish (cnc, res, &items, &error);
 
 	if (error != NULL) {
-		g_print ("Unable to get item: %s :%d \n", error->message, error->code);
+		g_print (
+			"Unable to get item: %s :%d \n",
+			error->message, error->code);
 		return;
 	}
 
@@ -221,7 +233,9 @@ get_item_ready_callback (GObject *object,
 		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
 			const GError *error = e_ews_item_get_error (item);
 
-			g_print ("GetItem: Error '%s'\n", error ? error->message : "Unknown error");
+			g_print (
+				"GetItem: Error '%s'\n",
+				error ? error->message : "Unknown error");
 		} else {
 			const EwsId *id = e_ews_item_get_id (item);
 
diff --git a/src/utils/ews-test-finditem-query.c b/src/utils/ews-test-finditem-query.c
index 9a72ab6..2c936c3 100644
--- a/src/utils/ews-test-finditem-query.c
+++ b/src/utils/ews-test-finditem-query.c
@@ -32,8 +32,9 @@
 #include "server/e-ews-item.h"
 #include "utils/e-ews-query-to-restriction.h"
 
-/*Some simple queries are defined here we can replace them to more complex ones;
- * based on these restriction you might not get items at all, to get all items use NULL */
+/* Some simple queries are defined here we can replace them to more
+ * complex ones; based on these restriction you might not get items
+ * at all, to get all items use NULL. */
 #define CONTACTS_QUERY "(contains \"x-evolution-any-field\" \"test\")"
 #define CALENDAR_QUERY "(contains? \"summary\"  \"test\")"
 #define MAIL_QUERY "(match-all (header-contains \"Subject\"  \"test\"))" 
@@ -51,14 +52,18 @@ find_folder_item_callback (GObject *object,
 	GSList *items = NULL, *l = NULL;
 	gboolean include_last;
 
-	e_ews_connection_find_folder_items_finish (cnc, res, &include_last, &items, &error);
+	e_ews_connection_find_folder_items_finish (
+		cnc, res, &include_last, &items, &error);
 
 	if (error != NULL) {
-		g_print ("Unable to find items in %s folder: %s :%d \n", (gchar *) user_data, error->message, error->code);
+		g_print (
+			"Unable to find items in %s folder: %s :%d \n",
+			(gchar *) user_data, error->message, error->code);
 
 		++iter;
 
-		/*Check whether we have got responses of all three folder requests*/
+		/* Check whether we got responses
+		 * of all three folder requests. */
 		if (iter == 3)
 			g_main_loop_quit (main_loop);
 
@@ -79,7 +84,8 @@ find_folder_item_callback (GObject *object,
 
 	++iter;
 
-	/*Check whether we have got responses of all three folder requests*/
+	/* Check whether we got responses
+	 * of all three folder requests. */
 	if (iter == 3)
 		g_main_loop_quit (main_loop);
 }
@@ -122,9 +128,9 @@ op_test_finditem_run (void)
 
 	g_object_unref (settings);
 
-	/*Along with finditem api we check query conversion too*/
+	/* Along with finditem api we check query conversion too */
 
-	/*Check for contact folder*/
+	/* Check for contact folder */
 	folder_name = "contacts";
 	folder_type = E_EWS_FOLDER_TYPE_CONTACTS;
 	fid = g_new0 (EwsFolderId, 1);
@@ -134,11 +140,13 @@ op_test_finditem_run (void)
 	e_ews_connection_find_folder_items (
 		cnc, EWS_PRIORITY_MEDIUM, fid,
 		"IdOnly", NULL, NULL, CONTACTS_QUERY,
-		folder_type, (EwsConvertQueryCallback) (e_ews_query_to_restriction),
-		cancellable, find_folder_item_callback, (gpointer) folder_name);
+		folder_type, (EwsConvertQueryCallback)
+		e_ews_query_to_restriction,
+		cancellable, find_folder_item_callback,
+		(gpointer) folder_name);
 	e_ews_folder_id_free (fid);
 
-	/*Check for calendar folder*/
+	/* Check for calendar folder */
 	folder_name = "calendar";
 	folder_type = E_EWS_FOLDER_TYPE_CALENDAR;
 	fid = g_new0 (EwsFolderId, 1);
@@ -148,11 +156,13 @@ op_test_finditem_run (void)
 	e_ews_connection_find_folder_items (
 		cnc, EWS_PRIORITY_MEDIUM, fid,
 		"IdOnly", NULL, NULL, CALENDAR_QUERY,
-		folder_type, (EwsConvertQueryCallback) (e_ews_query_to_restriction),
-		cancellable, find_folder_item_callback, (gpointer) folder_name);
+		folder_type, (EwsConvertQueryCallback)
+		e_ews_query_to_restriction,
+		cancellable, find_folder_item_callback,
+		(gpointer) folder_name);
 	e_ews_folder_id_free (fid);
 
-	/*Check for mail folder*/
+	/* Check for mail folder */
 	folder_name = "inbox";
 	folder_type = E_EWS_FOLDER_TYPE_MAILBOX;
 	fid = g_new0 (EwsFolderId, 1);
@@ -162,8 +172,10 @@ op_test_finditem_run (void)
 	e_ews_connection_find_folder_items (
 		cnc, EWS_PRIORITY_MEDIUM, fid,
 		"IdOnly", NULL, NULL, MAIL_QUERY,
-		folder_type, (EwsConvertQueryCallback) (e_ews_query_to_restriction),
-		cancellable, find_folder_item_callback, (gpointer) folder_name);
+		folder_type, (EwsConvertQueryCallback)
+		e_ews_query_to_restriction,
+		cancellable, find_folder_item_callback,
+		(gpointer) folder_name);
 	e_ews_folder_id_free (fid);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]