[evolution-ews] Coding style and whitespace cleanup.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Coding style and whitespace cleanup.
- Date: Mon, 20 Feb 2012 15:04:52 +0000 (UTC)
commit 3400488dd38c43bd1118b7d9db4ff6b731e35988
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Feb 18 09:43:59 2012 -0500
Coding style and whitespace cleanup.
.../exchange-ews-account-listener.c | 40 +-
.../exchange-ews-account-out-of-office.c | 51 +-
.../exchange-ews-account-out-of-office.h | 2 +-
.../exchange-ews-account-setup.c | 126 +-
src/addressbook/e-book-backend-ews-utils.c | 5 +-
src/addressbook/e-book-backend-ews-utils.h | 2 +-
src/addressbook/e-book-backend-ews.c | 714 +++++----
src/addressbook/e-book-backend-sqlitedb-test.c | 31 +-
src/addressbook/e-book-backend-sqlitedb.c | 15 +-
src/addressbook/ews-oab-decoder.c | 289 ++--
src/addressbook/ews-oab-decoder.h | 41 +-
src/addressbook/ews-oab-props.h | 2 -
src/addressbook/lzx/ews-oal-decompress.c | 69 +-
src/calendar/e-cal-backend-ews-utils.c | 252 ++--
src/calendar/e-cal-backend-ews-utils.h | 4 +-
src/calendar/e-cal-backend-ews.c | 863 ++++++-----
src/camel/camel-ews-folder.c | 267 ++--
src/camel/camel-ews-folder.h | 2 +-
src/camel/camel-ews-private.h | 10 +-
src/camel/camel-ews-provider.c | 13 +-
src/camel/camel-ews-store-summary.c | 264 ++--
src/camel/camel-ews-store-summary.h | 1 -
src/camel/camel-ews-store.c | 180 ++-
src/camel/camel-ews-summary.c | 102 +-
src/camel/camel-ews-summary.h | 4 +-
src/camel/camel-ews-transport.c | 12 +-
src/camel/camel-ews-utils.c | 119 +-
src/camel/camel-ews-utils.h | 3 +-
src/server/e-ews-connection.c | 1658 ++++++++++----------
src/server/e-ews-connection.h | 33 +-
src/server/e-ews-folder.c | 17 +-
src/server/e-ews-folder.h | 2 +-
src/server/e-ews-item-change.c | 31 +-
src/server/e-ews-item-change.h | 6 +-
src/server/e-ews-item.c | 401 +++---
src/server/e-ews-item.h | 20 +-
src/server/e-ews-message.c | 37 +-
src/server/e-ews-message.h | 2 +-
src/server/e-soap-message.c | 224 ++--
src/server/e-soap-response.c | 49 +-
src/server/ews-errors.c | 4 +-
src/server/tests/test-autocompletion.c | 6 +-
src/server/tests/test-connection.c | 15 +-
src/server/tests/test-createfolder.c | 6 +-
src/server/tests/test-cuditem.c | 22 +-
src/server/tests/test-deletefolder.c | 6 +-
src/server/tests/test-get-oof-settings.c | 6 +-
src/server/tests/test-getattachment.c | 15 +-
src/server/tests/test-getdelegate.c | 17 +-
src/server/tests/test-libews.c | 2 +-
src/server/tests/test-set-oof-settings.c | 14 +-
src/server/tests/test-syncfolder.c | 16 +-
src/server/tests/utils.c | 4 +-
src/utils/e-ews-query-to-restriction.c | 237 ++--
src/utils/e-sqlite3-vfs.c | 25 +-
src/utils/ews-camel-common.c | 32 +-
src/utils/ews-camel-common.h | 1 -
src/utils/ews-esource-utils.c | 56 +-
src/utils/ews-test-finditem-query.c | 12 +-
59 files changed, 3593 insertions(+), 2866 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-ews-account-listener.c b/src/account-setup-eplugin/exchange-ews-account-listener.c
index 6fc3d87..2b5db6b 100644
--- a/src/account-setup-eplugin/exchange-ews-account-listener.c
+++ b/src/account-setup-eplugin/exchange-ews-account-listener.c
@@ -69,7 +69,7 @@ is_ews_account (EAccount *account)
return (account->source->url && (g_ascii_strncasecmp (account->source->url, EWS_URI_PREFIX, EWS_PREFIX_LENGTH) == 0));
}
-static EwsAccountInfo*
+static EwsAccountInfo *
lookup_account_info (const gchar *key)
{
GList *list;
@@ -111,7 +111,8 @@ ews_account_info_free (EwsAccountInfo *info)
}
static void
-ews_account_removed (EAccountList *account_listener, EAccount *account)
+ews_account_removed (EAccountList *account_listener,
+ EAccount *account)
{
EShell *shell;
EShellBackend *shell_backend;
@@ -142,20 +143,21 @@ ews_account_removed (EAccountList *account_listener, EAccount *account)
storage_path = g_strdup (camel_service_get_user_cache_dir (service));
summary_file = g_build_filename (storage_path, "folder-tree", NULL);
g_unlink (summary_file);
-
+
d(g_print ("Removed ews store summary: %s \n", summary_file);)
-
+
g_free (storage_path);
g_free (summary_file);
ews_account_info_free (info);
/* FIXME: This wasn't done for EDS 3.2+? Is that right?
- g_object_unref (service);
+ * g_object_unref (service);
*/
}
static gboolean
-ews_is_str_equal (const gchar *str1, const gchar *str2)
+ews_is_str_equal (const gchar *str1,
+ const gchar *str2)
{
if (str1 && str2 && !strcmp (str1, str2))
return TRUE;
@@ -171,7 +173,7 @@ remove_gal_esource (const gchar *account_name)
ESourceList *source_list;
ESourceGroup *group;
ESource *source;
- GConfClient* client;
+ GConfClient *client;
const gchar *conf_key;
GSList *sources;
gboolean ret = TRUE;
@@ -218,7 +220,7 @@ add_gal_esource (CamelURL *url)
ESourceList *source_list;
ESourceGroup *group;
ESource *source;
- GConfClient* client;
+ GConfClient *client;
const gchar *conf_key, *email_id;
const gchar *oal_sel, *tmp, *oal_name;
gchar *oal_id = NULL;
@@ -241,7 +243,7 @@ add_gal_esource (CamelURL *url)
account_uri = camel_url_to_string (url, CAMEL_URL_HIDE_PARAMS);
source_uri = g_strdup_printf ("%s;gal=1", account_uri + strlen (EWS_BASE_URI));
source = e_source_new (oal_name, source_uri);
-
+
/* set properties */
e_source_set_property (source, "username", url->user);
e_source_set_property (source, "auth-domain", "Exchange Web Services");
@@ -277,7 +279,8 @@ add_gal_esource (CamelURL *url)
}
static void
-ews_account_changed (EAccountList *account_listener, EAccount *account)
+ews_account_changed (EAccountList *account_listener,
+ EAccount *account)
{
gboolean ews_account = FALSE;
EwsAccountInfo *existing_account_info = NULL;
@@ -297,7 +300,7 @@ ews_account_changed (EAccountList *account_listener, EAccount *account)
else {
CamelURL *old_url, *new_url;
const gchar *o_oal_sel, *n_oal_sel;
-
+
/* TODO update props like refresh timeout */
old_url = camel_url_new (existing_account_info->source_url, NULL);
new_url = camel_url_new (account->source->url, NULL);
@@ -307,14 +310,14 @@ ews_account_changed (EAccountList *account_listener, EAccount *account)
if (!ews_is_str_equal (o_oal_sel, n_oal_sel)) {
const gchar *account_name = camel_url_get_param (new_url, "email");
-
+
/* remove gal esource and cache associated with it */
remove_gal_esource (account_name);
-
+
/* add gal esource */
add_gal_esource (new_url);
}
-
+
g_free (existing_account_info->name);
g_free (existing_account_info->source_url);
existing_account_info->name = g_strdup (account->name);
@@ -327,7 +330,8 @@ ews_account_changed (EAccountList *account_listener, EAccount *account)
}
static void
-ews_account_added (EAccountList *account_listener, EAccount *account)
+ews_account_added (EAccountList *account_listener,
+ EAccount *account)
{
gboolean ews_account = FALSE;
@@ -339,7 +343,7 @@ ews_account_added (EAccountList *account_listener, EAccount *account)
EwsAccountInfo *info = ews_account_info_from_eaccount (account);
ews_accounts = g_list_append (ews_accounts, info);
url = camel_url_new (account->source->url, NULL);
-
+
/* add gal esource */
add_gal_esource (url);
@@ -354,7 +358,7 @@ exchange_ews_account_listener_construct (ExchangeEWSAccountListener *config_list
config_listener->priv->account_list = e_account_list_new (config_listener->priv->gconf_client);
- for (iter = e_list_get_iterator (E_LIST(config_listener->priv->account_list)); e_iterator_is_valid (iter); e_iterator_next (iter)) {
+ for (iter = e_list_get_iterator (E_LIST (config_listener->priv->account_list)); e_iterator_is_valid (iter); e_iterator_next (iter)) {
EAccount *account = E_ACCOUNT (e_iterator_get (iter));
if (is_ews_account (account) && account->enabled) {
EwsAccountInfo *info;
@@ -425,7 +429,7 @@ exchange_ews_account_listener_new (void)
ExchangeEWSAccountListener *config_listener;
config_listener = g_object_new (EXCHANGE_EWS_ACCOUNT_LISTENER_TYPE, NULL);
- config_listener->priv->gconf_client = gconf_client_get_default();
+ config_listener->priv->gconf_client = gconf_client_get_default ();
exchange_ews_account_listener_construct (config_listener);
diff --git a/src/account-setup-eplugin/exchange-ews-account-out-of-office.c b/src/account-setup-eplugin/exchange-ews-account-out-of-office.c
index 4ade3f7..dbd5fe0 100644
--- a/src/account-setup-eplugin/exchange-ews-account-out-of-office.c
+++ b/src/account-setup-eplugin/exchange-ews-account-out-of-office.c
@@ -19,7 +19,6 @@
*
*/
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -97,7 +96,7 @@ update_audience (void)
static void
update_audience_cb (GtkComboBoxText *combo,
- gpointer data)
+ gpointer data)
{
gint active;
@@ -112,7 +111,7 @@ update_audience_cb (GtkComboBoxText *combo,
static void
update_int_msg_cb (GtkTextBuffer *buffer,
- gpointer data)
+ gpointer data)
{
if (gtk_text_buffer_get_modified (buffer)) {
GtkTextIter start, end;
@@ -127,7 +126,7 @@ update_int_msg_cb (GtkTextBuffer *buffer,
static void
update_ext_msg_cb (GtkTextBuffer *buffer,
- gpointer data)
+ gpointer data)
{
if (gtk_text_buffer_get_modified (buffer)) {
GtkTextIter start, end;
@@ -142,7 +141,7 @@ update_ext_msg_cb (GtkTextBuffer *buffer,
static void
toggled_state_cb (GtkToggleButton *button,
- gpointer data)
+ gpointer data)
{
gboolean current_oof_state;
@@ -159,7 +158,8 @@ toggled_state_cb (GtkToggleButton *button,
}
static void
-from_time_changed_cb (EDateEdit *date_tm, gpointer data)
+from_time_changed_cb (EDateEdit *date_tm,
+ gpointer data)
{
if (e_date_edit_date_is_valid (date_tm) && e_date_edit_time_is_valid (date_tm)) {
oof_data->from_time = e_date_edit_get_time (date_tm);
@@ -167,7 +167,8 @@ from_time_changed_cb (EDateEdit *date_tm, gpointer data)
}
static void
-to_time_changed_cb (EDateEdit *date_tm, gpointer data)
+to_time_changed_cb (EDateEdit *date_tm,
+ gpointer data)
{
if (e_date_edit_date_is_valid (date_tm) && e_date_edit_time_is_valid (date_tm)) {
oof_data->to_time = e_date_edit_get_time (date_tm);
@@ -218,7 +219,7 @@ destroy_oof_data (void)
}
}
-static char *
+static gchar *
get_password (CamelSettings *settings)
{
gchar *key, *password = NULL;
@@ -235,7 +236,6 @@ get_password (CamelSettings *settings)
return password;
}
-
static EEwsConnection *
get_connection (EMConfigTargetSettings *target)
{
@@ -271,7 +271,8 @@ get_connection (EMConfigTargetSettings *target)
}
static void
-set_oof_error_to_frame (GtkWidget *oof_frame, GError *error)
+set_oof_error_to_frame (GtkWidget *oof_frame,
+ GError *error)
{
GtkHBox *error_box;
GtkLabel *error_msg;
@@ -283,7 +284,7 @@ set_oof_error_to_frame (GtkWidget *oof_frame, GError *error)
error_box = (GtkHBox*) g_object_new (GTK_TYPE_HBOX, NULL, "homogeneous", FALSE, "spacing", 6, NULL);
error_img = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_SMALL_TOOLBAR);
message = g_strdup_printf (_("Unable to fetch out of office settings: \n%s"), error->message);
- error_msg = (GtkLabel*) gtk_label_new (message);
+ error_msg = (GtkLabel *) gtk_label_new (message);
gtk_label_set_use_markup (error_msg, TRUE);
gtk_box_pack_start (GTK_BOX (error_box), GTK_WIDGET (error_img), FALSE, FALSE, 12);
gtk_box_pack_start (GTK_BOX (error_box), GTK_WIDGET (error_msg), FALSE, FALSE, 0);
@@ -359,7 +360,7 @@ set_oof_settings_to_frame (GtkWidget *oof_frame)
gtk_label_set_mnemonic_widget (to_label, GTK_WIDGET (to_date));
gtk_misc_set_alignment (GTK_MISC (to_label), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (to_label), 0, 0);
-
+
scrwnd_oof_int = (GtkScrolledWindow*) g_object_new (GTK_TYPE_SCROLLED_WINDOW, "hscrollbar-policy", GTK_POLICY_AUTOMATIC, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, "shadow-type", GTK_SHADOW_IN, NULL);
txtview_oof_int = (GtkTextView*) g_object_new (GTK_TYPE_TEXT_VIEW, "justification", GTK_JUSTIFY_LEFT, "wrap-mode", GTK_WRAP_WORD, "editable", TRUE, NULL);
@@ -378,7 +379,6 @@ set_oof_settings_to_frame (GtkWidget *oof_frame)
gtk_misc_set_alignment (GTK_MISC (lbl_internal), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (lbl_internal), 0, 0);
-
/*Select External Audience*/
hbox_ext = g_object_new (GTK_TYPE_HBOX, NULL, "homogeneous", FALSE, "spacing", 6, NULL);
aud_box = gtk_combo_box_text_new ();
@@ -415,8 +415,6 @@ set_oof_settings_to_frame (GtkWidget *oof_frame)
g_signal_connect (buffer_int, "changed", G_CALLBACK (update_int_msg_cb), NULL);
g_signal_connect (buffer_ext, "changed", G_CALLBACK (update_ext_msg_cb), NULL);
-
-
gtk_table_attach (tbl_oof_status, GTK_WIDGET (lbl_status), 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (tbl_oof_status, GTK_WIDGET (hbox_state), 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (tbl_oof_status, GTK_WIDGET (from_label), 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
@@ -428,10 +426,8 @@ set_oof_settings_to_frame (GtkWidget *oof_frame)
gtk_table_attach (tbl_oof_status, GTK_WIDGET (lbl_external), 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (tbl_oof_status, GTK_WIDGET (hbox_ext), 1, 2, 4, 5, GTK_FILL, GTK_FILL, 0, 0);
-
gtk_box_pack_start (GTK_BOX (vbox_oof), GTK_WIDGET (tbl_oof_status), FALSE, FALSE, 0);
-
if (!oof_data->state) {
gtk_widget_set_sensitive (GTK_WIDGET (txtview_oof_int), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (txtview_oof_ext), FALSE);
@@ -447,7 +443,9 @@ set_oof_settings_to_frame (GtkWidget *oof_frame)
}
static void
-get_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+get_oof_settings_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GtkWidget *oof_frame = GTK_WIDGET (user_data);
@@ -482,7 +480,8 @@ get_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer user_data)
}
static void
-set_oof_data_from_settings (EMConfigTargetSettings *target, GtkWidget *oof_frame)
+set_oof_data_from_settings (EMConfigTargetSettings *target,
+ GtkWidget *oof_frame)
{
GCancellable *cancellable = NULL;
EEwsConnection *cnc = NULL;
@@ -492,13 +491,13 @@ set_oof_data_from_settings (EMConfigTargetSettings *target, GtkWidget *oof_frame
return;
cancellable = g_cancellable_new ();
-
+
e_ews_connection_get_oof_settings_start (cnc, EWS_PRIORITY_MEDIUM,
- get_oof_settings_cb, cancellable,
- oof_frame);
+ get_oof_settings_cb, cancellable,
+ oof_frame);
}
-static OOFSettings*
+static OOFSettings *
get_settings_from_data (void)
{
OOFSettings *oof_settings = NULL;
@@ -576,7 +575,7 @@ ews_get_outo_office_widget (EMConfigTargetSettings *target_account)
frm_oof = (GtkFrame*) g_object_new (GTK_TYPE_FRAME, "label", _("Out of Office"), NULL);
oof_data_new ();
-
+
stat_box = (GtkHBox*) g_object_new (GTK_TYPE_HBOX, NULL, "homogeneous", FALSE, "spacing", 6, NULL);
spinner = gtk_spinner_new ();
stat_msg = (GtkLabel*) g_object_new (GTK_TYPE_LABEL, "label", _("Fetching out of office settings..."), "use-markup", TRUE, NULL);
@@ -585,10 +584,10 @@ ews_get_outo_office_widget (EMConfigTargetSettings *target_account)
gtk_box_pack_start (GTK_BOX (stat_box), GTK_WIDGET (spinner), FALSE, FALSE, 12);
gtk_box_pack_start (GTK_BOX (stat_box), GTK_WIDGET (stat_msg), FALSE, FALSE, 0);
- gtk_spinner_start ((GtkSpinner*) spinner);
+ gtk_spinner_start ((GtkSpinner *) spinner);
gtk_container_add (GTK_CONTAINER (frm_oof), GTK_WIDGET (stat_box));
- set_oof_data_from_settings (target_account, (GtkWidget*) frm_oof);
+ set_oof_data_from_settings (target_account, (GtkWidget *) frm_oof);
return (GtkWidget *) frm_oof;
}
diff --git a/src/account-setup-eplugin/exchange-ews-account-out-of-office.h b/src/account-setup-eplugin/exchange-ews-account-out-of-office.h
index ffb2c08..c9a0c8b 100644
--- a/src/account-setup-eplugin/exchange-ews-account-out-of-office.h
+++ b/src/account-setup-eplugin/exchange-ews-account-out-of-office.h
@@ -21,5 +21,5 @@
#include <gtk/gtk.h>
#include "mail/em-config.h"
-GtkWidget* ews_get_outo_office_widget (EMConfigTargetSettings *target_account);
+GtkWidget * ews_get_outo_office_widget (EMConfigTargetSettings *target_account);
gboolean ews_set_oof_settings (EMConfigTargetSettings *target);
diff --git a/src/account-setup-eplugin/exchange-ews-account-setup.c b/src/account-setup-eplugin/exchange-ews-account-setup.c
index e6d42c3..9a2bbf3 100644
--- a/src/account-setup-eplugin/exchange-ews-account-setup.c
+++ b/src/account-setup-eplugin/exchange-ews-account-setup.c
@@ -60,7 +60,7 @@ gint e_plugin_lib_enable (EPlugin *ep, gint enable);
/* Account Setup */
GtkWidget *org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data);
-gboolean org_gnome_exchange_ews_check_options(EPlugin *epl, EConfigHookPageCheckData *data);
+gboolean org_gnome_exchange_ews_check_options (EPlugin *epl, EConfigHookPageCheckData *data);
/* OAB receiving options */
GtkWidget * org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data);
@@ -72,13 +72,14 @@ void org_gnome_exchange_ews_commit ( EPlugin *epl, EMConfigTargetSettings *targe
static ExchangeEWSAccountListener *config_listener = NULL;
static void
-free_ews_listener ( void )
+free_ews_listener (void)
{
g_object_unref (config_listener);
}
gint
-e_plugin_lib_enable (EPlugin *ep, gint enable)
+e_plugin_lib_enable (EPlugin *ep,
+ gint enable)
{
if (!config_listener)
config_listener = exchange_ews_account_listener_new ();
@@ -104,28 +105,28 @@ struct _AutoDiscCallBackData {
static void autodiscover_callback (EwsUrls *urls, gpointer user_data, GError *error)
{
struct _AutoDiscCallBackData *cbdata = (struct _AutoDiscCallBackData *) user_data;
-
+
if (error) {
g_warning ("Autodiscover failed: %s", error->message);
e_notice (NULL, GTK_MESSAGE_ERROR, _("Autodiscover failed: %s"), error->message);
g_clear_error (&error);
}
if (urls) {
- char *oab_url;
+ gchar *oab_url;
gtk_entry_set_text (GTK_ENTRY (cbdata->host_entry), urls->as_url);
oab_url = g_strconcat (urls->oab_url, "oab.xml", NULL);
gtk_entry_set_text (GTK_ENTRY (cbdata->oab_entry), oab_url);
g_free (oab_url);
-
+
g_free (urls->as_url);
g_free (urls->oab_url);
g_free (urls);
}
}
-static char *
+static gchar *
get_password (EMConfigTargetSettings *target_account)
{
gchar *key, *password = NULL;
@@ -152,7 +153,7 @@ get_password (EMConfigTargetSettings *target_account)
g_free (password);
title = g_strdup_printf (_("Enter Password for %s"), host);
password = e_passwords_ask_password (title, EXCHANGE_EWS_PASSWORD_COMPONENT, key, title,
- E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET,
+ E_PASSWORDS_REMEMBER_FOREVER | E_PASSWORDS_SECRET,
&remember, NULL);
g_free (title);
}
@@ -168,7 +169,8 @@ get_password (EMConfigTargetSettings *target_account)
}
static void
-validate_credentials (GtkWidget *widget, struct _AutoDiscCallBackData *cbdata)
+validate_credentials (GtkWidget *widget,
+ struct _AutoDiscCallBackData *cbdata)
{
EConfig *config = cbdata->config;
EMConfigTargetSettings *target_account = (EMConfigTargetSettings *)(config->target);
@@ -191,7 +193,8 @@ validate_credentials (GtkWidget *widget, struct _AutoDiscCallBackData *cbdata)
}
static void
-oab_url_changed (GtkWidget *entry, EConfig *config)
+oab_url_changed (GtkWidget *entry,
+ EConfig *config)
{
EMConfigTargetSettings *target = (EMConfigTargetSettings *)(config->target);
CamelEwsSettings *ews_settings;
@@ -203,7 +206,8 @@ oab_url_changed (GtkWidget *entry, EConfig *config)
}
static void
-host_url_changed (GtkWidget *entry, EConfig *config)
+host_url_changed (GtkWidget *entry,
+ EConfig *config)
{
EMConfigTargetSettings *target = (EMConfigTargetSettings *)(config->target);
CamelEwsSettings *ews_settings;
@@ -215,7 +219,8 @@ host_url_changed (GtkWidget *entry, EConfig *config)
}
GtkWidget *
-org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *data)
+org_gnome_exchange_ews_account_setup (EPlugin *epl,
+ EConfigHookItemFactoryData *data)
{
EMConfigTargetSettings *target_account;
EShell *shell;
@@ -233,7 +238,7 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
const gchar *temp, *email_id;
struct _AutoDiscCallBackData *cbdata;
- target_account = (EMConfigTargetSettings *)data->config->target;
+ target_account = (EMConfigTargetSettings *) data->config->target;
settings = target_account->storage_settings;
if (!CAMEL_IS_EWS_SETTINGS (settings))
@@ -310,14 +315,14 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
g_signal_connect (G_OBJECT(auto_discover), "clicked", G_CALLBACK(validate_credentials), cbdata);
/* Add Host entry */
- gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row + 1, 0, 0, 0, 0);
gtk_widget_show_all (GTK_WIDGET (hbox));
- gtk_table_attach (GTK_TABLE (data->parent), GTK_WIDGET (hbox), 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), GTK_WIDGET (hbox), 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
row++;
/* Add OAB entry */
- gtk_table_attach (GTK_TABLE (data->parent), oab_label, 0, 1, row, row+1, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (data->parent), oab_url, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), oab_label, 0, 1, row, row + 1, 0, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), oab_url, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
row++;
/* If evolution is offline, dsensitize fetch button and oab entry */
@@ -329,7 +334,8 @@ org_gnome_exchange_ews_account_setup (EPlugin *epl, EConfigHookItemFactoryData *
}
gboolean
-org_gnome_exchange_ews_check_options(EPlugin *epl, EConfigHookPageCheckData *data)
+org_gnome_exchange_ews_check_options (EPlugin *epl,
+ EConfigHookPageCheckData *data)
{
EMConfigTargetSettings *target = (EMConfigTargetSettings *)(data->config->target);
CamelEwsSettings *ews_settings;
@@ -401,14 +407,14 @@ update_camel_url (struct _oab_setting_data *cbdata)
CamelEwsSettings *ews_settings;
ews_settings = CAMEL_EWS_SETTINGS (target->storage_settings);
-
+
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cbdata->check))) {
gint num;
-
+
gtk_widget_set_sensitive (cbdata->hbox, TRUE);
camel_ews_settings_set_oab_offline (ews_settings, TRUE);
num = gtk_combo_box_get_active (GTK_COMBO_BOX (cbdata->combo_text));
-
+
/* Set the active oal */
if (cbdata->oals && num != -1) {
gchar *mangled_oal;
@@ -429,7 +435,8 @@ update_camel_url (struct _oab_setting_data *cbdata)
}
static void
-cache_setting_toggled (GtkToggleButton *check, gpointer user_data)
+cache_setting_toggled (GtkToggleButton *check,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
@@ -437,7 +444,8 @@ cache_setting_toggled (GtkToggleButton *check, gpointer user_data)
}
static void
-combo_selection_changed (GtkComboBox *combo, gpointer user_data)
+combo_selection_changed (GtkComboBox *combo,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
@@ -445,7 +453,9 @@ combo_selection_changed (GtkComboBox *combo, gpointer user_data)
}
static void
-ews_oal_list_ready (GObject *obj, GAsyncResult *res, gpointer user_data)
+ews_oal_list_ready (GObject *obj,
+ GAsyncResult *res,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
EEwsConnection *cnc = E_EWS_CONNECTION (obj);
@@ -462,7 +472,7 @@ ews_oal_list_ready (GObject *obj, GAsyncResult *res, gpointer user_data)
if (cancelled) {
g_clear_error (&error);
- return;
+ return;
}
e_notice (NULL, GTK_MESSAGE_ERROR, "%s%s", _("Could not fetch oal list: "), error->message);
@@ -479,7 +489,7 @@ ews_oal_list_ready (GObject *obj, GAsyncResult *res, gpointer user_data)
for (l = oals; l != NULL; l = g_slist_next (l)) {
EwsOAL *oal = l->data;
-
+
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbdata->combo_text), oal->name);
}
@@ -489,7 +499,8 @@ ews_oal_list_ready (GObject *obj, GAsyncResult *res, gpointer user_data)
}
static void
-fetch_button_clicked_cb (GtkButton *button, gpointer user_data)
+fetch_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
EMConfigTargetSettings *target = (EMConfigTargetSettings *) cbdata->config->target;
@@ -500,7 +511,7 @@ fetch_button_clicked_cb (GtkButton *button, gpointer user_data)
const gchar *oab_url;
const gchar *user;
gchar *password;
-
+
cancellable = g_cancellable_new ();
ews_settings = CAMEL_EWS_SETTINGS (target->storage_settings);
@@ -508,14 +519,13 @@ fetch_button_clicked_cb (GtkButton *button, gpointer user_data)
/* De-sensitize fetch_button and get the list from the server */
g_signal_handlers_block_by_func (cbdata->combo_text, combo_selection_changed, cbdata);
-
+
clear_combo (GTK_COMBO_BOX_TEXT (cbdata->combo_text));
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbdata->combo_text), _("Fetching..."));
gtk_combo_box_set_active (GTK_COMBO_BOX (cbdata->combo_text), 0);
gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
g_signal_handlers_unblock_by_func (cbdata->combo_text, combo_selection_changed, cbdata);
-
/* Fetch the oab lists from server */
oab_url = camel_ews_settings_get_oaburl (ews_settings);
@@ -531,7 +541,8 @@ fetch_button_clicked_cb (GtkButton *button, gpointer user_data)
}
static void
-ews_oal_free (gpointer data, gpointer user_data)
+ews_oal_free (gpointer data,
+ gpointer user_data)
{
EwsOAL *oal = (EwsOAL *) data;
@@ -542,18 +553,19 @@ ews_oal_free (gpointer data, gpointer user_data)
}
static gboolean
-table_deleted_cb (GtkWidget *widget, gpointer user_data)
+table_deleted_cb (GtkWidget *widget,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
-
+
if (cbdata->cancellable)
g_cancellable_cancel (cbdata->cancellable);
-
+
if (cbdata->oals) {
g_slist_foreach (cbdata->oals, (GFunc) ews_oal_free, NULL);
g_slist_free (cbdata->oals);
}
-
+
g_free (cbdata);
return FALSE;
}
@@ -580,10 +592,10 @@ init_widgets (struct _oab_setting_data *cbdata)
/* selected list will be of form "id:name" */
if (selected_list && gtk_combo_box_get_active (GTK_COMBO_BOX (cbdata->combo_text)) == -1) {
const gchar *tmp;
-
+
tmp = strrchr (selected_list, ':');
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbdata->combo_text), tmp+1);
-
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbdata->combo_text), tmp + 1);
+
g_signal_handlers_block_by_func (cbdata->combo_text, combo_selection_changed, cbdata);
gtk_combo_box_set_active (GTK_COMBO_BOX (cbdata->combo_text), 0);
g_signal_handlers_unblock_by_func (cbdata->combo_text, combo_selection_changed, cbdata);
@@ -600,7 +612,8 @@ init_widgets (struct _oab_setting_data *cbdata)
}
static void
-ews_prepare_receive_options_page (GtkWidget *page, gpointer user_data)
+ews_prepare_receive_options_page (GtkWidget *page,
+ gpointer user_data)
{
struct _oab_setting_data *cbdata = (struct _oab_setting_data *) user_data;
GtkWidget *receive_options;
@@ -611,19 +624,25 @@ ews_prepare_receive_options_page (GtkWidget *page, gpointer user_data)
}
static void
-ews_assistant_page_changed_cb (GtkAssistant *assistant, GtkWidget *page, gpointer user_data)
+ews_assistant_page_changed_cb (GtkAssistant *assistant,
+ GtkWidget *page,
+ gpointer user_data)
{
ews_prepare_receive_options_page (page, user_data);
}
static void
-ews_page_switched_cb (GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data)
+ews_page_switched_cb (GtkNotebook *notebook,
+ GtkWidget *page,
+ guint page_num,
+ gpointer user_data)
{
ews_prepare_receive_options_page (page, user_data);
}
GtkWidget *
-org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
+org_gnome_ews_oab_settings (EPlugin *epl,
+ EConfigHookItemFactoryData *data)
{
EMConfigTargetSettings *target_account;
GtkWidget *check = NULL;
@@ -633,7 +652,7 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
EShell *shell;
struct _oab_setting_data *cbdata;
- target_account = (EMConfigTargetSettings *)data->config->target;
+ target_account = (EMConfigTargetSettings *) data->config->target;
if (!CAMEL_IS_EWS_SETTINGS (target_account->storage_settings))
return NULL;
@@ -641,25 +660,25 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
/* Add cache check box */
check = gtk_check_button_new_with_mnemonic (_("Cache o_ffline address book"));
gtk_widget_show (check);
- gtk_table_attach (GTK_TABLE (data->parent), check, 0, 1, row, row+1, 0, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), check, 0, 1, row, row + 1, 0, 0, 0, 0);
row++;
/* Add label */
label = gtk_label_new_with_mnemonic (_("Select Ad_dress list: "));
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row + 1, 0, 0, 0, 0);
/* OAL combo and fetch OAL button */
hbox = gtk_hbox_new (FALSE, 6);
oal_combo = gtk_combo_box_text_new ();
- gtk_label_set_mnemonic_widget (GTK_LABEL(label), oal_combo);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), oal_combo);
gtk_box_pack_start (GTK_BOX (hbox), oal_combo, TRUE, TRUE, 0);
fetch_button = gtk_button_new_with_mnemonic (_("Fetch _list"));
gtk_box_pack_start (GTK_BOX (hbox), fetch_button, FALSE, FALSE, 0);
/* Add hbox to table */
- gtk_table_attach (GTK_TABLE (data->parent), hbox, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (data->parent), hbox, 1, 2, row, row + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_widget_show_all (hbox);
row++;
@@ -670,13 +689,13 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
gtk_widget_set_sensitive (hbox, FALSE);
return check;
}
-
+
cbdata = g_new0 (struct _oab_setting_data, 1);
cbdata->check = check;
cbdata->combo_text = oal_combo;
cbdata->hbox = hbox;
cbdata->fetch_button = fetch_button;
- cbdata->config = data->config;
+ cbdata->config = data->config;
/* Connect the signals */
g_signal_connect (check, "toggled", G_CALLBACK (cache_setting_toggled), cbdata);
@@ -696,13 +715,13 @@ org_gnome_ews_oab_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
}
void
-org_gnome_exchange_ews_commit ( EPlugin *epl,
- EMConfigTargetSettings *target_account)
+org_gnome_exchange_ews_commit (EPlugin *epl,
+ EMConfigTargetSettings *target_account)
{
/*return if it is not a ews account*/
if (!CAMEL_IS_EWS_SETTINGS (target_account->storage_settings))
return;
-
+
/* Verify the storage and transport settings are shared. */
g_warn_if_fail (
target_account->storage_settings ==
@@ -713,7 +732,8 @@ org_gnome_exchange_ews_commit ( EPlugin *epl,
}
GtkWidget *
-org_gnome_ews_settings (EPlugin *epl, EConfigHookItemFactoryData *data)
+org_gnome_ews_settings (EPlugin *epl,
+ EConfigHookItemFactoryData *data)
{
EMConfigTargetSettings *target_account;
GtkVBox *vbox_settings;
diff --git a/src/addressbook/e-book-backend-ews-utils.c b/src/addressbook/e-book-backend-ews-utils.c
index be9eeaa..7613aba 100644
--- a/src/addressbook/e-book-backend-ews-utils.c
+++ b/src/addressbook/e-book-backend-ews-utils.c
@@ -50,10 +50,11 @@
**/
static gboolean
-get_book_view (EDataBookView *view, gpointer user_data)
+get_book_view (EDataBookView *view,
+ gpointer user_data)
{
EDataBookView **ret = (EDataBookView **) user_data;
-
+
e_data_book_view_ref (view);
*ret = view;
diff --git a/src/addressbook/e-book-backend-ews-utils.h b/src/addressbook/e-book-backend-ews-utils.h
index c5c93c0..6df2ecc 100644
--- a/src/addressbook/e-book-backend-ews-utils.h
+++ b/src/addressbook/e-book-backend-ews-utils.h
@@ -22,4 +22,4 @@
#include "libedata-book/e-data-book-view.h"
-EDataBookView* e_book_backend_ews_utils_get_book_view (EBookBackend *backend);
+EDataBookView * e_book_backend_ews_utils_get_book_view (EBookBackend *backend);
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index cfb9d96..deb0198 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -80,7 +80,7 @@ struct _EBookBackendEwsPrivate {
gchar *username;
gchar *password;
-
+
EBookBackendSqliteDB *ebsdb;
gboolean only_if_exists;
@@ -116,7 +116,7 @@ enum {
#define ELEMENT_TYPE_COMPLEX 0x02 /* complex fields while require different get/set functions */
/* passing field uris for PhysicalAddress, PhoneNumbers causes error, so we use Default view to fetch them. Thus the summary props just have attachments and
- some additional properties that are not return with Default view */
+ * some additional properties that are not return with Default view */
#define CONTACT_ITEM_PROPS "item:Attachments item:HasAttachments contacts:Manager contacts:Department contacts:SpouseName contacts:AssistantName contacts:BusinessHomePage contacts:Birthday"
#define PRIV_LOCK(p) (g_static_rec_mutex_lock (&(p)->rec_mutex))
@@ -132,7 +132,7 @@ static gboolean
ews_remove_attachments (const gchar *attachment_dir)
{
GDir *dir;
-
+
dir = g_dir_open (attachment_dir, 0, NULL);
if (dir) {
const gchar *fname;
@@ -159,7 +159,7 @@ ews_remove_attachments (const gchar *attachment_dir)
static const struct phone_field_mapping {
EContactField field;
const gchar *element;
-} phone_field_map [] = {
+} phone_field_map[] = {
{E_CONTACT_PHONE_ASSISTANT, "AssistantPhone"},
{E_CONTACT_PHONE_BUSINESS_FAX, "BusinessFax"},
{E_CONTACT_PHONE_BUSINESS, "BusinessPhone"},
@@ -181,7 +181,8 @@ static const struct phone_field_mapping {
};
static void
-ebews_populate_uid (EContact *contact, EEwsItem *item)
+ebews_populate_uid (EContact *contact,
+ EEwsItem *item)
{
const EwsId *id;
@@ -193,7 +194,8 @@ ebews_populate_uid (EContact *contact, EEwsItem *item)
}
static void
-ebews_populate_full_name (EContact *contact, EEwsItem *item)
+ebews_populate_full_name (EContact *contact,
+ EEwsItem *item)
{
const EwsCompleteName *cn;
@@ -203,7 +205,8 @@ ebews_populate_full_name (EContact *contact, EEwsItem *item)
}
static void
-ebews_populate_nick_name (EContact *contact, EEwsItem *item)
+ebews_populate_nick_name (EContact *contact,
+ EEwsItem *item)
{
const EwsCompleteName *cn;
@@ -213,7 +216,8 @@ ebews_populate_nick_name (EContact *contact, EEwsItem *item)
}
static void
-ebews_populate_birth_date (EContact *contact, EEwsItem *item)
+ebews_populate_birth_date (EContact *contact,
+ EEwsItem *item)
{
time_t bdate;
GDate date;
@@ -224,7 +228,7 @@ ebews_populate_birth_date (EContact *contact, EEwsItem *item)
if (bdate) {
g_date_clear (&date, 1);
g_date_set_time_t (&date, bdate);
-
+
edate.year = date.year;
edate.month = date.month;
edate.day = date.day;
@@ -235,7 +239,8 @@ ebews_populate_birth_date (EContact *contact, EEwsItem *item)
}
static void
-ebews_populate_anniversary (EContact *contact, EEwsItem *item)
+ebews_populate_anniversary (EContact *contact,
+ EEwsItem *item)
{
time_t bdate;
GDate date;
@@ -246,7 +251,7 @@ ebews_populate_anniversary (EContact *contact, EEwsItem *item)
if (bdate) {
g_date_clear (&date, 1);
g_date_set_time_t (&date, bdate);
-
+
edate.year = date.year;
edate.month = date.month;
edate.day = date.day;
@@ -257,26 +262,31 @@ ebews_populate_anniversary (EContact *contact, EEwsItem *item)
}
static void
-set_phone_number (EContact *contact, EContactField field, EEwsItem *item, const gchar *item_field)
+set_phone_number (EContact *contact,
+ EContactField field,
+ EEwsItem *item,
+ const gchar *item_field)
{
const gchar *pn;
-
+
pn = e_ews_item_get_phone_number (item, item_field);
if (pn && *pn)
e_contact_set (contact, field, pn);
}
static void
-ebews_populate_phone_numbers (EContact *contact, EEwsItem *item)
+ebews_populate_phone_numbers (EContact *contact,
+ EEwsItem *item)
{
gint i;
-
+
for (i = 0; i < G_N_ELEMENTS (phone_field_map); i++)
set_phone_number (contact, phone_field_map[i].field, item, phone_field_map[i].element);
}
static void
-copy_ews_address_to_contact_address ( EContactAddress *contact_addr, const EwsAddress *address)
+copy_ews_address_to_contact_address (EContactAddress *contact_addr,
+ const EwsAddress *address)
{
contact_addr->address_format = NULL;
contact_addr->po = NULL;
@@ -288,14 +298,17 @@ copy_ews_address_to_contact_address ( EContactAddress *contact_addr, const EwsAd
contact_addr->country = g_strdup (address->country);
}
static void
-set_address (EContact *contact, EContactField field, EEwsItem *item, const gchar *item_field)
+set_address (EContact *contact,
+ EContactField field,
+ EEwsItem *item,
+ const gchar *item_field)
{
const EwsAddress *address;
-
+
address = e_ews_item_get_physical_address (item, item_field);
if (address) {
EContactAddress *addr;
-
+
addr = g_new0 (EContactAddress, 1);
copy_ews_address_to_contact_address (addr, address);
e_contact_set (contact, field, addr);
@@ -304,33 +317,39 @@ set_address (EContact *contact, EContactField field, EEwsItem *item, const gchar
}
static void
-ebews_populate_address (EContact *contact, EEwsItem *item)
+ebews_populate_address (EContact *contact,
+ EEwsItem *item)
{
-
+
set_address (contact, E_CONTACT_ADDRESS_WORK, item, "Business");
set_address (contact, E_CONTACT_ADDRESS_HOME, item, "Home");
set_address (contact, E_CONTACT_ADDRESS_OTHER, item, "Other");
}
static void
-ebews_populate_ims (EContact *contact, EEwsItem *item)
+ebews_populate_ims (EContact *contact,
+ EEwsItem *item)
{
/* TODO : The fields returned by server does not match with the EContact fields
- for the IMS, handle it later */
+ * for the IMS, handle it later */
}
static void
-set_email_address (EContact *contact, EContactField field, EEwsItem *item, const gchar *item_field)
+set_email_address (EContact *contact,
+ EContactField field,
+ EEwsItem *item,
+ const gchar *item_field)
{
const gchar *ea;
-
+
ea = e_ews_item_get_email_address (item, item_field);
if (ea && *ea)
e_contact_set (contact, field, ea);
}
static void
-ebews_populate_emails (EContact *contact, EEwsItem *item)
+ebews_populate_emails (EContact *contact,
+ EEwsItem *item)
{
set_email_address (contact, E_CONTACT_EMAIL_1, item, "EmailAddress1");
set_email_address (contact, E_CONTACT_EMAIL_2, item, "EmailAddress2");
@@ -338,36 +357,40 @@ ebews_populate_emails (EContact *contact, EEwsItem *item)
}
static void
-ebews_set_item_id (ESoapMessage *message, EContact *contact)
+ebews_set_item_id (ESoapMessage *message,
+ EContact *contact)
{
-
+
}
static void
-ebews_set_full_name (ESoapMessage *msg, EContact *contact)
+ebews_set_full_name (ESoapMessage *msg,
+ EContact *contact)
{
EContactName *name;
name = e_contact_get (contact, E_CONTACT_NAME);
if (!name)
return;
-
+
if (name->given)
e_ews_message_write_string_parameter(msg, "GivenName", NULL, name->given);
-
+
if (name->additional && *name->additional)
e_ews_message_write_string_parameter(msg, "MiddleName", NULL, name->additional);
e_contact_name_free (name);
}
+
/* TODO Set birth and anniversary dates */
static void
-ebews_set_birth_date (ESoapMessage *message, EContact *contact)
+ebews_set_birth_date (ESoapMessage *message,
+ EContact *contact)
{
EContactDate *date;
gchar *birthday;
- date = e_contact_get(contact, E_CONTACT_BIRTH_DATE);
+ date = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
if (!date)
return;
@@ -379,28 +402,32 @@ ebews_set_birth_date (ESoapMessage *message, EContact *contact)
g_free (birthday);
-
}
static void
-ebews_set_anniversary (ESoapMessage *message, EContact *contact)
+ebews_set_anniversary (ESoapMessage *message,
+ EContact *contact)
{
-
+
}
static gboolean
-add_entry (ESoapMessage *msg, EContact *contact, EContactField field, const gchar *entry_name, const gchar *include_hdr)
+add_entry (ESoapMessage *msg,
+ EContact *contact,
+ EContactField field,
+ const gchar *entry_name,
+ const gchar *include_hdr)
{
gchar *entry_val;
entry_val = e_contact_get (contact, field);
-
- if (entry_val && *entry_val){
+
+ if (entry_val && *entry_val) {
if (include_hdr)
- e_soap_message_start_element(msg, include_hdr, NULL, NULL);
+ e_soap_message_start_element (msg, include_hdr, NULL, NULL);
e_ews_message_write_string_parameter_with_attribute(msg, "Entry", NULL, entry_val, "Key", entry_name);
-
+
g_free (entry_val);
return TRUE;
}
@@ -410,22 +437,27 @@ add_entry (ESoapMessage *msg, EContact *contact, EContactField field, const gcha
}
static void
-ebews_set_phone_numbers (ESoapMessage *msg, EContact *contact)
+ebews_set_phone_numbers (ESoapMessage *msg,
+ EContact *contact)
{
gint i;
const gchar *include_hdr = "PhoneNumbers";
-
+
for (i = 0; i < G_N_ELEMENTS (phone_field_map); i++) {
if (add_entry (msg, contact, phone_field_map[i].field, phone_field_map[i].element, include_hdr))
include_hdr = NULL;
}
if (!include_hdr)
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static gboolean
-add_physical_address (ESoapMessage *msg, EContact *contact, EContactField field, const gchar *entry_name, gboolean include_start_hdr)
+add_physical_address (ESoapMessage *msg,
+ EContact *contact,
+ EContactField field,
+ const gchar *entry_name,
+ gboolean include_start_hdr)
{
EContactAddress *contact_addr;
@@ -437,7 +469,7 @@ add_physical_address (ESoapMessage *msg, EContact *contact, EContactField field,
e_soap_message_start_element (msg, "PhysicalAddresses", NULL, NULL);
e_soap_message_start_element (msg, "Entry", NULL, NULL);
-
+
e_soap_message_add_attribute (msg, "Key", entry_name, NULL, NULL);
e_ews_message_write_string_parameter (msg, "Street", NULL, contact_addr->street);
e_ews_message_write_string_parameter (msg, "City", NULL, contact_addr->locality);
@@ -451,7 +483,8 @@ add_physical_address (ESoapMessage *msg, EContact *contact, EContactField field,
}
static void
-ebews_set_address (ESoapMessage *msg, EContact *contact)
+ebews_set_address (ESoapMessage *msg,
+ EContact *contact)
{
gboolean include_hdr = TRUE;
@@ -463,20 +496,22 @@ ebews_set_address (ESoapMessage *msg, EContact *contact)
include_hdr = FALSE;
if (!include_hdr)
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-ebews_set_ims (ESoapMessage *message, EContact *contact)
+ebews_set_ims (ESoapMessage *message,
+ EContact *contact)
{
-
+
}
static void
-ebews_set_emails (ESoapMessage *msg, EContact *contact)
+ebews_set_emails (ESoapMessage *msg,
+ EContact *contact)
{
const gchar *include_hdr = "EmailAddresses";
-
+
if (add_entry (msg, contact, E_CONTACT_EMAIL_1, "EmailAddress1", include_hdr))
include_hdr = NULL;
if (add_entry (msg, contact, E_CONTACT_EMAIL_2, "EmailAddress2", include_hdr))
@@ -485,11 +520,16 @@ ebews_set_emails (ESoapMessage *msg, EContact *contact)
include_hdr = NULL;
if (!include_hdr)
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-convert_contact_property_to_updatexml (ESoapMessage *msg, const gchar *name, const gchar *value, const gchar * prefix, const gchar *attr_name, const gchar *attr_value)
+convert_contact_property_to_updatexml (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *attr_name,
+ const gchar *attr_value)
{
e_ews_message_start_set_item_field (msg, name, prefix, "Contact");
e_ews_message_write_string_parameter_with_attribute (msg, name, NULL, value, attr_name, attr_value);
@@ -497,26 +537,32 @@ convert_contact_property_to_updatexml (ESoapMessage *msg, const gchar *name, con
}
static void
-convert_indexed_contact_property_to_updatexml (ESoapMessage *message, const gchar *name, const gchar *value, const gchar * prefix, const gchar *element_name, const gchar *key)
+convert_indexed_contact_property_to_updatexml (ESoapMessage *message,
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *element_name,
+ const gchar *key)
{
gboolean delete_field = FALSE;
if(!value || !g_strcmp0(value, ""))
delete_field = TRUE;
e_ews_message_start_set_indexed_item_field (message, name , prefix, "Contact", key, delete_field);
-
- if(!delete_field)
+
+ if (!delete_field)
{
- e_soap_message_start_element(message, element_name, NULL, NULL);
+ e_soap_message_start_element (message, element_name, NULL, NULL);
e_ews_message_write_string_parameter_with_attribute(message, "Entry", NULL, value, "Key", key);
- e_soap_message_end_element(message);
+ e_soap_message_end_element (message);
}
e_ews_message_end_set_indexed_item_field (message, delete_field);
}
-
static void
-ebews_set_full_name_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_full_name_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
EContactName *name, *old_name;
@@ -524,28 +570,30 @@ ebews_set_full_name_changes (ESoapMessage *message, EContact *new, EContact *old
old_name = e_contact_get (old, E_CONTACT_NAME);
if (!name && !old_name)
return;
-
- if (g_ascii_strcasecmp(name->given, old_name->given))
+
+ if (g_ascii_strcasecmp (name->given, old_name->given))
convert_contact_property_to_updatexml(message, "GivenName", name->given, "contacts", NULL, NULL);
-
- if (g_ascii_strcasecmp(name->additional, old_name->additional))
+
+ if (g_ascii_strcasecmp (name->additional, old_name->additional))
convert_contact_property_to_updatexml(message, "MiddleName", name->additional, "contacts", NULL, NULL);
e_contact_name_free (name);
e_contact_name_free (old_name);
-
+
}
static void
-ebews_set_birth_date_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_birth_date_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
EContactDate *new_date, *old_date;
gchar *birthday;
- new_date = e_contact_get(new, E_CONTACT_BIRTH_DATE);
- old_date = e_contact_get(old, E_CONTACT_BIRTH_DATE);
+ new_date = e_contact_get (new, E_CONTACT_BIRTH_DATE);
+ old_date = e_contact_get (old, E_CONTACT_BIRTH_DATE);
- if (e_contact_date_equal(new_date, old_date))
+ if (e_contact_date_equal (new_date, old_date))
return;
birthday = g_strdup_printf("%04d-%02d-%02dT00:00:00",
@@ -556,32 +604,42 @@ ebews_set_birth_date_changes (ESoapMessage *message, EContact *new, EContact *ol
}
static void
-ebews_set_anniversary_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_anniversary_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
}
static void
-ebews_set_phone_number_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_phone_number_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
gint i;
gchar *new_value, *old_value;
-
+
for (i = 0; i < G_N_ELEMENTS (phone_field_map); i++) {
new_value = e_contact_get (new, phone_field_map[i].field);
old_value = e_contact_get (old, phone_field_map[i].field);
- if((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp(new_value, old_value)))
+ if ((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp (new_value, old_value)))
convert_indexed_contact_property_to_updatexml (message, "PhoneNumber", new_value, "contacts", "PhoneNumbers", phone_field_map[i].element);
- if(new_value)
- g_free(new_value);
-
- if(old_value)
- g_free(old_value);
+ if (new_value)
+ g_free (new_value);
+
+ if (old_value)
+ g_free (old_value);
}
}
static void
-convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *message, const gchar *name, const gchar *uri_element, const gchar *value, const gchar * prefix, const gchar *element_name, const gchar *key)
+convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *message,
+ const gchar *name,
+ const gchar *uri_element,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *element_name,
+ const gchar *key)
{
gchar * fielduri = NULL;
gboolean delete_field = FALSE;
@@ -592,56 +650,63 @@ convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *me
fielduri = g_strconcat (name, ":", uri_element, NULL);
e_ews_message_start_set_indexed_item_field (message, fielduri , prefix, "Contact", key, delete_field);
-
- if(!delete_field)
+
+ if (!delete_field)
{
- e_soap_message_start_element(message, element_name, NULL, NULL);
+ e_soap_message_start_element (message, element_name, NULL, NULL);
e_soap_message_start_element (message, "Entry", NULL, NULL);
e_soap_message_add_attribute (message, "Key", key, NULL, NULL);
e_ews_message_write_string_parameter (message, uri_element, NULL, value);
- e_soap_message_end_element(message);
+ e_soap_message_end_element (message);
- e_soap_message_end_element(message);
+ e_soap_message_end_element (message);
}
e_ews_message_end_set_indexed_item_field (message, delete_field);
}
-static void compare_address(ESoapMessage *message, EContact *new, EContact *old, EContactField field, const char *key)
+static void
+compare_address (ESoapMessage *message,
+ EContact *new,
+ EContact *old,
+ EContactField field,
+ const gchar *key)
{
EContactAddress *new_address, *old_address;
gboolean set = FALSE;
- new_address = e_contact_get(new, field);
- old_address = e_contact_get(old, field);
+ new_address = e_contact_get (new, field);
+ old_address = e_contact_get (old, field);
- if(!new_address && !old_address)
+ if (!new_address && !old_address)
return;
- if(!old_address && new_address)
+ if (!old_address && new_address)
set = TRUE;
- if(!new_address && old_address)
+ if (!new_address && old_address)
{
set = TRUE;
- new_address = g_new0(EContactAddress, 1);
+ new_address = g_new0 (EContactAddress, 1);
}
- if (set || g_ascii_strcasecmp(new_address->street, old_address->street))
+ if (set || g_ascii_strcasecmp (new_address->street, old_address->street))
convert_indexed_contact_property_to_updatexml_physical_address (message, "PhysicalAddress", "Street", new_address->street, "contacts", "PhysicalAddresses", key);
- if (set || g_ascii_strcasecmp(new_address->locality, old_address->locality))
+ if (set || g_ascii_strcasecmp (new_address->locality, old_address->locality))
convert_indexed_contact_property_to_updatexml_physical_address (message, "PhysicalAddress", "City", new_address->locality, "contacts", "PhysicalAddresses", key);
- if (set || g_ascii_strcasecmp(new_address->region, old_address->region))
+ if (set || g_ascii_strcasecmp (new_address->region, old_address->region))
convert_indexed_contact_property_to_updatexml_physical_address (message, "PhysicalAddress", "State", new_address->region, "contacts", "PhysicalAddresses", key);
- if (set || g_ascii_strcasecmp(new_address->code, old_address->code))
+ if (set || g_ascii_strcasecmp (new_address->code, old_address->code))
convert_indexed_contact_property_to_updatexml_physical_address (message, "PhysicalAddress", "PostalCode", new_address->code, "contacts", "PhysicalAddresses", key);
- e_contact_address_free(old_address);
- e_contact_address_free(new_address);
+ e_contact_address_free (old_address);
+ e_contact_address_free (new_address);
}
static void
-ebews_set_address_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_address_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
compare_address(message, new, old, E_CONTACT_ADDRESS_WORK, "Business");
compare_address(message, new, old, E_CONTACT_ADDRESS_HOME, "Home");
@@ -649,42 +714,46 @@ ebews_set_address_changes (ESoapMessage *message, EContact *new, EContact *old)
}
static void
-ebews_set_im_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_im_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
-
+
}
static void
-ebews_set_email_changes (ESoapMessage *message, EContact *new, EContact *old)
+ebews_set_email_changes (ESoapMessage *message,
+ EContact *new,
+ EContact *old)
{
gchar *new_value, *old_value;
-
+
new_value = e_contact_get (new, E_CONTACT_EMAIL_1);
old_value = e_contact_get (old, E_CONTACT_EMAIL_1);
- if((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp(new_value, old_value)))
+ if ((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp (new_value, old_value)))
convert_indexed_contact_property_to_updatexml (message, "EmailAddress", new_value, "contacts", "EmailAddresses", "EmailAddress1");
- if(new_value)
- g_free(new_value);
+ if (new_value)
+ g_free (new_value);
if (old_value)
- g_free(old_value);
+ g_free (old_value);
new_value = e_contact_get (new, E_CONTACT_EMAIL_2);
old_value = e_contact_get (old, E_CONTACT_EMAIL_2);
- if((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp(new_value, old_value)))
+ if ((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp (new_value, old_value)))
convert_indexed_contact_property_to_updatexml (message, "EmailAddress", new_value, "contacts", "EmailAddresses", "EmailAddress2");
- if(new_value)
- g_free(new_value);
+ if (new_value)
+ g_free (new_value);
if (old_value)
- g_free(old_value);
+ g_free (old_value);
new_value = e_contact_get (new, E_CONTACT_EMAIL_3);
old_value = e_contact_get (old, E_CONTACT_EMAIL_3);
- if((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp(new_value, old_value)))
+ if ((new_value && !old_value) || (!new_value && old_value) ||(new_value && old_value && g_ascii_strcasecmp (new_value, old_value)))
convert_indexed_contact_property_to_updatexml (message, "EmailAddress", new_value, "contacts", "EmailAddresses", "EmailAddress3");
- if(new_value)
- g_free(new_value);
+ if (new_value)
+ g_free (new_value);
if (old_value)
- g_free(old_value);
+ g_free (old_value);
}
static const struct field_element_mapping {
@@ -727,7 +796,6 @@ static const struct field_element_mapping {
{ E_CONTACT_UID, ELEMENT_TYPE_COMPLEX, "ItemId", NULL, ebews_populate_uid, ebews_set_item_id},
};
-
typedef struct {
EBookBackendEws *ebews;
EDataBook *book;
@@ -736,9 +804,10 @@ typedef struct {
} EwsCreateContact;
static void
-convert_contact_to_xml (ESoapMessage *msg, gpointer user_data)
+convert_contact_to_xml (ESoapMessage *msg,
+ gpointer user_data)
{
- EContact *contact = (EContact*)user_data;
+ EContact *contact = (EContact *) user_data;
gint i, element_type;
/* Prepare Contact node in the SOAP message */
@@ -748,25 +817,27 @@ convert_contact_to_xml (ESoapMessage *msg, gpointer user_data)
element_type = mappings[i].element_type;
if (element_type == ELEMENT_TYPE_SIMPLE) {
- char *val = e_contact_get (contact, mappings [i].field_id);
+ gchar *val = e_contact_get (contact, mappings[i].field_id);
/* skip uid while creating contacts */
- if (mappings [i].field_id == E_CONTACT_UID)
+ if (mappings[i].field_id == E_CONTACT_UID)
continue;
if (val && *val)
- e_ews_message_write_string_parameter(msg, mappings[i].element_name, NULL, val);
+ e_ews_message_write_string_parameter (msg, mappings[i].element_name, NULL, val);
g_free (val);
} else
mappings[i].set_value_in_soap_message (msg, contact);
}
// end of "Contact"
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-ews_create_contact_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+ews_create_contact_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsCreateContact *create_contact = user_data;
@@ -776,13 +847,13 @@ ews_create_contact_cb(GObject *object, GAsyncResult *res, gpointer user_data)
const EwsId *item_id;
/* get a list of ids from server (single item) */
- e_ews_connection_create_items_finish(cnc, res, &items, &error);
+ e_ews_connection_create_items_finish (cnc, res, &items, &error);
if (error == NULL) {
EEwsItem *item = (EEwsItem *) items->data;
/* set item id */
- item_id = e_ews_item_get_id((EEwsItem *)items->data);
+ item_id = e_ews_item_get_id ((EEwsItem *) items->data);
e_contact_set (create_contact->contact, E_CONTACT_UID, item_id->id);
e_contact_set (create_contact->contact, E_CONTACT_REV, item_id->change_key);
@@ -799,36 +870,36 @@ ews_create_contact_cb(GObject *object, GAsyncResult *res, gpointer user_data)
g_object_unref (item);
g_slist_free (items);
}
-
+
if (error) {
g_warning("Error while Creating contact: %s", error->message);
e_data_book_respond_create_contacts (create_contact->book, create_contact->opid, EDB_ERROR_EX (OTHER_ERROR, error->message), NULL);
}
/* free memory allocated for create_contact & unref contained objects */
- g_object_unref(create_contact->ebews);
- g_object_unref(create_contact->contact);
- g_free(create_contact);
+ g_object_unref (create_contact->ebews);
+ g_object_unref (create_contact->contact);
+ g_free (create_contact);
g_clear_error (&error);
}
static void
-e_book_backend_ews_create_contacts (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable,
- const GSList *vcards)
+e_book_backend_ews_create_contacts (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable,
+ const GSList *vcards)
{
EContact *contact = NULL;
EBookBackendEws *ebews;
EwsCreateContact *create_contact;
EBookBackendEwsPrivate *priv;
-
+
if (vcards->next != NULL) {
e_data_book_respond_create_contacts (book, opid,
- EDB_ERROR_EX (NOT_SUPPORTED,
- _("The backend does not support bulk additions")),
- NULL);
+ EDB_ERROR_EX (NOT_SUPPORTED,
+ _("The backend does not support bulk additions")),
+ NULL);
return;
}
@@ -856,18 +927,18 @@ e_book_backend_ews_create_contacts (EBookBackend *backend,
}
contact = e_contact_new_from_vcard (vcards->data);
-
+
if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
g_object_unref (contact);
e_data_book_respond_create_contacts (book, opid, EDB_ERROR (NOT_SUPPORTED), NULL);
return;
}
- create_contact = g_new0(EwsCreateContact, 1);
- create_contact->ebews = g_object_ref(ebews);
- create_contact->book = g_object_ref(book);
+ create_contact = g_new0 (EwsCreateContact, 1);
+ create_contact->ebews = g_object_ref (ebews);
+ create_contact->book = g_object_ref (book);
create_contact->opid = opid;
- create_contact->contact = g_object_ref(contact);
+ create_contact->contact = g_object_ref (contact);
/* pass new contact component data to the exchange server and expect response in the callback */
e_ews_connection_create_items_start (priv->cnc,
@@ -889,7 +960,9 @@ typedef struct {
} EwsRemoveContact;
static void
-ews_book_remove_contact_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_book_remove_contact_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EwsRemoveContact *remove_contact = user_data;
EBookBackendEws *ebews = remove_contact->ebews;
@@ -900,14 +973,14 @@ ews_book_remove_contact_cb (GObject *object, GAsyncResult *res, gpointer user_da
simple = G_SIMPLE_ASYNC_RESULT (res);
- if (!g_simple_async_result_propagate_error(simple, &error))
+ if (!g_simple_async_result_propagate_error (simple, &error))
deleted = e_book_backend_sqlitedb_remove_contacts (priv->ebsdb, priv->folder_id, remove_contact->sl_ids, &error);
if (deleted)
e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR (SUCCESS), remove_contact->sl_ids);
else {
e_data_book_respond_remove_contacts (remove_contact->book, remove_contact->opid, EDB_ERROR_EX (OTHER_ERROR, error->message), NULL);
-
+
g_warning ("\nError removing contact %s \n", error->message);
}
@@ -920,19 +993,19 @@ ews_book_remove_contact_cb (GObject *object, GAsyncResult *res, gpointer user_da
}
static void
-e_book_backend_ews_remove_contacts (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable,
- const GSList *id_list)
+e_book_backend_ews_remove_contacts (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable,
+ const GSList *id_list)
{
EBookBackendEws *ebews;
EwsRemoveContact *remove_contact;
EBookBackendEwsPrivate *priv;
GSList *l, *copy = NULL;
-
+
ebews = E_BOOK_BACKEND_EWS (backend);
-
+
priv = ebews->priv;
if (!priv->is_online) {
@@ -956,12 +1029,12 @@ e_book_backend_ews_remove_contacts (EBookBackend *backend,
}
for (l = (GSList *) id_list; l != NULL; l = g_slist_next (id_list))
- copy = g_slist_prepend (copy, g_strdup ((gchar *)l->data));
+ copy = g_slist_prepend (copy, g_strdup ((gchar *) l->data));
copy = g_slist_reverse (copy);
- remove_contact = g_new0(EwsRemoveContact, 1);
- remove_contact->ebews = g_object_ref(ebews);
- remove_contact->book = g_object_ref(book);
+ remove_contact = g_new0 (EwsRemoveContact, 1);
+ remove_contact->ebews = g_object_ref (ebews);
+ remove_contact->book = g_object_ref (book);
remove_contact->opid = opid;
remove_contact->sl_ids = copy;
@@ -980,7 +1053,9 @@ typedef struct {
} EwsModifyContact;
static void
-ews_modify_contact_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_modify_contact_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsModifyContact *modify_contact = user_data;
@@ -994,14 +1069,13 @@ ews_modify_contact_cb (GObject *object, GAsyncResult *res, gpointer user_data)
g_object_ref (modify_contact->new_contact);
g_object_ref (modify_contact->old_contact);
-
- e_ews_connection_update_items_finish(cnc, res, &items, &error);
+ e_ews_connection_update_items_finish (cnc, res, &items, &error);
if (error == NULL) {
EEwsItem *item = (EEwsItem *) items->data;
/* set item id */
- item_id = e_ews_item_get_id((EEwsItem *)items->data);
+ item_id = e_ews_item_get_id ((EEwsItem *) items->data);
e_contact_set (modify_contact->new_contact, E_CONTACT_UID, item_id->id);
e_contact_set (modify_contact->new_contact, E_CONTACT_REV, item_id->change_key);
@@ -1022,7 +1096,7 @@ ews_modify_contact_cb (GObject *object, GAsyncResult *res, gpointer user_data)
g_object_unref (item);
g_slist_free (items);
}
-
+
if (error) {
g_warning("Error while Modifying contact: %s", error->message);
@@ -1030,21 +1104,22 @@ ews_modify_contact_cb (GObject *object, GAsyncResult *res, gpointer user_data)
}
/* free memory allocated for create_contact & unref contained objects */
- g_object_unref(modify_contact->ebews);
- g_object_unref(modify_contact->new_contact);
- g_object_unref(modify_contact->old_contact);
- g_free(modify_contact);
+ g_object_unref (modify_contact->ebews);
+ g_object_unref (modify_contact->new_contact);
+ g_object_unref (modify_contact->old_contact);
+ g_free (modify_contact);
g_clear_error (&error);
}
static void
-convert_contact_to_updatexml (ESoapMessage *msg, gpointer user_data)
+convert_contact_to_updatexml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsModifyContact *modify_contact = user_data;
EwsId *id;
EContact *old_contact = modify_contact->old_contact;
EContact *new_contact = modify_contact->new_contact;
- gchar *value = NULL, *old_value = NULL ;
+ gchar *value = NULL, *old_value = NULL;
gint i, element_type;
id = g_new0 (EwsId, 1);
@@ -1052,7 +1127,7 @@ convert_contact_to_updatexml (ESoapMessage *msg, gpointer user_data)
id->change_key = e_contact_get (old_contact, E_CONTACT_REV);
e_ews_message_start_item_change (msg, E_EWS_ITEMCHANGE_TYPE_ITEM,
- id->id, id->change_key, 0);
+ id->id, id->change_key, 0);
/*Iterate for each field in contact*/
@@ -1061,28 +1136,28 @@ convert_contact_to_updatexml (ESoapMessage *msg, gpointer user_data)
if (element_type == ELEMENT_TYPE_SIMPLE) {
value = e_contact_get (new_contact, mappings[i].field_id);
old_value = e_contact_get (old_contact, mappings[i].field_id);
- if ((value && !old_value) || (!value && old_value) ||(value && old_value && g_ascii_strcasecmp(value, old_value)))
+ if ((value && !old_value) || (!value && old_value) ||(value && old_value && g_ascii_strcasecmp (value, old_value)))
convert_contact_property_to_updatexml(msg, mappings[i].element_name, value, "contacts", NULL, NULL);
if (value)
- g_free(value);
+ g_free (value);
if (old_value)
- g_free(old_value);
+ g_free (old_value);
} else if (element_type == ELEMENT_TYPE_COMPLEX) {
- if (mappings [i].field_id == E_CONTACT_UID)
+ if (mappings[i].field_id == E_CONTACT_UID)
continue;
mappings[i].set_changes (msg, new_contact, old_contact);
}
}
-
+
e_ews_message_end_item_change (msg);
}
static void
-e_book_backend_ews_modify_contacts (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable,
- const GSList *vcards)
+e_book_backend_ews_modify_contacts (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable,
+ const GSList *vcards)
{
EContact *contact = NULL, *old_contact;
EwsModifyContact *modify_contact;
@@ -1093,9 +1168,9 @@ e_book_backend_ews_modify_contacts (EBookBackend *backend,
if (vcards->next != NULL) {
e_data_book_respond_modify_contacts (book, opid,
- EDB_ERROR_EX (NOT_SUPPORTED,
+ EDB_ERROR_EX (NOT_SUPPORTED,
_("The backend does not support bulk modifications")),
- NULL);
+ NULL);
return;
}
@@ -1116,12 +1191,12 @@ e_book_backend_ews_modify_contacts (EBookBackend *backend,
e_data_book_respond_modify_contacts (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
return;
}
-
+
if (!priv->is_writable) {
e_data_book_respond_modify_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
return;
}
-
+
contact = e_contact_new_from_vcard (vcards->data);
id = g_new0 (EwsId, 1);
@@ -1137,7 +1212,7 @@ e_book_backend_ews_modify_contacts (EBookBackend *backend,
}
old_contact = e_book_backend_sqlitedb_get_contact ( priv->ebsdb, priv->folder_id,
- id->id, NULL, NULL, &error);
+ id->id, NULL, NULL, &error);
if (!old_contact) {
g_object_unref (contact);
e_data_book_respond_modify_contacts (book, opid, EDB_ERROR (NOT_SUPPORTED), NULL);
@@ -1146,11 +1221,11 @@ e_book_backend_ews_modify_contacts (EBookBackend *backend,
/* TODO implement */
modify_contact = g_new0 (EwsModifyContact, 1);
- modify_contact->ebews = g_object_ref(ebews);
- modify_contact->book = g_object_ref(book);
+ modify_contact->ebews = g_object_ref (ebews);
+ modify_contact->book = g_object_ref (book);
modify_contact->opid = opid;
- modify_contact->old_contact = g_object_ref(old_contact);
- modify_contact->new_contact = g_object_ref(contact);
+ modify_contact->old_contact = g_object_ref (old_contact);
+ modify_contact->new_contact = g_object_ref (contact);
e_ews_connection_update_items_start (priv->cnc, EWS_PRIORITY_MEDIUM,
"AlwaysOverwrite", "SendAndSaveCopy",
"SendToAllAndSaveCopy", priv->folder_id,
@@ -1160,11 +1235,11 @@ e_book_backend_ews_modify_contacts (EBookBackend *backend,
}
static void
-e_book_backend_ews_get_contact (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable,
- const gchar *id)
+e_book_backend_ews_get_contact (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable,
+ const gchar *id)
{
EBookBackendEws *ebews;
@@ -1183,11 +1258,11 @@ e_book_backend_ews_get_contact (EBookBackend *backend,
}
static void
-e_book_backend_ews_get_contact_list (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable,
- const gchar *query )
+e_book_backend_ews_get_contact_list (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable,
+ const gchar *query)
{
GSList *vcard_list = NULL;
GSList *list, *l;
@@ -1197,7 +1272,7 @@ e_book_backend_ews_get_contact_list (EBookBackend *backend,
ebews = E_BOOK_BACKEND_EWS (backend);
priv = ebews->priv;
-
+
if (!priv->is_online) {
if (e_book_backend_sqlitedb_get_is_populated (priv->ebsdb, priv->folder_id, NULL)) {
list = e_book_backend_sqlitedb_search (priv->ebsdb, priv->folder_id, query, NULL, NULL, NULL, &error);
@@ -1210,7 +1285,7 @@ e_book_backend_ews_get_contact_list (EBookBackend *backend,
l = l->next;
}
e_data_book_respond_get_contact_list (book, opid, error, vcard_list);
-
+
g_slist_free (list);
g_slist_foreach (vcard_list, (GFunc) g_free, NULL);
g_slist_free (vcard_list);
@@ -1237,26 +1312,26 @@ e_book_backend_ews_get_contact_list (EBookBackend *backend,
}
e_data_book_respond_get_contact_list (book, opid, error, vcard_list);
-
+
g_slist_free (list);
g_slist_foreach (vcard_list, (GFunc) g_free, NULL);
g_slist_free (vcard_list);
return;
} else if (!priv->marked_for_offline) {
- GSList *items=NULL;
- EwsFolderId *fid=NULL;
+ GSList *items = NULL;
+ EwsFolderId *fid = NULL;
gboolean includes_last_item;
fid = g_new0 (EwsFolderId, 1);
fid->id = g_strdup (priv->folder_id);
fid->is_distinguished_id = FALSE;
-
+
e_ews_connection_find_folder_items (priv->cnc, EWS_PRIORITY_MEDIUM,
fid, "IdOnly", NULL, NULL, query,
EWS_FOLDER_TYPE_CONTACTS,
&includes_last_item,
- &items, (EwsConvertQueryCallback) (e_ews_query_to_restriction),
+ &items, (EwsConvertQueryCallback) (e_ews_query_to_restriction),
NULL, &error);
/*we have got Id for items lets fetch them using getitem operation*/
@@ -1282,7 +1357,10 @@ typedef struct {
} EBookBackendEwsSExpData;
static ESExpResult *
-func_not (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
+func_not (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -1298,7 +1376,10 @@ func_not (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
}
static ESExpResult *
-func_and_or (ESExp *f, gint argc, ESExpResult **argv, gpointer and)
+func_and_or (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer and)
{
ESExpResult *r;
@@ -1310,7 +1391,10 @@ func_and_or (ESExp *f, gint argc, ESExpResult **argv, gpointer and)
/* TODO implement */
static ESExpResult *
-func_is (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
+func_is (struct _ESExp *f,
+ gint argc,
+ struct _ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
EBookBackendEwsSExpData *sdata = data;
@@ -1331,7 +1415,10 @@ func_is (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
/* TODO implement */
static ESExpResult *
-func_endswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
+func_endswith (struct _ESExp *f,
+ gint argc,
+ struct _ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
EBookBackendEwsSExpData *sdata = data;
@@ -1353,7 +1440,10 @@ func_endswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
/* TODO implement */
static ESExpResult *
-func_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
+func_contains (struct _ESExp *f,
+ gint argc,
+ struct _ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
EBookBackendEwsSExpData *sdata = data;
@@ -1374,9 +1464,12 @@ func_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer
}
/* We are just handling for autocompletion now. We need to support other fields after implementing
- Restrictions and find_items request */
+ * Restrictions and find_items request */
static ESExpResult *
-func_beginswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
+func_beginswith (struct _ESExp *f,
+ gint argc,
+ struct _ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
gchar *propname, *str;
@@ -1420,7 +1513,9 @@ static struct {
/* FIXME build a complete filter from the query that can be used by find_items */
static gpointer
-e_book_backend_ews_build_restriction (const gchar *query, gboolean *autocompletion, gchar **auto_comp_str)
+e_book_backend_ews_build_restriction (const gchar *query,
+ gboolean *autocompletion,
+ gchar **auto_comp_str)
{
ESExpResult *r;
ESExp *sexp;
@@ -1456,9 +1551,10 @@ e_book_backend_ews_build_restriction (const gchar *query, gboolean *autocompleti
/************* GAL sync ***********************/
-
static gboolean
-ews_gal_needs_update (EBookBackendEws *cbews, EwsOALDetails *full, GError **error)
+ews_gal_needs_update (EBookBackendEws *cbews,
+ EwsOALDetails *full,
+ GError **error)
{
EBookBackendEwsPrivate *priv = cbews->priv;
guint32 seq;
@@ -1472,15 +1568,18 @@ ews_gal_needs_update (EBookBackendEws *cbews, EwsOALDetails *full, GError **erro
sscanf (tmp, "%"G_GUINT32_FORMAT, &seq);
if (seq < full->seq)
ret = TRUE;
-
+
d(printf ("Gal needs update: %d \n", ret);)
exit:
g_free (tmp);
- return ret;
+ return ret;
}
static gchar *
-ews_download_full_gal (EBookBackendEws *cbews, EwsOALDetails *full, GCancellable *cancellable, GError **error)
+ews_download_full_gal (EBookBackendEws *cbews,
+ EwsOALDetails *full,
+ GCancellable *cancellable,
+ GError **error)
{
EBookBackendEwsPrivate *priv = cbews->priv;
EEwsConnection *oab_cnc;
@@ -1508,7 +1607,7 @@ ews_download_full_gal (EBookBackendEws *cbews, EwsOALDetails *full, GCancellable
d(g_print ("OAL file decompressed %s \n", uncompress_file);)
-exit:
+exit:
if (comp_cache_file)
g_unlink (comp_cache_file);
g_object_unref (oab_cnc);
@@ -1521,7 +1620,8 @@ exit:
}
static gboolean
-ews_remove_old_gal_file (EBookBackendEws *cbews, GError **error)
+ews_remove_old_gal_file (EBookBackendEws *cbews,
+ GError **error)
{
EBookBackendEwsPrivate *priv = cbews->priv;
gchar *filename;
@@ -1532,7 +1632,7 @@ ews_remove_old_gal_file (EBookBackendEws *cbews, GError **error)
if (filename)
g_unlink (filename);
-
+
return TRUE;
}
@@ -1543,7 +1643,11 @@ struct _db_data {
};
static void
-ews_gal_store_contact (EContact *contact, goffset offset, guint percent, gpointer user_data, GError **error)
+ews_gal_store_contact (EContact *contact,
+ goffset offset,
+ guint percent,
+ gpointer user_data,
+ GError **error)
{
struct _db_data *data = (struct _db_data *) user_data;
EBookBackendEwsPrivate *priv = data->cbews->priv;
@@ -1553,7 +1657,7 @@ ews_gal_store_contact (EContact *contact, goffset offset, guint percent, gpointe
if (data->collected_length == 1000 || percent >= 100) {
GSList *l;
- gchar *status_message=NULL;
+ gchar *status_message = NULL;
EDataBookView *book_view = e_book_backend_ews_utils_get_book_view (E_BOOK_BACKEND (data->cbews));
d(g_print ("GAL adding contacts, percent complete : %d \n", percent);)
@@ -1583,7 +1687,10 @@ ews_gal_store_contact (EContact *contact, goffset offset, guint percent, gpointe
}
static gboolean
-ews_replace_gal_in_db (EBookBackendEws *cbews, const gchar *filename, GCancellable *cancellable, GError **error)
+ews_replace_gal_in_db (EBookBackendEws *cbews,
+ const gchar *filename,
+ GCancellable *cancellable,
+ GError **error)
{
EBookBackendEwsPrivate *priv = cbews->priv;
EwsOabDecoder *eod;
@@ -1620,7 +1727,7 @@ ews_replace_gal_in_db (EBookBackendEws *cbews, const gchar *filename, GCancellab
}
static gboolean
-ebews_start_gal_sync (gpointer data)
+ebews_start_gal_sync (gpointer data)
{
EBookBackendEws *cbews;
EBookBackendEwsPrivate *priv;
@@ -1645,11 +1752,11 @@ ebews_start_gal_sync (gpointer data)
goto exit;
}
- full = (EwsOALDetails *) full_l->data;
+ full = (EwsOALDetails *) full_l->data;
/* TODO fetch differential updates if available instead of downloading the whole GAL */
if (!e_book_backend_sqlitedb_get_is_populated (priv->ebsdb, priv->folder_id, NULL) || ews_gal_needs_update (cbews, full, &error)) {
gchar *seq;
-
+
d(printf ("Ewsgal: Downloading full gal \n");)
uncompressed_filename = ews_download_full_gal (cbews, full, cancellable, &error);
if (error) {
@@ -1668,19 +1775,19 @@ ebews_start_gal_sync (gpointer data)
ret = ews_replace_gal_in_db (cbews, uncompressed_filename, cancellable, &error);
if (!ret)
goto exit;
-
+
seq = g_strdup_printf ("%"G_GUINT32_FORMAT, full->seq);
ret = e_book_backend_sqlitedb_set_key_value (priv->ebsdb, priv->folder_id, "seq", seq, &error);
g_free (seq);
-
+
if (!ret) {
e_book_backend_sqlitedb_delete_addressbook (priv->ebsdb, priv->folder_id, &error);
goto exit;
}
}
-
+
d(printf ("Ews gal: sync successfull complete \n");)
-
+
exit:
if (error) {
g_warning ("Unable to update gal : %s \n", error->message);
@@ -1713,7 +1820,9 @@ exit:
* @error: cannot be NULL
**/
static void
-ebews_sync_deleted_items (EBookBackendEws *ebews, GSList *deleted_ids, GError **error)
+ebews_sync_deleted_items (EBookBackendEws *ebews,
+ GSList *deleted_ids,
+ GError **error)
{
GSList *l;
EBookBackendEwsPrivate *priv;
@@ -1723,7 +1832,7 @@ ebews_sync_deleted_items (EBookBackendEws *ebews, GSList *deleted_ids, GError **
for (l = deleted_ids; l != NULL; l = g_slist_next (l)) {
gchar *id = (gchar *) l->data;
gboolean partial_content;
-
+
if (e_book_backend_sqlitedb_has_contact (priv->ebsdb, priv->folder_id, id, &partial_content, NULL))
e_book_backend_sqlitedb_remove_contact (priv->ebsdb, priv->folder_id, id, error);
e_book_backend_notify_remove (E_BOOK_BACKEND (ebews), id);
@@ -1733,20 +1842,22 @@ ebews_sync_deleted_items (EBookBackendEws *ebews, GSList *deleted_ids, GError **
g_slist_free (deleted_ids);
}
-
static void
-ebews_store_contact_items (EBookBackendEws *ebews, GSList *new_items, gboolean distribution_list, GError **error)
+ebews_store_contact_items (EBookBackendEws *ebews,
+ GSList *new_items,
+ gboolean distribution_list,
+ GError **error)
{
EBookBackendEwsPrivate *priv;
GSList *l;
-
+
priv = ebews->priv;
for (l = new_items; l != NULL; l = g_slist_next (l)) {
EContact *contact;
gint i, element_type;
EEwsItem *item;
-
+
item = (EEwsItem *) l->data;
contact = e_contact_new ();
@@ -1754,11 +1865,11 @@ ebews_store_contact_items (EBookBackendEws *ebews, GSList *new_items, gboolean d
for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
element_type = mappings[i].element_type;
- if (element_type == ELEMENT_TYPE_SIMPLE && !mappings [i].populate_contact_func) {
- const char *val = mappings [i].get_simple_prop_func (item);
+ if (element_type == ELEMENT_TYPE_SIMPLE && !mappings[i].populate_contact_func) {
+ const gchar *val = mappings[i].get_simple_prop_func (item);
if (val != NULL)
- e_contact_set (contact, mappings [i].field_id, val);
+ e_contact_set (contact, mappings[i].field_id, val);
} else
mappings[i].populate_contact_func (contact, item);
}
@@ -1768,17 +1879,17 @@ ebews_store_contact_items (EBookBackendEws *ebews, GSList *new_items, gboolean d
e_book_backend_sqlitedb_add_contact (priv->ebsdb, priv->folder_id, contact, FALSE, error);
e_book_backend_notify_update (E_BOOK_BACKEND (ebews), contact);
-
+
g_object_unref (item);
g_object_unref (contact);
}
-
g_slist_free (new_items);
}
static void
-ebews_get_vcards_list (GSList *new_items, GSList **vcards)
+ebews_get_vcards_list (GSList *new_items,
+ GSList **vcards)
{
GSList *l;
@@ -1786,17 +1897,17 @@ ebews_get_vcards_list (GSList *new_items, GSList **vcards)
EContact *contact;
gint i, element_type;
EEwsItem *item;
- gchar *vcard_string=NULL;
-
+ gchar *vcard_string = NULL;
+
item = (EEwsItem *) l->data;
contact = e_contact_new ();
for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
element_type = mappings[i].element_type;
- if (element_type == ELEMENT_TYPE_SIMPLE && !mappings [i].populate_contact_func) {
- const char *val = mappings [i].get_simple_prop_func (item);
+ if (element_type == ELEMENT_TYPE_SIMPLE && !mappings[i].populate_contact_func) {
+ const gchar *val = mappings[i].get_simple_prop_func (item);
if (val != NULL)
- e_contact_set (contact, mappings [i].field_id, val);
+ e_contact_set (contact, mappings[i].field_id, val);
} else
mappings[i].populate_contact_func (contact, item);
}
@@ -1815,7 +1926,7 @@ ews_mb_free (EwsMailbox *mb)
if (mb) {
g_free (mb->name);
g_free (mb->email);
-
+
if (mb->item_id) {
g_free (mb->item_id->id);
g_free (mb->item_id->change_key);
@@ -1827,7 +1938,11 @@ ews_mb_free (EwsMailbox *mb)
}
static void
-ebews_store_distribution_list_items (EBookBackendEws *ebews, const EwsId *id, const gchar *d_name, GSList *members, GError **error)
+ebews_store_distribution_list_items (EBookBackendEws *ebews,
+ const EwsId *id,
+ const gchar *d_name,
+ GSList *members,
+ GError **error)
{
GSList *l;
EContact *contact;
@@ -1835,7 +1950,7 @@ ebews_store_distribution_list_items (EBookBackendEws *ebews, const EwsId *id, co
contact = e_contact_new ();
e_contact_set (contact, E_CONTACT_UID, id->id);
e_contact_set (contact, E_CONTACT_REV, id->change_key);
-
+
e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE));
e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES, GINT_TO_POINTER (TRUE));
e_contact_set (contact, E_CONTACT_FULL_NAME, d_name);
@@ -1862,7 +1977,7 @@ ebews_store_distribution_list_items (EBookBackendEws *ebews, const EwsId *id, co
e_vcard_add_attribute (E_VCARD (contact), attr);
ews_mb_free (mb);
}
-
+
g_slist_free (members);
e_book_backend_sqlitedb_add_contact (ebews->priv->ebsdb, ebews->priv->folder_id, contact, FALSE, error);
e_book_backend_notify_update (E_BOOK_BACKEND (ebews), contact);
@@ -1871,16 +1986,19 @@ ebews_store_distribution_list_items (EBookBackendEws *ebews, const EwsId *id, co
}
static void
-ebews_vcards_append_dl (const EwsId *id, const gchar *d_name, GSList *members, GSList **vcards)
+ebews_vcards_append_dl (const EwsId *id,
+ const gchar *d_name,
+ GSList *members,
+ GSList **vcards)
{
GSList *l;
EContact *contact;
- gchar *vcard_string=NULL;
+ gchar *vcard_string = NULL;
contact = e_contact_new ();
e_contact_set (contact, E_CONTACT_UID, id->id);
e_contact_set (contact, E_CONTACT_REV, id->change_key);
-
+
e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE));
e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES, GINT_TO_POINTER (TRUE));
e_contact_set (contact, E_CONTACT_FULL_NAME, d_name);
@@ -1914,9 +2032,12 @@ ebews_vcards_append_dl (const EwsId *id, const gchar *d_name, GSList *members, G
g_object_unref (contact);
}
-
static gboolean
-ebews_fetch_items (EBookBackendEws *ebews, GSList *items, gboolean store_to_cache, GSList **vcards, GError **error)
+ebews_fetch_items (EBookBackendEws *ebews,
+ GSList *items,
+ gboolean store_to_cache,
+ GSList **vcards,
+ GError **error)
{
EBookBackendEwsPrivate *priv;
EEwsConnection *cnc;
@@ -1986,7 +2107,7 @@ ebews_fetch_items (EBookBackendEws *ebews, GSList *items, gboolean store_to_cach
/* expand dl */
if (*error)
goto cleanup;
-
+
d_name = e_ews_item_get_subject (item);
e_ews_connection_expand_dl (cnc, EWS_PRIORITY_MEDIUM, mb, &members, &includes_last, NULL, error);
if (*error)
@@ -1996,7 +2117,7 @@ ebews_fetch_items (EBookBackendEws *ebews, GSList *items, gboolean store_to_cach
ebews_store_distribution_list_items (ebews, id, d_name, members, error);
else
ebews_vcards_append_dl (id, d_name, members, vcards);
-
+
g_free (mb);
if (*error)
@@ -2013,7 +2134,7 @@ cleanup:
g_slist_foreach (dl_ids, (GFunc) g_free, NULL);
g_slist_free (dl_ids);
}
-
+
if (contact_item_ids) {
g_slist_foreach (contact_item_ids, (GFunc) g_free, NULL);
g_slist_free (contact_item_ids);
@@ -2023,7 +2144,7 @@ cleanup:
}
static gboolean
-ebews_start_sync (gpointer data)
+ebews_start_sync (gpointer data)
{
EBookBackendEws *ebews;
EBookBackendEwsPrivate *priv;
@@ -2112,7 +2233,7 @@ delta_thread (gpointer data)
while (TRUE) {
gboolean succeeded;
-
+
if (!priv->is_gal)
succeeded = ebews_start_sync (ebews);
else
@@ -2180,7 +2301,10 @@ ebews_start_refreshing (EBookBackendEws *ebews)
}
static void
-fetch_from_offline (EBookBackendEws *ews, EDataBookView *book_view, const gchar *query, GError *error)
+fetch_from_offline (EBookBackendEws *ews,
+ EDataBookView *book_view,
+ const gchar *query,
+ GError *error)
{
GSList *contacts, *l;
EBookBackendEwsPrivate *priv;
@@ -2211,8 +2335,8 @@ fetch_from_offline (EBookBackendEws *ews, EDataBookView *book_view, const gchar
}
static void
-e_book_backend_ews_start_book_view (EBookBackend *backend,
- EDataBookView *book_view)
+e_book_backend_ews_start_book_view (EBookBackend *backend,
+ EDataBookView *book_view)
{
EBookBackendEws *ebews;
EBookBackendEwsPrivate *priv;
@@ -2275,16 +2399,16 @@ e_book_backend_ews_start_book_view (EBookBackend *backend,
cancellable = g_cancellable_new ();
/* FIXME Need to convert the Ids from EwsLegacyId format to EwsId format using
- convert_id operation before using it as the schema has changed between Exchange
- 2007 and 2007_SP1 */
+ * convert_id operation before using it as the schema has changed between Exchange
+ * 2007 and 2007_SP1 */
fid = g_new0 (EwsFolderId, 1);
fid->id = g_strdup (priv->folder_id);
fid->change_key = e_source_get_duped_property (source, "change-key");
ids = g_slist_append (ids, fid);
/* We do not scan until we reach the last_item as it might be good enough to show first 100
- items during auto-completion. Change it if needed. TODO, Personal Address-book should start using
- find_items rather than resolve_names to support all queries */
+ * items during auto-completion. Change it if needed. TODO, Personal Address-book should start using
+ * find_items rather than resolve_names to support all queries */
g_hash_table_insert (priv->ops, book_view, cancellable);
e_ews_connection_resolve_names (priv->cnc, EWS_PRIORITY_MEDIUM, auto_comp_str,
EWS_SEARCH_AD, NULL, TRUE, &mailboxes, &contacts,
@@ -2349,8 +2473,8 @@ e_book_backend_ews_start_book_view (EBookBackend *backend,
}
static void
-e_book_backend_ews_stop_book_view (EBookBackend *backend,
- EDataBookView *book_view)
+e_book_backend_ews_stop_book_view (EBookBackend *backend,
+ EDataBookView *book_view)
{
EBookBackendEws *bews = E_BOOK_BACKEND_EWS (backend);
EBookBackendEwsPrivate *priv = bews->priv;
@@ -2364,10 +2488,10 @@ e_book_backend_ews_stop_book_view (EBookBackend *backend,
}
static void
-e_book_backend_ews_load_source (EBookBackend *backend,
- ESource *source,
- gboolean only_if_exists,
- GError **perror)
+e_book_backend_ews_load_source (EBookBackend *backend,
+ ESource *source,
+ gboolean only_if_exists,
+ GError **perror)
{
EBookBackendEws *cbews;
EBookBackendEwsPrivate *priv;
@@ -2382,7 +2506,7 @@ e_book_backend_ews_load_source (EBookBackend *backend,
cache_dir = e_book_backend_get_cache_dir (backend);
email = e_source_get_property (source, "email");
is_gal = e_source_get_property (source, "gal");
-
+
if (is_gal && !strcmp (is_gal, "1"))
priv->is_gal = TRUE;
@@ -2401,7 +2525,7 @@ e_book_backend_ews_load_source (EBookBackend *backend,
priv->marked_for_offline = TRUE;
} else {
priv->folder_id = e_source_get_duped_property (source, "oal_id");
-
+
/* If folder_id is present it means the GAL is marked for offline usage, we do not check for offline_sync property */
if (priv->folder_id) {
priv->folder_name = g_strdup (e_source_peek_name (source));
@@ -2420,23 +2544,22 @@ e_book_backend_ews_load_source (EBookBackend *backend,
priv->is_writable = FALSE;
}
}
-
+
if (priv->is_online) {
e_backend_set_online (E_BACKEND (backend), TRUE);
- e_book_backend_notify_auth_required(backend, TRUE, NULL);
+ e_book_backend_notify_auth_required (backend, TRUE, NULL);
}
}
static void
-e_book_backend_ews_remove (EBookBackend *backend,
- EDataBook *book,
- guint32 opid,
- GCancellable *cancellable)
+e_book_backend_ews_remove (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid,
+ GCancellable *cancellable)
{
e_data_book_respond_remove (book, opid, EDB_ERROR (SUCCESS));
}
-
static void
e_book_backend_ews_authenticate_user (EBookBackend *backend,
GCancellable *cancellable,
@@ -2470,13 +2593,13 @@ e_book_backend_ews_authenticate_user (EBookBackend *backend,
host_url = e_source_get_property (esource, "hosturl");
read_only = e_source_get_property (esource, "read_only");
- cnc = e_ews_connection_new (host_url, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME),
+ cnc = e_ews_connection_new (host_url, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME),
e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD),
NULL, NULL, &error);
if ((read_only && !strcmp (read_only, "true")) || priv->is_gal) {
priv->is_writable = FALSE;
- } else
+ } else
priv->is_writable = TRUE;
/* a dummy request to make sure we have a authenticated connection */
@@ -2503,11 +2626,11 @@ e_book_backend_ews_authenticate_user (EBookBackend *backend,
e_book_backend_notify_opened (backend, EDB_ERROR (SUCCESS));
e_book_backend_notify_readonly (backend, !priv->is_writable);
-}
+}
static void
e_book_backend_ews_notify_online_cb (EBookBackend *backend,
- GParamSpec *spec)
+ GParamSpec *spec)
{
EBookBackendEws *ebews;
gboolean is_online;
@@ -2538,7 +2661,7 @@ e_book_backend_ews_notify_online_cb (EBookBackend *backend,
}
static void
-e_book_backend_ews_get_backend_property (EBookBackend *backend,
+e_book_backend_ews_get_backend_property (EBookBackend *backend,
EDataBook *book,
guint32 opid,
GCancellable *cancellable,
@@ -2560,7 +2683,7 @@ e_book_backend_ews_get_backend_property (EBookBackend *backend,
gint i;
for (i = 0; i < G_N_ELEMENTS (mappings); i++)
- if (mappings [i].element_type == ELEMENT_TYPE_SIMPLE)
+ if (mappings[i].element_type == ELEMENT_TYPE_SIMPLE)
fields = g_slist_append (fields, g_strdup (e_contact_field_name (mappings[i].field_id)));
for (i = 0; i < G_N_ELEMENTS (phone_field_map); i++)
@@ -2605,7 +2728,6 @@ e_book_backend_ews_open (EBookBackend *backend,
e_data_book_respond_open (book, opid, error);
}
-
/**
* e_book_backend_ews_new:
*/
@@ -2623,10 +2745,10 @@ static void
e_book_backend_ews_dispose (GObject *object)
{
EBookBackendEws *bgw;
- EBookBackendEwsPrivate *priv;
+ EBookBackendEwsPrivate *priv;
bgw = E_BOOK_BACKEND_EWS (object);
- priv = bgw->priv;
+ priv = bgw->priv;
if (priv->cnc) {
g_object_unref (priv->cnc);
@@ -2642,17 +2764,17 @@ e_book_backend_ews_dispose (GObject *object)
g_free (priv->oab_url);
priv->oab_url = NULL;
}
-
+
if (priv->folder_name) {
g_free (priv->folder_name);
priv->folder_name = NULL;
}
-
+
if (priv->username) {
g_free (priv->username);
priv->username = NULL;
}
-
+
if (priv->password) {
g_free (priv->password);
priv->password = NULL;
diff --git a/src/addressbook/e-book-backend-sqlitedb-test.c b/src/addressbook/e-book-backend-sqlitedb-test.c
index d87dc2c..2525268 100644
--- a/src/addressbook/e-book-backend-sqlitedb-test.c
+++ b/src/addressbook/e-book-backend-sqlitedb-test.c
@@ -63,12 +63,12 @@ const gchar *vcard_str =
static void
quit_tests (void)
{
-
+
if (error != NULL) {
g_print ("Tests failed: %s - %s \n", op, error->message);
g_clear_error (&error);
}
-
+
g_main_loop_quit (main_loop);
}
@@ -80,20 +80,22 @@ add_contacts (EBookBackendSqliteDB *ebsdb)
g_print ("Adding contact \n");
op = "add contact";
-
+
con = e_contact_new_from_vcard (vcard_str);
contacts = g_slist_append (contacts, con);
e_book_backend_sqlitedb_add_contacts (ebsdb, folderid, contacts, FALSE, &error);
-
+
g_object_unref (con);
}
static void
-search_db (EBookBackendSqliteDB *ebsdb, const gchar *type, const gchar *sexp)
+search_db (EBookBackendSqliteDB *ebsdb,
+ const gchar *type,
+ const gchar *sexp)
{
GSList *vcards;
EbSdbSearchData *s_data;
-
+
g_print ("%s - query: %s \n", type, sexp);
op = type;
vcards = e_book_backend_sqlitedb_search (ebsdb, folderid, sexp, NULL, NULL, NULL, &error);
@@ -117,7 +119,7 @@ start_tests (gpointer data)
g_print ("Creating the sqlitedb \n");
op = "create sqlitedb";
- ebsdb = e_book_backend_sqlitedb_new
+ ebsdb = e_book_backend_sqlitedb_new
(cache_path, email, folderid, folder_name,
store_vcard, &error);
if (error)
@@ -132,20 +134,20 @@ start_tests (gpointer data)
e_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 = e_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";
e_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 = e_book_backend_sqlitedb_get_vcard_string (ebsdb, folderid, uid, NULL, NULL, &error);
@@ -171,7 +173,7 @@ start_tests (gpointer data)
if (error)
goto exit;
}
-
+
g_print ("Delete contact \n");
op = "delete contact";
uids = g_slist_append (uids, (gchar *) uid);
@@ -183,15 +185,16 @@ start_tests (gpointer data)
g_print ("Delete addressbook \n");
op = "delete addressbook";
e_book_backend_sqlitedb_delete_addressbook (ebsdb, folderid, &error);
-
+
exit:
g_object_unref (ebsdb);
quit_tests ();
- return FALSE;
+ return FALSE;
}
gint
-main (gint argc, gchar *argv[])
+main (gint argc,
+ gchar *argv[])
{
g_type_init ();
diff --git a/src/addressbook/e-book-backend-sqlitedb.c b/src/addressbook/e-book-backend-sqlitedb.c
index 8142439..5f4983e 100644
--- a/src/addressbook/e-book-backend-sqlitedb.c
+++ b/src/addressbook/e-book-backend-sqlitedb.c
@@ -1141,7 +1141,10 @@ e_book_backend_sqlitedb_is_summary_query (const gchar *query)
}
static ESExpResult *
-func_and (ESExp *f, gint argc, struct _ESExpTerm **argv, gpointer data)
+func_and (ESExp *f,
+ gint argc,
+ struct _ESExpTerm **argv,
+ gpointer data)
{
ESExpResult *r, *r1;
GString *string;
@@ -2110,11 +2113,11 @@ e_book_backend_sqlitedb_search_data_free (EbSdbSearchData *s_data)
}
gboolean
-e_book_backend_sqlitedb_create_addressbook (EBookBackendSqliteDB *ebsdb,
- const gchar *folderid,
- const gchar *folder_name,
- gboolean store_vcard,
- GError **error)
+e_book_backend_sqlitedb_create_addressbook (EBookBackendSqliteDB *ebsdb,
+ const gchar *folderid,
+ const gchar *folder_name,
+ gboolean store_vcard,
+ GError **error)
{
GError *err = NULL;
gboolean ret = TRUE;
diff --git a/src/addressbook/ews-oab-decoder.c b/src/addressbook/ews-oab-decoder.c
index bf2260d..1811b1e 100644
--- a/src/addressbook/ews-oab-decoder.c
+++ b/src/addressbook/ews-oab-decoder.c
@@ -58,20 +58,25 @@ typedef struct {
} EwsDeferredSet;
static void
-ews_populate_simple_string (EContact *contact, EContactField field, gpointer value, gpointer user_data)
+ews_populate_simple_string (EContact *contact,
+ EContactField field,
+ gpointer value,
+ gpointer user_data)
{
const gchar *str = (const gchar *) value;
e_contact_set (contact, field, str);
}
static void
-ews_deffered_populate_physical_address (EwsDeferredSet *dset, guint32 prop_id, gpointer value)
+ews_deffered_populate_physical_address (EwsDeferredSet *dset,
+ guint32 prop_id,
+ gpointer value)
{
- gchar *val = g_strdup ((gchar *)value);
+ gchar *val = g_strdup ((gchar *) value);
if (!dset->addr)
dset->addr = g_new0 (EContactAddress, 1);
-
+
switch (prop_id) {
case EWS_PT_STREET_ADDRESS:
dset->addr->street = val;
@@ -95,13 +100,16 @@ ews_deffered_populate_physical_address (EwsDeferredSet *dset, guint32 prop_id, g
}
static void
-ews_populate_phone_numbers (EContact *contact, EContactField field, gpointer value, gpointer user_data)
+ews_populate_phone_numbers (EContact *contact,
+ EContactField field,
+ gpointer value,
+ gpointer user_data)
{
GSList *values = (GSList *) value;
gint i, len;
/* Just the two phone numbers from the list. it would be either business or home phone number. I don't
- see a cleaner way than this at the moment */
+ * see a cleaner way than this at the moment */
len = g_slist_length (values);
for (i = 0; i < 2 && i < len; i++) {
const gchar *val = g_slist_nth_data (values, i);
@@ -110,12 +118,14 @@ ews_populate_phone_numbers (EContact *contact, EContactField field, gpointer val
}
static void
-ews_populate_string_list (EContact *contact, EContactField field, gpointer value, gpointer user_data)
+ews_populate_string_list (EContact *contact,
+ EContactField field,
+ gpointer value,
+ gpointer user_data)
{
GSList *sl_values = (GSList *) value, *sl;
GList *l_values = NULL;
-
for (sl = sl_values; sl != NULL; sl = g_slist_next (sl)) {
const gchar *val = (gchar *) sl_values->data;
l_values = g_list_prepend (l_values, g_strdup (val));
@@ -128,7 +138,10 @@ ews_populate_string_list (EContact *contact, EContactField field, gpointer value
}
static void
-ews_populate_photo (EContact *contact, EContactField field, gpointer value, gpointer user_data)
+ews_populate_photo (EContact *contact,
+ EContactField field,
+ gpointer value,
+ gpointer user_data)
{
EwsOabDecoder *eod = EWS_OAB_DECODER (user_data);
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
@@ -139,17 +152,17 @@ ews_populate_photo (EContact *contact, EContactField field, gpointer value, gpoi
gboolean success = TRUE;
/* Rename the binary file to name.jpg */
- at = strchr(email, '@');
+ at = strchr (email, '@');
name = g_strndup (email, at - email);
pic_name = g_strconcat (name, ".jpg", NULL);
filename = g_build_filename (priv->cache_dir, pic_name, NULL);
-
+
if (g_file_test (filename, G_FILE_TEST_EXISTS))
g_unlink (val);
else {
if (g_rename (val, filename))
- success = FALSE;
+ success = FALSE;
}
if (success) {
@@ -172,7 +185,7 @@ static const struct prop_field_mapping {
EContactField field;
void (*populate_function) (EContact *contact, EContactField field, gpointer value, gpointer user_data);
void (*defered_populate_function) (EwsDeferredSet *dset, guint32 prop_id, gpointer value);
-} prop_map [] = {
+} prop_map[] = {
{EWS_PT_SMTP_ADDRESS, E_CONTACT_EMAIL_1, ews_populate_simple_string},
{EWS_PT_DISPLAY_NAME, E_CONTACT_FULL_NAME, ews_populate_simple_string},
{EWS_PT_ACCOUNT, E_CONTACT_NICKNAME, ews_populate_simple_string},
@@ -224,7 +237,7 @@ ews_oab_decoder_finalize (GObject *object)
g_slist_free (priv->oab_props);
priv->oab_props = NULL;
}
-
+
if (priv->hdr_props) {
g_slist_free (priv->hdr_props);
priv->hdr_props = NULL;
@@ -253,13 +266,13 @@ ews_oab_decoder_init (EwsOabDecoder *self)
priv->prop_index_dict = g_hash_table_new (g_direct_hash, g_direct_equal);
for (i = 1; i <= G_N_ELEMENTS (prop_map); i++)
- g_hash_table_insert (priv->prop_index_dict, GINT_TO_POINTER (prop_map[i-1].prop_id), GINT_TO_POINTER (i));
+ g_hash_table_insert (priv->prop_index_dict, GINT_TO_POINTER (prop_map[i - 1].prop_id), GINT_TO_POINTER (i));
}
-EwsOabDecoder*
-ews_oab_decoder_new (const gchar *oab_filename,
- const gchar *cache_dir,
- GError **error)
+EwsOabDecoder *
+ews_oab_decoder_new (const gchar *oab_filename,
+ const gchar *cache_dir,
+ GError **error)
{
EwsOabDecoder *eod;
EwsOabDecoderPrivate *priv;
@@ -273,7 +286,7 @@ ews_oab_decoder_new (const gchar *oab_filename,
priv->fis = g_file_read (gf, NULL, &err);
if (err)
goto exit;
-
+
priv->cache_dir = g_strdup (cache_dir);
exit:
@@ -303,20 +316,22 @@ ews_oab_decoder_error_quark (void)
/* endian-neutral reading of little-endian data */
#define __egi32(a,n) ( ((((guchar *) a)[n+3]) << 24) | \
- ((((guchar *) a)[n+2]) << 16) | \
- ((((guchar *) a)[n+1]) << 8) | \
- ((((guchar *) a)[n+0])))
+ ((((guchar *) a)[n + 2]) << 16) | \
+ ((((guchar *) a)[n + 1]) << 8) | \
+ ((((guchar *) a)[n + 0])))
#define EndGetI64(a) ((((guint64) __egi32(a,4)) << 32) | \
- ((guint) __egi32(a,0)))
+ ((guint) __egi32 (a,0)))
#define EndGetI32(a) __egi32(a,0)
#define EndGetI16(a) ((((a)[1])<<8)|((a)[0]))
static guint32
-ews_oab_read_uint32 (GInputStream *is, GCancellable *cancellable, GError **error)
+ews_oab_read_uint32 (GInputStream *is,
+ GCancellable *cancellable,
+ GError **error)
{
gchar *str = g_malloc0 (4);
guint32 ret = 0;
-
+
g_input_stream_read (is, str, 4, cancellable, error);
if (!*error)
ret = EndGetI32 (str);
@@ -326,11 +341,13 @@ ews_oab_read_uint32 (GInputStream *is, GCancellable *cancellable, GError **error
}
static guint16
-ews_oab_read_uint16 (GInputStream *is, GCancellable *cancellable, GError **error)
+ews_oab_read_uint16 (GInputStream *is,
+ GCancellable *cancellable,
+ GError **error)
{
gchar *str = g_malloc0 (2);
guint16 ret = 0;
-
+
g_input_stream_read (is, str, 2, cancellable, error);
if (!*error)
ret = EndGetI16 (str);
@@ -340,18 +357,23 @@ ews_oab_read_uint16 (GInputStream *is, GCancellable *cancellable, GError **error
}
static gint
-get_pos (const gchar *str, gsize len, gchar stop)
+get_pos (const gchar *str,
+ gsize len,
+ gchar stop)
{
gsize i = 0;
- while (i < len && str [i] != stop)
+ while (i < len && str[i] != stop)
i++;
return i;
}
/* Read upto the stop char include the same */
static gchar *
-ews_oab_read_upto (GInputStream *is, gchar stop, GCancellable *cancellable, GError **error)
+ews_oab_read_upto (GInputStream *is,
+ gchar stop,
+ GCancellable *cancellable,
+ GError **error)
{
gsize size = 50;
GString *str;
@@ -372,16 +394,16 @@ ews_oab_read_upto (GInputStream *is, gchar stop, GCancellable *cancellable, GErr
len = get_pos (c, size, stop);
if (len)
str = g_string_append_len (str, c, len);
-
+
if (len == 0 || len < size) {
goffset seek = (goffset) len + 1 - (goffset) size;
-
+
/* seek back */
g_seekable_seek ((GSeekable *) is, seek, G_SEEK_CUR, cancellable, error);
break;
}
-
- size *= 2;
+
+ size *= 2;
g_free (c);
} while (!*error);
@@ -395,7 +417,9 @@ typedef struct {
} EwsOabHdr;
static EwsOabHdr *
-ews_read_oab_header (EwsOabDecoder *eod, GCancellable *cancellable, GError **error)
+ews_read_oab_header (EwsOabDecoder *eod,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabHdr *o_hdr;
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
@@ -425,14 +449,16 @@ exit:
return o_hdr;
}
-
static gboolean
-ews_decode_hdr_props (EwsOabDecoder *eod, gboolean oab_hdrs, GCancellable *cancellable, GError **error)
+ews_decode_hdr_props (EwsOabDecoder *eod,
+ gboolean oab_hdrs,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
guint32 num_props, i;
GSList **props;
-
+
/* number of properties */
num_props = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
if (*error)
@@ -450,11 +476,11 @@ ews_decode_hdr_props (EwsOabDecoder *eod, gboolean oab_hdrs, GCancellable *cance
for (i = 0; i < num_props; i++) {
guint32 prop_id, flags;
-
+
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);
@@ -462,16 +488,18 @@ ews_decode_hdr_props (EwsOabDecoder *eod, gboolean oab_hdrs, GCancellable *cance
return FALSE;
/* skip store anr_index and primary key prop list as we will not be using it for online search,
- store if required later */
+ * store if required later */
}
-
+
*props = g_slist_reverse (*props);
- return TRUE;
+ return TRUE;
}
static gboolean
-ews_decode_metadata (EwsOabDecoder *eod, GCancellable *cancellable, GError **error)
+ews_decode_metadata (EwsOabDecoder *eod,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
gboolean ret = TRUE;
@@ -492,12 +520,13 @@ ews_decode_metadata (EwsOabDecoder *eod, GCancellable *cancellable, GError **err
}
static gboolean
-ews_is_bit_set (const gchar *str, guint32 pos)
+ews_is_bit_set (const gchar *str,
+ guint32 pos)
{
guint32 index, bit_pos;
- index = pos/8;
- bit_pos = pos & (8-1);
+ index = pos / 8;
+ bit_pos = pos & (8 - 1);
if ((str[index] << bit_pos) & 0x80)
return TRUE;
@@ -506,16 +535,18 @@ ews_is_bit_set (const gchar *str, guint32 pos)
}
static guint32
-ews_decode_uint32 (EwsOabDecoder *eod, GCancellable *cancellable, GError **error)
+ews_decode_uint32 (EwsOabDecoder *eod,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
guint8 first;
guint32 ret = 0, num;
-
+
g_input_stream_read (G_INPUT_STREAM (priv->fis), &first, 1, cancellable, error);
if (*error)
return ret;
-
+
if (first & 0x80)
num = first & 0x0F;
else
@@ -530,24 +561,26 @@ ews_decode_uint32 (EwsOabDecoder *eod, GCancellable *cancellable, GError **error
ret = ews_oab_read_uint16 (G_INPUT_STREAM (priv->fis), cancellable, error);
if (num == 3) {
gchar *tmp, *str = g_malloc0 (num + 1);
-
+
g_input_stream_read (G_INPUT_STREAM (priv->fis), str, num, cancellable, error);
/* not sure if its the right way to do, test it */
tmp = g_strconcat ("0", str, NULL);
sscanf (tmp, "%"G_GUINT32_FORMAT, &ret);
ret = GUINT32_SWAP_LE_BE (ret);
-
+
g_free (str);
g_free (tmp);
} else if (num == 4)
ret = ews_oab_read_uint32 (G_INPUT_STREAM (priv->fis), cancellable, error);
- return ret;
+ return ret;
}
static gchar *
-ews_decode_binary (EwsOabDecoder *eod, GCancellable *cancellable, GError **error)
+ews_decode_binary (EwsOabDecoder *eod,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
guint32 len;
@@ -557,7 +590,7 @@ ews_decode_binary (EwsOabDecoder *eod, GCancellable *cancellable, GError **error
len = ews_decode_uint32 (eod, cancellable, error);
if (*error)
return NULL;
-
+
binary = g_malloc (len);
g_input_stream_read (G_INPUT_STREAM (priv->fis), binary, len, cancellable, error);
if (*error)
@@ -575,8 +608,11 @@ exit:
return filename;
}
-static gpointer
-ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancellable, GError **error)
+static gpointer
+ews_decode_oab_prop (EwsOabDecoder *eod,
+ guint32 prop_id,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
guint32 prop_type;
@@ -588,13 +624,13 @@ ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancella
case EWS_PTYP_INTEGER32:
{
guint32 val;
-
+
val = ews_decode_uint32 (eod, cancellable, error);
ret_val = GUINT_TO_POINTER (val);
-
+
d(g_print ("prop id %X prop type: int32 value %d \n", prop_id, val);)
-
- break;
+
+ break;
}
case EWS_PTYP_BOOLEAN:
{
@@ -603,17 +639,17 @@ ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancella
g_input_stream_read (G_INPUT_STREAM (priv->fis), &val, 1, cancellable, error);
ret_val = GUINT_TO_POINTER ((guint) val);
d(g_print ("prop id %X prop type: bool value %d \n", prop_id, val);)
-
+
break;
}
case EWS_PTYP_STRING8:
case EWS_PTYP_STRING:
{
gchar *val;
-
+
val = ews_oab_read_upto (G_INPUT_STREAM (priv->fis), '\0', cancellable, error);
ret_val = (gpointer) val;
-
+
d(g_print ("prop id %X prop type: string value %s \n", prop_id, val);)
break;
}
@@ -645,7 +681,7 @@ ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancella
v = ews_decode_uint32 (eod, cancellable, error);
val = GUINT_TO_POINTER (v);
list = g_slist_prepend (list, val);
-
+
d(g_print ("prop id %X prop type: multi-int32 %d \n", prop_id, v);)
if (*error) {
g_slist_free (list);
@@ -671,7 +707,7 @@ ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancella
}
- break;
+ break;
}
default:
g_assert_not_reached ();
@@ -681,14 +717,15 @@ ews_decode_oab_prop (EwsOabDecoder *eod, guint32 prop_id, GCancellable *cancella
return ret_val;
}
-
static void
-ews_destroy_oab_prop (guint32 prop_id, gpointer val, gboolean delete_files)
+ews_destroy_oab_prop (guint32 prop_id,
+ gpointer val,
+ gboolean delete_files)
{
guint32 prop_type;
prop_type = prop_id & 0x0000FFFF;
-
+
switch (prop_type) {
case EWS_PTYP_INTEGER32:
case EWS_PTYP_BOOLEAN:
@@ -700,10 +737,10 @@ ews_destroy_oab_prop (guint32 prop_id, gpointer val, gboolean delete_files)
break;
case EWS_PTYP_MULTIPLEBINARY:
if (delete_files)
- g_slist_foreach ((GSList *)val, (GFunc) g_unlink, NULL);
+ g_slist_foreach ((GSList *) val, (GFunc) g_unlink, NULL);
case EWS_PTYP_MULTIPLESTRING8:
case EWS_PTYP_MULTIPLESTRING:
- g_slist_foreach ((GSList *)val, (GFunc) g_free, NULL);
+ g_slist_foreach ((GSList *) val, (GFunc) g_free, NULL);
case EWS_PTYP_MULTIPLEINTEGER32:
g_slist_free ((GSList *) val);
break;
@@ -728,7 +765,12 @@ ews_destroy_oab_prop (guint32 prop_id, gpointer val, gboolean delete_files)
* Returns:
**/
static gboolean
-ews_decode_addressbook_record (EwsOabDecoder *eod, EContact *contact, EwsDeferredSet *dset, GSList *props, GCancellable *cancellable, GError **error)
+ews_decode_addressbook_record (EwsOabDecoder *eod,
+ EContact *contact,
+ EwsDeferredSet *dset,
+ GSList *props,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
guint bit_array_size, i, len;
@@ -736,11 +778,11 @@ ews_decode_addressbook_record (EwsOabDecoder *eod, EContact *contact, EwsDeferre
gboolean ret = TRUE;
len = g_slist_length (props);
- bit_array_size = (guint) ceil (len/8.0);
+ bit_array_size = (guint) ceil (len / 8.0);
bit_str = g_malloc0 (bit_array_size);
g_input_stream_read (G_INPUT_STREAM (priv->fis), bit_str, bit_array_size, cancellable, error);
if (*error) {
- ret = FALSE;
+ ret = FALSE;
goto exit;
}
@@ -750,7 +792,7 @@ ews_decode_addressbook_record (EwsOabDecoder *eod, EContact *contact, EwsDeferre
if (!ews_is_bit_set (bit_str, i))
continue;
-
+
val = g_slist_nth_data (props, i);
prop_id = GPOINTER_TO_UINT (val);
@@ -761,14 +803,14 @@ ews_decode_addressbook_record (EwsOabDecoder *eod, EContact *contact, EwsDeferre
if (contact && index) {
gint i = GPOINTER_TO_INT (index);
- if (prop_map [i-1].populate_function)
- prop_map [i-1].populate_function (contact, prop_map[i-1].field, val, (gpointer) eod);
+ if (prop_map[i - 1].populate_function)
+ prop_map[i - 1].populate_function (contact, prop_map[i - 1].field, val, (gpointer) eod);
else
- prop_map [i-1].defered_populate_function (dset, prop_id, val);
+ prop_map[i - 1].defered_populate_function (dset, prop_id, val);
}
/* delete the binary file if we do not have the property in the index or if there
- was an error */
+ * was an error */
ews_destroy_oab_prop (prop_id, val, (*error || !index) ? TRUE : FALSE);
if (*error)
goto exit;
@@ -777,13 +819,17 @@ ews_decode_addressbook_record (EwsOabDecoder *eod, EContact *contact, EwsDeferre
exit:
if (bit_str)
g_free (bit_str);
-
+
return ret;
}
/* Decodes the hdr and address-book records and stores the address-book records inside the db */
static gboolean
-ews_decode_and_store_oab_records (EwsOabDecoder *eod, EwsOabContactAddedCb cb, gpointer user_data, GCancellable *cancellable, GError **error)
+ews_decode_and_store_oab_records (EwsOabDecoder *eod,
+ EwsOabContactAddedCb cb,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
gboolean ret = TRUE;
@@ -812,36 +858,36 @@ ews_decode_and_store_oab_records (EwsOabDecoder *eod, EwsOabContactAddedCb cb, g
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);
-
+
/* set the smtp address as contact's uid */
uid = (gchar *) e_contact_get (contact, E_CONTACT_EMAIL_1);
e_contact_set (contact, E_CONTACT_UID, uid);
- cb (contact, offset, ((gfloat) (i+1)/priv->total_records)*100, user_data, error);
+ 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));)
-
-error:
+
+error:
g_object_unref (contact);
e_contact_address_free (dset->addr);
g_free (dset);
g_free (uid);
if (*error) {
- ret = FALSE;
+ ret = FALSE;
goto exit;
}
}
-exit:
- return ret;
+exit:
+ return ret;
}
gchar *
-ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
- GError **error)
+ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
GString *str = g_string_new (NULL);
@@ -853,7 +899,7 @@ ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
}
/* 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 */
+ * 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);
@@ -868,9 +914,9 @@ ews_oab_decoder_get_oab_prop_string (EwsOabDecoder *eod,
}
gboolean
-ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
- const gchar *prop_str,
- GError **error)
+ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
+ const gchar *prop_str,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
gchar **vals;
@@ -889,7 +935,7 @@ ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
g_slist_free (priv->oab_props);
priv->oab_props = NULL;
}
-
+
for (i = 0; i < len; i++) {
guint32 prop_id;
@@ -915,12 +961,12 @@ ews_oab_decoder_set_oab_prop_string (EwsOabDecoder *eod,
* the properties in the sqlite db.
* Returns: TRUE if successfully decoded and indexed in db
**/
-gboolean
-ews_oab_decoder_decode (EwsOabDecoder *eod,
- EwsOabContactAddedCb cb,
- gpointer user_data,
- GCancellable *cancellable,
- GError **error)
+gboolean
+ews_oab_decoder_decode (EwsOabDecoder *eod,
+ EwsOabContactAddedCb cb,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
GError *err = NULL;
@@ -932,14 +978,14 @@ ews_oab_decoder_decode (EwsOabDecoder *eod,
ret = FALSE;
goto exit;
}
-
+
priv->total_records = o_hdr->total_recs;
g_print ("Total records is %d \n", priv->total_records);
ret = ews_decode_metadata (eod, cancellable, &err);
if (!ret)
goto exit;
-
+
ret = ews_decode_and_store_oab_records (eod, cb, user_data, cancellable, &err);
exit:
if (o_hdr)
@@ -948,15 +994,15 @@ exit:
if (err)
g_propagate_error (error, err);
- return ret;
+ return ret;
}
-EContact *
-ews_oab_decoder_get_contact_from_offset (EwsOabDecoder *eod,
- goffset offset,
- GSList *oab_props,
- GCancellable *cancellable,
- GError **error)
+EContact *
+ews_oab_decoder_get_contact_from_offset (EwsOabDecoder *eod,
+ goffset offset,
+ GSList *oab_props,
+ GCancellable *cancellable,
+ GError **error)
{
EwsOabDecoderPrivate *priv = GET_PRIVATE (eod);
EwsDeferredSet *dset;
@@ -972,10 +1018,10 @@ ews_oab_decoder_get_contact_from_offset (EwsOabDecoder *eod,
g_object_unref (contact);
contact = NULL;
}
-
+
e_contact_address_free (dset->addr);
g_free (dset);
-
+
return contact;
}
@@ -989,10 +1035,14 @@ struct _db_data {
};
static void
-ews_test_store_contact (EContact *contact, goffset offset, guint percent, gpointer user_data, GError **error)
+ews_test_store_contact (EContact *contact,
+ goffset offset,
+ guint percent,
+ gpointer user_data,
+ GError **error)
{
struct _db_data *data = (struct _db_data *) user_data;
-
+
data->contact_collector = g_slist_prepend (data->contact_collector, g_object_ref (contact));
data->collected_length += 1;
@@ -1008,8 +1058,9 @@ ews_test_store_contact (EContact *contact, goffset offset, guint percent, gpoint
}
}
-gint
-main (gint argc, gchar *argv [])
+gint
+main (gint argc,
+ gchar *argv[])
{
EBookBackendSqliteDB *ebsdb;
EwsOabDecoder *eod;
@@ -1025,7 +1076,7 @@ main (gint argc, gchar *argv [])
}
ebsdb = e_book_backend_sqlitedb_new (argv [2], "dum", "de", "dum", TRUE, NULL);
- eod = ews_oab_decoder_new (argv [1], argv [2], &err);
+ eod = ews_oab_decoder_new (argv[1], argv[2], &err);
data.contact_collector = NULL;
data.collected_length = 0;
diff --git a/src/addressbook/ews-oab-decoder.h b/src/addressbook/ews-oab-decoder.h
index 0f23972..d948966 100644
--- a/src/addressbook/ews-oab-decoder.h
+++ b/src/addressbook/ews-oab-decoder.h
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
#ifndef _EWS_OAB_DECODER
#define _EWS_OAB_DECODER
@@ -59,27 +58,27 @@ GType ews_oab_decoder_get_type (void);
typedef void (*EwsOabContactAddedCb) (EContact *contact, goffset offset, guint percent_complete, gpointer user_data, GError **error);
-EwsOabDecoder* ews_oab_decoder_new (const gchar *oab_filename,
- const gchar *cache_dir,
- GError **error);
-gboolean ews_oab_decoder_decode (EwsOabDecoder *eod,
- EwsOabContactAddedCb cb,
- gpointer user_data,
- GCancellable *cancellable,
- GError **error);
+EwsOabDecoder * ews_oab_decoder_new (const gchar *oab_filename,
+ const gchar *cache_dir,
+ GError **error);
+gboolean ews_oab_decoder_decode (EwsOabDecoder *eod,
+ EwsOabContactAddedCb cb,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error);
EContact * ews_oab_decoder_get_contact_from_offset
- (EwsOabDecoder *eod,
- goffset offset,
- GSList *oab_props,
- GCancellable *cancellable,
- GError **error);
-gchar * ews_oab_decoder_get_oab_prop_string
- (EwsOabDecoder *eod,
- GError **error);
-gboolean ews_oab_decoder_set_oab_prop_string
- (EwsOabDecoder *eod,
- const gchar *prop_str,
- GError **error);
+ (EwsOabDecoder *eod,
+ goffset offset,
+ GSList *oab_props,
+ GCancellable *cancellable,
+ GError **error);
+gchar * ews_oab_decoder_get_oab_prop_string
+ (EwsOabDecoder *eod,
+ GError **error);
+gboolean ews_oab_decoder_set_oab_prop_string
+ (EwsOabDecoder *eod,
+ const gchar *prop_str,
+ GError **error);
G_END_DECLS
diff --git a/src/addressbook/ews-oab-props.h b/src/addressbook/ews-oab-props.h
index 00970c5..b204838 100644
--- a/src/addressbook/ews-oab-props.h
+++ b/src/addressbook/ews-oab-props.h
@@ -33,7 +33,6 @@
#define EWS_PTYP_MULTIPLESTRING 0x101F
#define EWS_PTYP_MULTIPLEBINARY 0x1102
-
/* Ews OAB hdr property tags */
#define EWS_PT_NAME 0x6800001F
#define EWS_PT_DN 0x6804001E
@@ -41,7 +40,6 @@
#define EWS_PT_GUID 0x6802001E
#define EWS_PT_ROOT_DEPARTMENT 0x8C98001E
-
/* Ews OAB address-book record property tags that we are or may be interested in */
#define EWS_PT_EMAIL_ADDRESS 0x3003001E
#define EWS_PT_SMTP_ADDRESS 0x39FE001F
diff --git a/src/addressbook/lzx/ews-oal-decompress.c b/src/addressbook/lzx/ews-oal-decompress.c
index 729f04d..562fa0e 100644
--- a/src/addressbook/lzx/ews-oal-decompress.c
+++ b/src/addressbook/lzx/ews-oal-decompress.c
@@ -32,11 +32,11 @@
/* endian-neutral reading of little-endian data */
#define __egi32(a,n) ( ((((unsigned char *) a)[n+3]) << 24) | \
- ((((unsigned char *) a)[n+2]) << 16) | \
- ((((unsigned char *) a)[n+1]) << 8) | \
- ((((unsigned char *) a)[n+0])))
+ ((((guchar *) a)[n + 2]) << 16) | \
+ ((((guchar *) a)[n + 1]) << 8) | \
+ ((((guchar *) a)[n + 0])))
#define EndGetI64(a) ((((unsigned long long int) __egi32(a,4)) << 32) | \
- ((unsigned int) __egi32(a,0)))
+ ((guint) __egi32 (a,0)))
#define EndGetI32(a) __egi32(a,0)
#define EndGetI16(a) ((((a)[1])<<8)|((a)[0]))
@@ -55,19 +55,21 @@ typedef struct {
} LzxBlockHeader;
static gboolean
-read_uint32 (FILE *input, guint32 *val)
+read_uint32 (FILE *input,
+ guint32 *val)
{
- gchar buf [4];
+ gchar buf[4];
if (fread (buf, 1, 4, input) == 4) {
*val = EndGetI32 (buf);
- return TRUE;
- } else
+ return TRUE;
+ } else
return FALSE;
}
static LzxHeader *
-read_headers (FILE *input, GError **error)
+read_headers (FILE *input,
+ GError **error)
{
LzxHeader *lzx_h;
gboolean success;
@@ -99,7 +101,7 @@ exit:
if (!success) {
/* set the right domain later */
g_set_error_literal (error, g_quark_from_string ("lzx"), 1, "Unable to read lzx main header");
-
+
g_free (lzx_h);
lzx_h = NULL;
}
@@ -108,7 +110,8 @@ exit:
}
static LzxBlockHeader *
-read_block_header (FILE *input, GError **error)
+read_block_header (FILE *input,
+ GError **error)
{
LzxBlockHeader *lzx_b;
gboolean success;
@@ -122,27 +125,29 @@ read_block_header (FILE *input, GError **error)
success = read_uint32 (input, &lzx_b->comp_size);
if (!success)
goto exit;
-
+
success = read_uint32 (input, &lzx_b->ucomp_size);
if (!success)
goto exit;
-
+
success = read_uint32 (input, &lzx_b->crc);
exit:
if (!success) {
/* set the right domain later */
g_set_error_literal (error, g_quark_from_string ("lzx"), 1, "Unable to read lzx block header");
-
+
g_free (lzx_b);
lzx_b = NULL;
}
- return lzx_b;
+ return lzx_b;
}
gboolean
-oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_filename, GError **error)
+oal_decompress_v4_full_detail_file (const gchar *filename,
+ const gchar *output_filename,
+ GError **error)
{
LzxHeader *lzx_h = NULL;
guint total_decomp_size = 0;
@@ -154,14 +159,14 @@ oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_f
if (!input) {
g_set_error_literal (&err, g_quark_from_string ("lzx"), 1, "unable to open the input file");
ret = FALSE;
- goto exit;
+ goto exit;
}
-
+
output = fopen (output_filename, "wb");
if (!input) {
g_set_error_literal (&err, g_quark_from_string ("lzx"), 1, "unable to open the output file");
ret = FALSE;
- goto exit;
+ goto exit;
}
lzx_h = read_headers (input, &err);
@@ -169,11 +174,11 @@ oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_f
ret = FALSE;
goto exit;
}
-
+
/* TODO decompressing multiple lzx_blocks has not been tested yet. Will need to get a setup and test it. */
do {
LzxBlockHeader *lzx_b;
- struct lzxd_stream *lzs;
+ struct lzxd_stream *lzs;
goffset offset;
lzx_b = read_block_header (input, &err);
@@ -200,11 +205,11 @@ oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_f
} else {
/* round to multiples of 32768 */
guint mul, round, set, window_bits;
-
+
mul = ceil (lzx_b->ucomp_size / 32768.0);
round = mul * 32768;
set = g_bit_nth_lsf ((round >> 17), -1);
-
+
if (set > 8)
window_bits = 25;
else if (set == 0 && !(round >> 17))
@@ -227,9 +232,8 @@ oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_f
}
}
-
/* Set the fp to beggining of next block. This is a HACK, looks like decompress reads beyond the block.
- Since we can identify the next block start from block header, we just reset the offset */
+ * Since we can identify the next block start from block header, we just reset the offset */
offset += lzx_b->comp_size;
fseek (input, offset, SEEK_SET);
@@ -240,7 +244,7 @@ oal_decompress_v4_full_detail_file (const gchar *filename, const gchar *output_f
exit:
if (input)
fclose (input);
-
+
if (output)
fclose (output);
@@ -256,20 +260,21 @@ exit:
}
/*
-int
-main (int argc, char *argv [])
+gint
+main (gint argc,
+ gchar *argv[])
{
if (argc != 3) {
g_print ("Pass an lzx file and an output filename as argument \n");
return;
}
-
+ *
g_type_init ();
-
- if (oal_decompress_v4_full_detail_file (argv [1], argv [2], NULL))
+ *
+ if (oal_decompress_v4_full_detail_file (argv[1], argv[2], NULL))
g_print ("Successfully decompressed \n");
else
g_print ("decompression failed \n");
-
+ *
return 0;
} */
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index 9a37beb..a4bb0fd 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -43,11 +43,16 @@
/*
* Iterate over the icalcomponent properties and collect attendees
*/
-void e_ews_collect_attendees(icalcomponent *comp, GSList **required, GSList **optional, GSList **resource) {
+void
+e_ews_collect_attendees (icalcomponent *comp,
+ GSList **required,
+ GSList **optional,
+ GSList **resource)
+{
icalproperty *prop;
icalparameter *param;
const gchar *str = NULL;
- const char *org_email_address = NULL;
+ const gchar *org_email_address = NULL;
/* we need to know who the orgenizer is so we wont duplicate him/her */
org_email_address = e_ews_collect_organizer (comp);
@@ -62,7 +67,7 @@ void e_ews_collect_attendees(icalcomponent *comp, GSList **required, GSList **op
if (!g_ascii_strncasecmp (str, "mailto:", 7)) str = (str) + 7;
/* if this attenddee is the orgenizer - dont add him/her
- in some cases there is no maito for email if meeting orginazer*/
+ in some cases there is no maito for email if meeting orginazer */
if (g_ascii_strcasecmp (org_email_address, str) == 0) continue;
/* figure type of attendee, add to relevant list */
@@ -71,7 +76,7 @@ void e_ews_collect_attendees(icalcomponent *comp, GSList **required, GSList **op
/*in case of new time proposal the role parameter is not a part of ical*/
if (!param) continue;
- switch (icalparameter_get_role(param)) {
+ switch (icalparameter_get_role (param)) {
case ICAL_ROLE_OPTPARTICIPANT:
*optional = g_slist_append (*optional, (gpointer)str);
break;
@@ -90,7 +95,8 @@ void e_ews_collect_attendees(icalcomponent *comp, GSList **required, GSList **op
}
}
-gint ews_get_alarm (ECalComponent *comp)
+gint
+ews_get_alarm (ECalComponent *comp)
{
GList *alarm_uids = e_cal_component_get_alarm_uids (comp);
ECalComponentAlarm *alarm = e_cal_component_get_alarm (comp, (const gchar *) (alarm_uids->data));
@@ -114,7 +120,9 @@ gint ews_get_alarm (ECalComponent *comp)
return dur_int;
}
-void ews_set_alarm (ESoapMessage *msg, ECalComponent *comp)
+void
+ews_set_alarm (ESoapMessage *msg,
+ ECalComponent *comp)
{
/* We know there would be only a single alarm in EWS calendar item */
GList *alarm_uids = e_cal_component_get_alarm_uids (comp);
@@ -125,7 +133,7 @@ void ews_set_alarm (ESoapMessage *msg, ECalComponent *comp)
e_cal_component_alarm_get_action (alarm, &action);
if (action == E_CAL_COMPONENT_ALARM_DISPLAY) {
ECalComponentAlarmTrigger trigger;
- char buf[20];
+ gchar buf[20];
gint dur_int = 0;
e_cal_component_alarm_get_trigger (alarm, &trigger);
switch (trigger.type) {
@@ -143,52 +151,58 @@ void ews_set_alarm (ESoapMessage *msg, ECalComponent *comp)
}
-void ewscal_set_time (ESoapMessage *msg, const gchar *name, icaltimetype *t)
+void
+ewscal_set_time (ESoapMessage *msg,
+ const gchar *name,
+ icaltimetype *t)
{
- char *str;
+ gchar *str;
str = g_strdup_printf("%04d-%02d-%02dT%02d:%02d:%02d",
t->year, t->month, t->day,
t->hour, t->minute, t->second);
- e_ews_message_write_string_parameter(msg, name, NULL, str);
+ e_ews_message_write_string_parameter (msg, name, NULL, str);
g_free (str);
}
-static void ewscal_set_date (ESoapMessage *msg, const gchar *name, icaltimetype *t)
+static void
+ewscal_set_date (ESoapMessage *msg,
+ const gchar *name,
+ icaltimetype *t)
{
- char *str;
+ gchar *str;
str = g_strdup_printf("%04d-%02d-%02d",
t->year, t->month, t->day);
- e_ews_message_write_string_parameter(msg, name, NULL, str);
+ e_ews_message_write_string_parameter (msg, name, NULL, str);
g_free (str);
}
-static const char *number_to_month(int num) {
- static const char *months[] = {
+static const gchar *number_to_month (gint num) {
+ static const gchar *months[] = {
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
};
- return months[num-1];
+ return months[num - 1];
}
-static const char *number_to_weekday(int num) {
- static const char *days[] = {
+static const gchar *number_to_weekday (gint num) {
+ static const gchar *days[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
"Day", "Weekday", "WeekendDay"
};
- return days[num-1];
+ return days[num - 1];
}
-static const char *weekindex_to_ical(int index) {
+static const gchar *weekindex_to_ical (gint index) {
static struct {
- const char *exch;
- int index;
+ const gchar *exch;
+ gint index;
} table[] = {
{ "First", 1 },
{ "Second", 2 },
@@ -197,7 +211,7 @@ static const char *weekindex_to_ical(int index) {
{ "Fifth", 5 },
{ "Last", -1 }
};
- int i;
+ gint i;
for (i = 0; i < 6; i++) {
if (index == table[i].index)
@@ -207,9 +221,11 @@ static const char *weekindex_to_ical(int index) {
return 0;
}
-static void ewscal_add_rrule (ESoapMessage *msg, icalproperty *prop)
+static void
+ewscal_add_rrule (ESoapMessage *msg,
+ icalproperty *prop)
{
- struct icalrecurrencetype recur = icalproperty_get_rrule(prop);
+ struct icalrecurrencetype recur = icalproperty_get_rrule (prop);
e_soap_message_start_element(msg, "RelativeYearlyRecurrence", NULL, NULL);
@@ -220,70 +236,76 @@ static void ewscal_add_rrule (ESoapMessage *msg, icalproperty *prop)
e_soap_message_end_element(msg); /* "RelativeYearlyRecurrence" */
}
-static void ewscal_add_timechange (ESoapMessage *msg, icalcomponent *comp, int baseoffs)
+static void
+ewscal_add_timechange (ESoapMessage *msg,
+ icalcomponent *comp,
+ gint baseoffs)
{
- char buffer[16], *offset;
+ gchar buffer[16], *offset;
const gchar *tzname;
icalproperty *prop;
struct icaltimetype dtstart;
- int utcoffs;
+ gint utcoffs;
- prop = icalcomponent_get_first_property(comp, ICAL_TZNAME_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_TZNAME_PROPERTY);
if (prop) {
tzname = icalproperty_get_tzname (prop);
e_soap_message_add_attribute(msg, "TimeZoneName", tzname, NULL, NULL);
}
/* Calculate zone Offset from BaseOffset */
- prop = icalcomponent_get_first_property(comp, ICAL_TZOFFSETTO_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_TZOFFSETTO_PROPERTY);
if (prop) {
- utcoffs = -icalproperty_get_tzoffsetto(prop);
+ utcoffs = -icalproperty_get_tzoffsetto (prop);
utcoffs -= baseoffs;
- offset = icaldurationtype_as_ical_string_r(icaldurationtype_from_int(utcoffs));
+ offset = icaldurationtype_as_ical_string_r (icaldurationtype_from_int (utcoffs));
e_ews_message_write_string_parameter(msg, "Offset", NULL, offset);
- free(offset);
+ free (offset);
}
- prop = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_RRULE_PROPERTY);
if (prop)
ewscal_add_rrule (msg, prop);
- prop = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_DTSTART_PROPERTY);
if (prop) {
- dtstart = icalproperty_get_dtstart(prop);
+ dtstart = icalproperty_get_dtstart (prop);
snprintf(buffer, 16, "%02d:%02d:%02d", dtstart.hour, dtstart.minute, dtstart.second);
e_ews_message_write_string_parameter(msg, "Time", NULL, buffer);
}
}
-void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *icaltz)
+void
+ewscal_set_timezone (ESoapMessage *msg,
+ const gchar *name,
+ icaltimezone *icaltz)
{
icalcomponent *comp;
icalproperty *prop;
const gchar *location;
icalcomponent *xstd, *xdaylight;
- int std_utcoffs;
+ gint std_utcoffs;
gchar *offset;
if (!icaltz)
return;
- comp = icaltimezone_get_component(icaltz);
+ comp = icaltimezone_get_component (icaltz);
/* Exchange needs a BaseOffset, followed by either *both*
- Standard and Daylight zones, or neither of them. If there's
- more than one STANDARD or DAYLIGHT component in the VTIMEZONE,
- we ignore the extra. So fully-specified timezones including
- historical DST rules cannot be handled by Exchange. */
+ * Standard and Daylight zones, or neither of them. If there's
+ * more than one STANDARD or DAYLIGHT component in the VTIMEZONE,
+ * we ignore the extra. So fully-specified timezones including
+ * historical DST rules cannot be handled by Exchange. */
/* FIXME: Walk through them all to find the *latest* ones, like
- icaltimezone_get_tznames_from_vtimezone() does. */
- xstd = icalcomponent_get_first_component(comp, ICAL_XSTANDARD_COMPONENT);
- xdaylight = icalcomponent_get_first_component(comp, ICAL_XDAYLIGHT_COMPONENT);
+ * icaltimezone_get_tznames_from_vtimezone() does. */
+ xstd = icalcomponent_get_first_component (comp, ICAL_XSTANDARD_COMPONENT);
+ xdaylight = icalcomponent_get_first_component (comp, ICAL_XDAYLIGHT_COMPONENT);
/* If there was only a DAYLIGHT component, swap them over and pretend
- it was the STANDARD component. We're only going to give the server
- the BaseOffset anyway. */
+ * it was the STANDARD component. We're only going to give the server
+ * the BaseOffset anyway. */
if (!xstd) {
xstd = xdaylight;
xdaylight = NULL;
@@ -296,30 +318,30 @@ void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *ic
if (!location)
location = icaltimezone_get_tznames (icaltz);
- e_soap_message_start_element(msg, name, NULL, NULL);
+ e_soap_message_start_element (msg, name, NULL, NULL);
e_soap_message_add_attribute(msg, "TimeZoneName", location, NULL, NULL);
/* Fetch the timezone offsets for the standard (or only) zone.
- Negate it, because Exchange does it backwards */
+ * Negate it, because Exchange does it backwards */
if (xstd) {
- prop = icalcomponent_get_first_property(xstd, ICAL_TZOFFSETTO_PROPERTY);
- std_utcoffs = -icalproperty_get_tzoffsetto(prop);
+ prop = icalcomponent_get_first_property (xstd, ICAL_TZOFFSETTO_PROPERTY);
+ std_utcoffs = -icalproperty_get_tzoffsetto (prop);
} else {
/* UTC has no properties at all, so just set manually */
std_utcoffs = 0;
}
/* This is the overall BaseOffset tag, which the Standard and Daylight
- zones are offset from. It's redundant, but Exchange always sets it
- to the offset of the Standard zone, and the Offset in the Standard
- zone to zero. So try to avoid problems by doing the same. */
- offset = icaldurationtype_as_ical_string_r(icaldurationtype_from_int(std_utcoffs));
+ * zones are offset from. It's redundant, but Exchange always sets it
+ * to the offset of the Standard zone, and the Offset in the Standard
+ * zone to zero. So try to avoid problems by doing the same. */
+ offset = icaldurationtype_as_ical_string_r (icaldurationtype_from_int (std_utcoffs));
e_ews_message_write_string_parameter(msg, "BaseOffset", NULL, offset);
free (offset);
/* Only write the full TimeChangeType information, including the
- recurrence rules for the DST changes, if there is more than
- one. */
+ * recurrence rules for the DST changes, if there is more than
+ * one. */
if (xdaylight) {
/* Standard */
e_soap_message_start_element(msg, "Standard", NULL, NULL);
@@ -334,10 +356,12 @@ void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *ic
e_soap_message_end_element(msg); /* "MeetingTimeZone" */
}
-static void ewscal_add_availability_rrule (ESoapMessage *msg, icalproperty *prop)
+static void
+ewscal_add_availability_rrule (ESoapMessage *msg,
+ icalproperty *prop)
{
- struct icalrecurrencetype recur = icalproperty_get_rrule(prop);
- char buffer[16];
+ struct icalrecurrencetype recur = icalproperty_get_rrule (prop);
+ gchar buffer[16];
snprintf (buffer, 16, "%d", icalrecurrencetype_day_position(recur.by_day[0]));
e_ews_message_write_string_parameter(msg, "DayOrder", NULL, buffer);
@@ -348,49 +372,54 @@ static void ewscal_add_availability_rrule (ESoapMessage *msg, icalproperty *prop
e_ews_message_write_string_parameter(msg, "DayOfWeek", NULL, number_to_weekday(icalrecurrencetype_day_day_of_week(recur.by_day[0])));
}
-static void ewscal_add_availability_timechange (ESoapMessage *msg, icalcomponent *comp, int baseoffs)
+static void
+ewscal_add_availability_timechange (ESoapMessage *msg,
+ icalcomponent *comp,
+ gint baseoffs)
{
- char buffer[16];
+ gchar buffer[16];
icalproperty *prop;
struct icaltimetype dtstart;
- int utcoffs;
+ gint utcoffs;
/* Calculate zone Offset from BaseOffset */
- prop = icalcomponent_get_first_property(comp, ICAL_TZOFFSETTO_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_TZOFFSETTO_PROPERTY);
if (prop) {
- utcoffs = -icalproperty_get_tzoffsetto(prop)/60;
+ utcoffs = -icalproperty_get_tzoffsetto (prop) / 60;
utcoffs -= baseoffs;
snprintf (buffer, 16, "%d", utcoffs);
e_ews_message_write_string_parameter(msg, "Bias", NULL, buffer);
}
- prop = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_DTSTART_PROPERTY);
if (prop) {
- dtstart = icalproperty_get_dtstart(prop);
+ dtstart = icalproperty_get_dtstart (prop);
snprintf(buffer, 16, "%02d:%02d:%02d", dtstart.hour, dtstart.minute, dtstart.second);
e_ews_message_write_string_parameter(msg, "Time", NULL, buffer);
}
- prop = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+ prop = icalcomponent_get_first_property (comp, ICAL_RRULE_PROPERTY);
if (prop)
ewscal_add_availability_rrule (msg, prop);
}
-void ewscal_set_availability_timezone (ESoapMessage *msg, icaltimezone *icaltz)
+void
+ewscal_set_availability_timezone (ESoapMessage *msg,
+ icaltimezone *icaltz)
{
icalcomponent *comp;
icalproperty *prop;
icalcomponent *xstd, *xdaylight;
- int std_utcoffs;
+ gint std_utcoffs;
gchar *offset;
if (!icaltz)
return;
- comp = icaltimezone_get_component(icaltz);
+ comp = icaltimezone_get_component (icaltz);
- xstd = icalcomponent_get_first_component(comp, ICAL_XSTANDARD_COMPONENT);
- xdaylight = icalcomponent_get_first_component(comp, ICAL_XDAYLIGHT_COMPONENT);
+ xstd = icalcomponent_get_first_component (comp, ICAL_XSTANDARD_COMPONENT);
+ xdaylight = icalcomponent_get_first_component (comp, ICAL_XDAYLIGHT_COMPONENT);
/* Should never happen. Exchange will bail out */
if (!xstd || !xdaylight)
@@ -399,14 +428,14 @@ void ewscal_set_availability_timezone (ESoapMessage *msg, icaltimezone *icaltz)
e_soap_message_start_element(msg, "TimeZone", NULL, NULL);
/* Fetch the timezone offsets for the standard (or only) zone.
- Negate it, because Exchange does it backwards */
- prop = icalcomponent_get_first_property(xstd, ICAL_TZOFFSETTO_PROPERTY);
- std_utcoffs = -icalproperty_get_tzoffsetto(prop)/60;
+ * Negate it, because Exchange does it backwards */
+ prop = icalcomponent_get_first_property (xstd, ICAL_TZOFFSETTO_PROPERTY);
+ std_utcoffs = -icalproperty_get_tzoffsetto (prop) / 60;
/* This is the overall BaseOffset tag, which the Standard and Daylight
- zones are offset from. It's redundant, but Exchange always sets it
- to the offset of the Standard zone, and the Offset in the Standard
- zone to zero. So try to avoid problems by doing the same. */
+ * zones are offset from. It's redundant, but Exchange always sets it
+ * to the offset of the Standard zone, and the Offset in the Standard
+ * zone to zero. So try to avoid problems by doing the same. */
offset = g_strdup_printf ("%d", std_utcoffs);
e_ews_message_write_string_parameter(msg, "Bias", NULL, offset);
g_free (offset);
@@ -425,10 +454,13 @@ void ewscal_set_availability_timezone (ESoapMessage *msg, icaltimezone *icaltz)
e_soap_message_end_element(msg); /* "TimeZone" */
}
-void ewscal_set_reccurence (ESoapMessage *msg, icalproperty *rrule, icaltimetype *dtstart)
+void
+ewscal_set_reccurence (ESoapMessage *msg,
+ icalproperty *rrule,
+ icaltimetype *dtstart)
{
- char buffer[256];
- int i, len;
+ gchar buffer[256];
+ gint i, len;
gboolean is_relative = FALSE;
/* MSDN reference: http://msdn.microsoft.com/en-us/library/aa580471%28v=EXCHG.80%29.aspx
@@ -452,10 +484,10 @@ void ewscal_set_reccurence (ESoapMessage *msg, icalproperty *rrule, icaltimetype
e_ews_message_write_string_parameter (msg, "Interval", NULL, buffer);
len = snprintf (buffer, 256, "%s",
- number_to_weekday(icalrecurrencetype_day_day_of_week(recur.by_day[0])));
+ number_to_weekday (icalrecurrencetype_day_day_of_week (recur.by_day[0])));
for (i = 1; recur.by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
len += snprintf (buffer+len, 256-len, " %s",
- number_to_weekday(icalrecurrencetype_day_day_of_week(recur.by_day[i])));
+ number_to_weekday (icalrecurrencetype_day_day_of_week (recur.by_day[i])));
}
e_ews_message_write_string_parameter(msg, "DaysOfWeek", NULL, buffer);
@@ -471,10 +503,10 @@ void ewscal_set_reccurence (ESoapMessage *msg, icalproperty *rrule, icaltimetype
TODO: extend the code with all possible monthly recurrence settings */
snprintf (buffer, 32, "%d", recur.interval);
e_ews_message_write_string_parameter(msg, "Interval", NULL, buffer);
-
+
e_ews_message_write_string_parameter(msg, "DaysOfWeek", NULL,
- number_to_weekday (icalrecurrencetype_day_day_of_week(recur.by_day[0])));
-
+ number_to_weekday (icalrecurrencetype_day_day_of_week (recur.by_day[0])));
+
e_ews_message_write_string_parameter(msg, "DayOfWeekIndex", NULL, weekindex_to_ical ((recur.by_set_pos[0] == 5 ? -1 : recur.by_set_pos[0])));
e_soap_message_end_element (msg); /* "RelativeMonthlyRecurrence" */
@@ -557,17 +589,18 @@ exit:
}
static struct icaltimetype
-icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop)
+icalcomponent_get_datetime (icalcomponent *comp,
+ icalproperty *prop)
{
/* Extract datetime with proper timezone */
icalcomponent *c;
icalparameter *param;
struct icaltimetype ret;
- ret = icalvalue_get_datetime (icalproperty_get_value(prop));
+ ret = icalvalue_get_datetime (icalproperty_get_value (prop));
if ((param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER)) != NULL) {
- const char *tzid = icalparameter_get_tzid (param);
+ const gchar *tzid = icalparameter_get_tzid (param);
icaltimezone *tz = NULL;
for (c = comp; c != NULL; c = icalcomponent_get_parent (c)) {
@@ -576,16 +609,18 @@ icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop)
}
if (tz == NULL)
- tz = icaltimezone_get_builtin_timezone_from_tzid(tzid);
+ tz = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (tz != NULL)
- ret = icaltime_set_timezone(&ret, tz);
+ ret = icaltime_set_timezone (&ret, tz);
}
return ret;
}
-void ewscal_set_reccurence_exceptions (ESoapMessage *msg, icalcomponent *comp)
+void
+ewscal_set_reccurence_exceptions (ESoapMessage *msg,
+ icalcomponent *comp)
{
icalproperty *exdate;
@@ -596,7 +631,7 @@ void ewscal_set_reccurence_exceptions (ESoapMessage *msg, icalcomponent *comp)
e_soap_message_start_element (msg, "DeletedOccurrences", NULL, NULL);
for (; exdate; exdate = icalcomponent_get_next_property (comp, ICAL_EXDATE_PROPERTY)) {
- struct icaltimetype exdatetime = icalcomponent_get_datetime(comp, exdate);
+ struct icaltimetype exdatetime = icalcomponent_get_datetime (comp, exdate);
e_soap_message_start_element (msg, "DeletedOccurrence", NULL, NULL);
@@ -608,12 +643,16 @@ void ewscal_set_reccurence_exceptions (ESoapMessage *msg, icalcomponent *comp)
e_soap_message_end_element (msg); /* "DeletedOccurrences" */
}
-void ewscal_get_attach_differences (const GSList *original, const GSList *modified, GSList **removed, GSList **added)
+void
+ewscal_get_attach_differences (const GSList *original,
+ const GSList *modified,
+ GSList **removed,
+ GSList **added)
{
gboolean flag;
GSList *i, *i_next, *j, *j_next, *original_copy, *modified_copy;
- original_copy = g_slist_copy ((GSList *)original);
- modified_copy = g_slist_copy ((GSList *)modified);
+ original_copy = g_slist_copy ((GSList *) original);
+ modified_copy = g_slist_copy ((GSList *) modified);
for (j = modified_copy; j; j = j_next) {
j_next = j->next;
@@ -637,14 +676,15 @@ void ewscal_get_attach_differences (const GSList *original, const GSList *modifi
/*
* get meeting organizer e-mail address
*/
-const char *e_ews_collect_organizer(icalcomponent *comp)
+const gchar *
+e_ews_collect_organizer (icalcomponent *comp)
{
icalproperty *org_prop = NULL;
const gchar *org = NULL;
- const char *org_email_address = NULL;
+ const gchar *org_email_address = NULL;
org_prop = icalcomponent_get_first_property (comp, ICAL_ORGANIZER_PROPERTY);
- org = icalproperty_get_organizer(org_prop);
+ org = icalproperty_get_organizer (org_prop);
if (!org)
org = "";
else
@@ -655,22 +695,24 @@ const char *e_ews_collect_organizer(icalcomponent *comp)
return org_email_address;
}
-gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri)
+gchar *
+e_ews_extract_attachment_id_from_uri (const gchar *uri)
{
gchar *attachment_id, *filepath = g_filename_from_uri (uri, NULL, NULL);
gchar **dirs = g_strsplit (filepath, "/", 0);
- int n = 0;
+ gint n = 0;
while (dirs[n]) n++;
- attachment_id = g_strdup (dirs[n-1]);
+ attachment_id = g_strdup (dirs[n - 1]);
g_strfreev (dirs);
return attachment_id;
}
-void e_ews_clean_icalcomponent (icalcomponent *icalcomp)
+void
+e_ews_clean_icalcomponent (icalcomponent *icalcomp)
{
icalproperty *prop, *item_id_prop = NULL, *changekey_prop = NULL;
diff --git a/src/calendar/e-cal-backend-ews-utils.h b/src/calendar/e-cal-backend-ews-utils.h
index 407f2a7..1fc6fb9 100644
--- a/src/calendar/e-cal-backend-ews-utils.h
+++ b/src/calendar/e-cal-backend-ews-utils.h
@@ -31,8 +31,8 @@ G_BEGIN_DECLS
#define MINUTES_IN_HOUR 60
#define SECS_IN_MINUTE 60
-const char *e_ews_collect_organizer(icalcomponent *comp);
-void e_ews_collect_attendees(icalcomponent *comp, GSList **required, GSList **optional, GSList **resource);
+const gchar *e_ews_collect_organizer (icalcomponent *comp);
+void e_ews_collect_attendees (icalcomponent *comp, GSList **required, GSList **optional, GSList **resource);
void ewscal_set_time (ESoapMessage *msg, const gchar *name, icaltimetype *t);
void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *icaltz);
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 48e3c7e..2edb6da 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -120,7 +120,7 @@ static ECalBackendClass *parent_class = NULL;
static void ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data);
static void ews_cal_component_get_item_id (ECalComponent *comp, gchar **itemid, gchar **changekey);
static gboolean ews_start_sync (gpointer data);
-static icaltimezone* e_cal_get_timezone_from_ical_component (ECalBackend *backend, icalcomponent *comp);
+static icaltimezone * e_cal_get_timezone_from_ical_component (ECalBackend *backend, icalcomponent *comp);
static void
switch_offline (ECalBackendEws *cbews)
@@ -143,7 +143,8 @@ switch_offline (ECalBackendEws *cbews)
/* Property Accessors */
static icaltimezone *
-e_cal_backend_ews_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
+e_cal_backend_ews_internal_get_timezone (ECalBackend *backend,
+ const gchar *tzid)
{
icaltimezone *zone = NULL;
ECalBackendEws *cbews;
@@ -162,7 +163,11 @@ e_cal_backend_ews_internal_get_timezone (ECalBackend *backend, const gchar *tzid
}
static void
-e_cal_backend_ews_add_timezone (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *tzobj)
+e_cal_backend_ews_add_timezone (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *tzobj)
{
icalcomponent *tz_comp;
ECalBackendEws *cbews;
@@ -232,9 +237,10 @@ static void clear_reminder_is_set (ESoapMessage *msg, gpointer user_data)
e_ews_message_end_item_change (msg);
}
-
static void
-ews_cal_discard_alarm_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_cal_discard_alarm_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsDiscardAlarmData *edad = user_data;
@@ -242,21 +248,27 @@ ews_cal_discard_alarm_cb (GObject *object, GAsyncResult *res, gpointer user_data
if (!e_ews_connection_update_items_finish (cnc, res, NULL, &error)) {
/* The calendar UI doesn't *display* errors unless they have
- the OtherError code */
+ * the OtherError code */
error->code = OtherError;
}
e_data_cal_respond_discard_alarm (edad->cal, edad->context, error);
- g_free(edad->itemid);
- g_free(edad->changekey);
- g_object_unref(edad->cbews);
- g_object_unref(edad->cal);
- g_free(edad);
+ g_free (edad->itemid);
+ g_free (edad->changekey);
+ g_object_unref (edad->cbews);
+ g_object_unref (edad->cal);
+ g_free (edad);
}
static void
-e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid)
+e_cal_backend_ews_discard_alarm (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *uid,
+ const gchar *rid,
+ const gchar *auid)
{
ECalBackendEws *cbews = (ECalBackendEws *) backend;
ECalBackendEwsPrivate *priv;
@@ -270,14 +282,14 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 co
comp = e_cal_backend_store_get_component (priv->store, uid, NULL);
if (!comp) {
e_data_cal_respond_discard_alarm (cal, context,
- EDC_ERROR(ObjectNotFound));
+ EDC_ERROR (ObjectNotFound));
return;
}
PRIV_UNLOCK (priv);
/* FIXME: Can't there be multiple alarms for each event? Or does
- Exchange not support that? */
+ * Exchange not support that? */
edad = g_new0 (EwsDiscardAlarmData, 1);
edad->cbews = g_object_ref (cbews);
edad->cal = g_object_ref (cal);
@@ -291,7 +303,7 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 co
if (index != NULL) {
/*Microsoft is counting the occurrences starting from 1
- where EcalComponent is starting from zerro*/
+ where EcalComponent is starting from zerro */
edad->instance_index = *index + 1;
e_cal_component_free_sequence (index);
} else {
@@ -303,7 +315,7 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 co
edad->is_occurrence = FALSE;
edad->instance_index = -1;
}
-
+
ews_cal_component_get_item_id (comp, &edad->itemid, &edad->changekey);
e_ews_connection_update_items_start (priv->cnc, EWS_PRIORITY_MEDIUM,
@@ -315,7 +327,11 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 co
}
static void
-e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *tzid)
+e_cal_backend_ews_get_timezone (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *tzid)
{
icalcomponent *icalcomp;
icaltimezone *zone;
@@ -378,13 +394,14 @@ e_cal_backend_ews_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 con
/* changekey can be NULL if you don't want it. itemid cannot. */
static void
-ews_cal_component_get_item_id (ECalComponent *comp, gchar **itemid, gchar **changekey)
+ews_cal_component_get_item_id (ECalComponent *comp,
+ gchar **itemid,
+ gchar **changekey)
{
icalproperty *prop;
gchar *ck = NULL;
gchar *id = NULL;
-
prop = icalcomponent_get_first_property (e_cal_component_get_icalcomponent (comp),
ICAL_X_PROPERTY);
while (prop) {
@@ -408,7 +425,9 @@ ews_cal_component_get_item_id (ECalComponent *comp, gchar **itemid, gchar **chan
/* changekey can be NULL if you don't want it. itemid cannot. */
static void
-ews_cal_component_get_calendar_item_accept_id (ECalComponent *comp, gchar **itemid, gchar **changekey)
+ews_cal_component_get_calendar_item_accept_id (ECalComponent *comp,
+ gchar **itemid,
+ gchar **changekey)
{
icalproperty *prop;
gchar *id = NULL;
@@ -435,7 +454,6 @@ ews_cal_component_get_calendar_item_accept_id (ECalComponent *comp, gchar **item
*changekey = ck;
}
-
static void
add_comps_to_item_id_hash (ECalBackendEws *cbews)
{
@@ -456,9 +474,9 @@ add_comps_to_item_id_hash (ECalBackendEws *cbews)
const gchar *uid;
/* This should never happen, but sometimes when our
- use of X- fields has changed it has triggered. Make
- it cope, and not crash */
- e_cal_component_get_uid(comp, &uid);
+ * use of X- fields has changed it has triggered. Make
+ * it cope, and not crash */
+ e_cal_component_get_uid (comp, &uid);
g_warning ("EWS calendar item %s had no EWS ItemID!",
uid);
continue;
@@ -472,14 +490,17 @@ add_comps_to_item_id_hash (ECalBackendEws *cbews)
}
static gboolean
-connect_to_server (ECalBackendEws *cbews, const gchar *username, const gchar *password, GError **error)
+connect_to_server (ECalBackendEws *cbews,
+ const gchar *username,
+ const gchar *password,
+ GError **error)
{
ECalBackendEwsPrivate *priv;
ESource *esource;
-
+
priv = cbews->priv;
esource = e_backend_get_source (E_BACKEND (cbews));
-
+
PRIV_LOCK (priv);
if (priv->is_online && !priv->cnc && password) {
@@ -490,7 +511,7 @@ connect_to_server (ECalBackendEws *cbews, const gchar *username, const gchar *pa
GError *err = NULL;
/* If we can be called a second time while the first is still
- "outstanding", we need a bit of a rethink... */
+ * "outstanding", we need a bit of a rethink... */
g_assert (!priv->opening_ctx && !priv->opening_cal);
priv->user_email = e_source_get_duped_property (esource, "email");
@@ -498,32 +519,32 @@ connect_to_server (ECalBackendEws *cbews, const gchar *username, const gchar *pa
host_url = e_source_get_property (esource, "hosturl");
cnc = e_ews_connection_new (host_url, username, password,
NULL, NULL, error);
-
+
fid = g_new0 (EwsFolderId, 1);
fid->id = g_strdup (priv->folder_id);
ids = g_slist_append (ids, fid);
e_ews_connection_get_folder (cnc, EWS_PRIORITY_MEDIUM, "Default", NULL, ids, &folders, NULL, &err);
-
+
e_ews_folder_free_fid (fid);
g_slist_free (ids);
ids = NULL;
if (err) {
g_object_unref (cnc);
- g_propagate_error (error, err);
+ g_propagate_error (error, err);
PRIV_UNLOCK (priv);
e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbews), TRUE, priv->credentials);
return FALSE;
}
-
+
g_object_unref ((EEwsFolder *) folders->data);
g_slist_free (folders);
folders = NULL;
priv->cnc = cnc;
-
+
/* Trigger an update request, which will test our authentication */
ews_start_sync (cbews);
PRIV_UNLOCK (priv);
@@ -535,8 +556,14 @@ connect_to_server (ECalBackendEws *cbews, const gchar *username, const gchar *pa
}
static gboolean
-e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- gboolean only_if_exists, const gchar *username, const gchar *password, GError **error)
+e_cal_backend_ews_open (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ gboolean only_if_exists,
+ const gchar *username,
+ const gchar *password,
+ GError **error)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -553,11 +580,11 @@ e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, guint32 context, GC
if (!priv->store) {
priv->folder_id = e_source_get_duped_property (esource, "folder-id");
priv->storage_path = g_build_filename (cache_dir, priv->folder_id, NULL);
-
+
priv->store = e_cal_backend_file_store_new (priv->storage_path);
e_cal_backend_store_load (priv->store);
add_comps_to_item_id_hash (cbews);
-
+
if (priv->default_zone)
e_cal_backend_store_set_default_timezone (priv->store, priv->default_zone);
}
@@ -569,12 +596,16 @@ e_cal_backend_ews_open (ECalBackend *backend, EDataCal *cal, guint32 context, GC
return TRUE;
}
-
+
return FALSE;
}
-static void
-e_cal_backend_ews_open_compat (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, gboolean only_if_exists)
+static void
+e_cal_backend_ews_open_compat (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 opid,
+ GCancellable *cancellable,
+ gboolean only_if_exists)
{
GError *error = NULL;
ECalBackendEws *cbews = E_CAL_BACKEND_EWS (backend);
@@ -583,16 +614,16 @@ e_cal_backend_ews_open_compat (ECalBackend *backend, EDataCal *cal, guint32 opid
gboolean ret;
if (priv->credentials) {
- user_name = e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME);
+ user_name = e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME);
password = e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD);
}
- ret = e_cal_backend_ews_open (backend, cal, opid, cancellable, only_if_exists, user_name,
+ ret = e_cal_backend_ews_open (backend, cal, opid, cancellable, only_if_exists, user_name,
password, &error);
if (!priv->credentials)
e_cal_backend_notify_auth_required (backend, TRUE, priv->credentials);
-
+
e_cal_backend_notify_opened (backend, NULL);
e_data_cal_respond_open (cal, opid, error);
}
@@ -622,18 +653,21 @@ e_cal_backend_ews_authenticate_user (ECalBackend *backend,
}
priv->credentials = e_credentials_new_clone (credentials);
-
+
connect_to_server (cbews, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME),
e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD), &error);
PRIV_UNLOCK (priv);
-
+
/* This seems in-correct, but thats how authenticate_user_sync works */
e_cal_backend_notify_opened (backend, error);
}
static void
-e_cal_backend_ews_remove (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable)
+e_cal_backend_ews_remove (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -653,8 +687,12 @@ e_cal_backend_ews_remove (ECalBackend *backend, EDataCal *cal, guint32 context,
}
static void
-e_cal_backend_ews_get_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- const gchar *uid, const gchar *rid)
+e_cal_backend_ews_get_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *uid,
+ const gchar *rid)
{
ECalComponent *comp;
ECalBackendEwsPrivate *priv;
@@ -696,7 +734,10 @@ exit:
}
static void
-cal_backend_ews_get_object_list (ECalBackend *backend, const gchar *sexp, GSList **objects, GError **error)
+cal_backend_ews_get_object_list (ECalBackend *backend,
+ const gchar *sexp,
+ GSList **objects,
+ GError **error)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -745,7 +786,11 @@ cal_backend_ews_get_object_list (ECalBackend *backend, const gchar *sexp, GSList
}
static void
-e_cal_backend_ews_get_object_list (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *sexp)
+e_cal_backend_ews_get_object_list (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *sexp)
{
GSList *objects = NULL, *l;
GError *error = NULL;
@@ -761,7 +806,9 @@ e_cal_backend_ews_get_object_list (ECalBackend *backend, EDataCal *cal, guint32
}
static void
-ews_cal_delete_comp (ECalBackendEws *cbews, ECalComponent *comp, const gchar *item_id)
+ews_cal_delete_comp (ECalBackendEws *cbews,
+ ECalComponent *comp,
+ const gchar *item_id)
{
ECalBackendEwsPrivate *priv = cbews->priv;
ECalComponentId *uid;
@@ -780,7 +827,10 @@ ews_cal_delete_comp (ECalBackendEws *cbews, ECalComponent *comp, const gchar *it
}
static void
-ews_cal_append_exdate (ECalBackendEws *cbews, ECalComponent *comp, const gchar *rid, CalObjModType mod)
+ews_cal_append_exdate (ECalBackendEws *cbews,
+ ECalComponent *comp,
+ const gchar *rid,
+ CalObjModType mod)
{
ECalComponent *old_comp;
@@ -805,7 +855,9 @@ typedef struct {
} EwsRemoveData;
static void
-ews_cal_remove_object_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_cal_remove_object_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EwsRemoveData *remove_data = user_data;
GSimpleAsyncResult *simple;
@@ -815,7 +867,7 @@ ews_cal_remove_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
if (!g_simple_async_result_propagate_error (simple, &error) || error->code == EWS_CONNECTION_ERROR_ITEMNOTFOUND) {
/* FIXME: This is horrid. Will bite us when we start to delete
- more than one item at a time... */
+ * more than one item at a time... */
if (remove_data->comp) ews_cal_delete_comp (remove_data->cbews, remove_data->comp, remove_data->item_id.id);
if (remove_data->parent) ews_cal_append_exdate (remove_data->cbews, remove_data->parent, remove_data->rid, remove_data->mod);
@@ -830,27 +882,30 @@ ews_cal_remove_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
g_free (remove_data->item_id.id);
g_free (remove_data->item_id.change_key);
- g_object_unref(remove_data->cbews);
- if (remove_data->comp) g_object_unref(remove_data->comp);
- if (remove_data->parent) g_object_unref(remove_data->parent);
- g_object_unref(remove_data->cal);
+ g_object_unref (remove_data->cbews);
+ if (remove_data->comp) g_object_unref (remove_data->comp);
+ if (remove_data->parent) g_object_unref (remove_data->parent);
+ g_object_unref (remove_data->cal);
if (remove_data->rid) g_free (remove_data->rid);
- g_free(remove_data);
+ g_free (remove_data);
}
static guint
-e_cal_rid_to_index (ECalBackend *backend, const char *rid, icalcomponent *comp, GError **error)
+e_cal_rid_to_index (ECalBackend *backend,
+ const gchar *rid,
+ icalcomponent *comp,
+ GError **error)
{
guint index = 1;
- icalproperty *prop = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+ icalproperty *prop = icalcomponent_get_first_property (comp, ICAL_RRULE_PROPERTY);
struct icalrecurrencetype rule = icalproperty_get_rrule (prop);
struct icaltimetype dtstart = icalcomponent_get_dtstart (comp);
- icalrecur_iterator* ritr;
+ icalrecur_iterator * ritr;
icaltimetype next, o_time;
/* icalcomponent_get_datetime needs a fix to initialize ret.zone to NULL. If a timezone is not
- found in libical, it remains uninitialized in that function causing invalid read or crash. so
- we set the timezone as we cannot identify if it has a valid timezone or not */
+ * found in libical, it remains uninitialized in that function causing invalid read or crash. so
+ * we set the timezone as we cannot identify if it has a valid timezone or not */
dtstart.zone = e_cal_get_timezone_from_ical_component (backend, comp);
ritr = icalrecur_iterator_new (rule, dtstart);
next = icalrecur_iterator_next (ritr);
@@ -862,18 +917,23 @@ e_cal_rid_to_index (ECalBackend *backend, const char *rid, icalcomponent *comp,
}
icalrecur_iterator_free (ritr);
-
+
if (icaltime_is_null_time (next)) {
- g_propagate_error (error, EDC_ERROR_EX(OtherError,
+ g_propagate_error (error, EDC_ERROR_EX (OtherError,
"Invalid occurrence ID"));
}
-
+
return index;
}
static void
-e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- const gchar *uid, const gchar *rid, CalObjModType mod)
+e_cal_backend_ews_remove_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *uid,
+ const gchar *rid,
+ CalObjModType mod)
{
EwsRemoveData *remove_data;
ECalBackendEws *cbews = (ECalBackendEws *) backend;
@@ -896,7 +956,7 @@ e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, guint32 co
PRIV_LOCK (priv);
comp = e_cal_backend_store_get_component (priv->store, uid, rid);
-
+
if (!rid || !*rid)
rid = NULL;
@@ -904,37 +964,37 @@ e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, guint32 co
parent = e_cal_backend_store_get_component (priv->store, uid, NULL);
if (!parent) {
g_warning ("EEE Cant find master component with uid:%s\n", uid);
- g_propagate_error (&error, EDC_ERROR(ObjectNotFound));
+ g_propagate_error (&error, EDC_ERROR (ObjectNotFound));
goto exit;
}
}
-
+
if (!comp && !parent) {
g_warning ("EEE Cant find component with uid:%s & rid:%s\n", uid, rid);
- g_propagate_error (&error, EDC_ERROR(ObjectNotFound));
+ g_propagate_error (&error, EDC_ERROR (ObjectNotFound));
goto errorlvl1;
}
-
+
ews_cal_component_get_item_id ((comp ? comp : parent), &item_id.id, &item_id.change_key);
PRIV_UNLOCK (priv);
if (!item_id.id) {
- g_propagate_error(&error, EDC_ERROR_EX(OtherError,
+ g_propagate_error (&error, EDC_ERROR_EX (OtherError,
"Cannot determine EWS ItemId"));
goto errorlvl2;
}
-
+
if (parent && !comp) {
index = e_cal_rid_to_index (backend, rid, e_cal_component_get_icalcomponent (parent), &error);
if (error) goto errorlvl2;
}
remove_data = g_new0 (EwsRemoveData, 1);
- remove_data->cbews = g_object_ref(cbews);
+ remove_data->cbews = g_object_ref (cbews);
remove_data->comp = comp;
remove_data->parent = parent;
- remove_data->cal = g_object_ref(cal);
+ remove_data->cal = g_object_ref (cal);
remove_data->context = context;
remove_data->index = index;
remove_data->item_id.id = item_id.id;
@@ -978,12 +1038,16 @@ typedef struct {
icalcomponent *icalcomp;
} EwsConvertData;
-static void add_attendees_list_to_message(ESoapMessage *msg, const gchar *listname, GSList *list) {
+static void
+add_attendees_list_to_message (ESoapMessage *msg,
+ const gchar *listname,
+ GSList *list)
+{
GSList *item;
- e_soap_message_start_element(msg, listname, NULL, NULL);
+ e_soap_message_start_element (msg, listname, NULL, NULL);
- for (item = list ; item != NULL; item = item->next) {
+ for (item = list; item != NULL; item = item->next) {
e_soap_message_start_element(msg, "Attendee", NULL, NULL);
e_soap_message_start_element(msg, "Mailbox", NULL, NULL);
@@ -993,22 +1057,23 @@ static void add_attendees_list_to_message(ESoapMessage *msg, const gchar *listna
e_soap_message_end_element(msg); /* "Attendee" */
}
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-convert_vevent_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
+convert_vevent_calcomp_to_xml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsConvertData *convert_data = user_data;
icalcomponent *icalcomp = convert_data->icalcomp;
- ECalComponent *comp = e_cal_component_new();
+ ECalComponent *comp = e_cal_component_new ();
GSList *required = NULL, *optional = NULL, *resource = NULL;
icaltimetype dtstart, dtend;
icalproperty *prop;
gboolean has_alarms;
- const char *value;
+ const gchar *value;
- e_cal_component_set_icalcomponent(comp, icalcomp);
+ e_cal_component_set_icalcomponent (comp, icalcomp);
/* FORMAT OF A SAMPLE SOAP MESSAGE: http://msdn.microsoft.com/en-us/library/aa564690.aspx */
@@ -1016,12 +1081,12 @@ convert_vevent_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
e_soap_message_start_element(msg, "CalendarItem", NULL, NULL);
/* subject */
- value = icalcomponent_get_summary(icalcomp);
+ value = icalcomponent_get_summary (icalcomp);
if (value)
e_ews_message_write_string_parameter(msg, "Subject", NULL, value);
/* description */
- value = icalcomponent_get_description(icalcomp);
+ value = icalcomponent_get_description (icalcomp);
if (value)
e_ews_message_write_string_parameter_with_attribute(msg, "Body", NULL, value, "BodyType", "Text");
@@ -1052,55 +1117,56 @@ convert_vevent_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
e_ews_message_write_string_parameter (msg, "LegacyFreeBusyStatus",NULL,"Busy");
/* location */
- value = icalcomponent_get_location(icalcomp);
+ value = icalcomponent_get_location (icalcomp);
if (value)
e_ews_message_write_string_parameter(msg, "Location", NULL, value);
-
+
/* collect attendees */
- e_ews_collect_attendees(icalcomp, &required, &optional, &resource);
+ e_ews_collect_attendees (icalcomp, &required, &optional, &resource);
if (required != NULL) {
add_attendees_list_to_message(msg, "RequiredAttendees", required);
- g_slist_free(required);
+ g_slist_free (required);
}
if (optional != NULL) {
add_attendees_list_to_message(msg, "OptionalAttendees", optional);
- g_slist_free(optional);
+ g_slist_free (optional);
}
if (resource != NULL) {
add_attendees_list_to_message(msg, "Resources", resource);
- g_slist_free(resource);
+ g_slist_free (resource);
}
/* end of attendees */
/* Recurrence */
- prop = icalcomponent_get_first_property(icalcomp, ICAL_RRULE_PROPERTY);
+ prop = icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY);
if (prop != NULL) {
- ewscal_set_reccurence(msg, prop, &dtstart);
+ ewscal_set_reccurence (msg, prop, &dtstart);
}
if (0 /* Exchange 2010 detected */ && dtstart.zone != dtend.zone) {
/* We have to cast these because libical puts a const pointer into the
- icaltimetype, but its basic read-only icaltimezone_foo() functions
- take a non-const pointer! */
+ * icaltimetype, but its basic read-only icaltimezone_foo() functions
+ * take a non-const pointer! */
ewscal_set_timezone (msg, "StartTimeZone", (icaltimezone *)dtstart.zone);
ewscal_set_timezone (msg, "EndTimeZone", (icaltimezone *)dtstart.zone);
} else
ewscal_set_timezone (msg, "MeetingTimeZone", (icaltimezone *)(dtstart.zone?dtstart.zone:convert_data->cbews->priv->default_zone));
// end of "CalendarItem"
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-convert_vtodo_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
+convert_vtodo_calcomp_to_xml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsConvertData *convert_data = user_data;
icalcomponent *icalcomp = convert_data->icalcomp;
icalproperty *prop;
icaltimetype dt;
- int value;
- char buffer[16];
+ gint value;
+ gchar buffer[16];
e_soap_message_start_element(msg, "Task", NULL, NULL);
@@ -1145,7 +1211,8 @@ convert_vtodo_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
}
static void
-convert_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
+convert_calcomp_to_xml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsConvertData *convert_data = user_data;
@@ -1159,46 +1226,62 @@ convert_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
default:
break;
}
-
+
g_object_unref (convert_data->cbews);
g_free (convert_data);
}
static void
-e_cal_backend_ews_remove_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- const gchar *uid, const gchar *rid, CalObjModType mod);
+e_cal_backend_ews_remove_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *uid,
+ const gchar *rid,
+ CalObjModType mod);
/*I will unate both type, they are same now*/
typedef struct {
- ECalBackendEws *cbews;
- ECalComponent *comp;
- int cb_type; /* 0 - nothing, 1 - create, 2 - update */
- EDataCal *cal;
- guint32 context;
- ECalComponent *oldcomp;
- gchar *itemid;
- gchar *changekey;
+ ECalBackendEws *cbews;
+ ECalComponent *comp;
+ gint cb_type; /* 0 - nothing,
+ 1 - create,
+ 2 - update */
+ EDataCal *cal;
+ guint32 context;
+ ECalComponent *oldcomp;
+ gchar *itemid;
+ gchar *changekey;
} EwsAttachmentsData;
typedef struct {
- ECalBackendEws *cbews;
- EDataCal *cal;
- ECalComponent *comp;
- ECalComponent *oldcomp;
- guint32 context;
- gchar *itemid;
- gchar *changekey;
+ ECalBackendEws *cbews;
+ EDataCal *cal;
+ ECalComponent *comp;
+ ECalComponent *oldcomp;
+ guint32 context;
+ gchar *itemid;
+ gchar *changekey;
} EwsModifyData;
static void
-e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- const gchar *calobj, CalObjModType mod);
-
-static void convert_component_to_updatexml (ESoapMessage *msg, gpointer user_data);
-static void ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data);
+e_cal_backend_ews_modify_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *calobj,
+ CalObjModType mod);
+
+static void convert_component_to_updatexml (ESoapMessage *msg,
+ gpointer user_data);
+static void ews_cal_modify_object_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data);
static void
-ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+ews_create_attachments_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsAttachmentsData *create_data = user_data;
@@ -1221,7 +1304,7 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
}
/* get exclusive access to the store */
- e_cal_backend_store_freeze_changes(priv->store);
+ e_cal_backend_store_freeze_changes (priv->store);
/* Update change key. id remains the same, but change key changed.*/
icalcomp = e_cal_component_get_icalcomponent (create_data->comp);
@@ -1249,7 +1332,7 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
/* update changes and release access to the store */
e_cal_backend_store_thaw_changes (priv->store);
- e_cal_component_get_uid(create_data->comp, &comp_uid);
+ e_cal_component_get_uid (create_data->comp, &comp_uid);
if (create_data->cb_type == 1) {
/*In case we have attendees we have to fake update items,
* this is the only way to pass attachments in meeting invite mail*/
@@ -1258,8 +1341,8 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
e_cal_backend_ews_modify_object ((ECalBackend *) create_data->cbews, create_data->cal, 0, NULL, icalcomponent_as_ical_string (icalcomp), CALOBJ_MOD_ALL);
}
} else if (create_data->cb_type == 2) {
- const char *send_meeting_invitations;
- EwsModifyData* modify_data;
+ const gchar *send_meeting_invitations;
+ EwsModifyData * modify_data;
modify_data = g_new0 (EwsModifyData, 1);
modify_data->cbews = g_object_ref (create_data->cbews);
modify_data->comp = create_data->comp;
@@ -1268,13 +1351,13 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
modify_data->context = create_data->context;
modify_data->itemid = create_data->itemid;
modify_data->changekey = change_key;
-
+
if (e_cal_component_has_attendees (create_data->comp))
send_meeting_invitations = "SendToAllAndSaveCopy";
else
/*In case of appointment we have to set SendMeetingInvites to SendToNone */
send_meeting_invitations = "SendToNone";
-
+
e_ews_connection_update_items_start (priv->cnc, EWS_PRIORITY_MEDIUM,
"AlwaysOverwrite",
"SendAndSaveCopy",
@@ -1297,7 +1380,9 @@ ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data
}
static void
-ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+ews_create_object_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsCreateData *create_data = user_data;
@@ -1314,15 +1399,15 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
EEwsItem *item;
/* get a list of ids from server (single item) */
- e_ews_connection_create_items_finish(cnc, res, &ids, &error);
+ e_ews_connection_create_items_finish (cnc, res, &ids, &error);
/* make sure there was no error */
if (error != NULL) {
- e_data_cal_respond_create_object(create_data->cal, create_data->context, error, NULL, NULL);
+ e_data_cal_respond_create_object (create_data->cal, create_data->context, error, NULL, NULL);
return;
}
- item = (EEwsItem *)ids->data;
+ item = (EEwsItem *) ids->data;
item_id = e_ews_item_get_id (item);
g_slist_free (ids);
@@ -1355,7 +1440,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
/* attachments */
n_attach = e_cal_component_get_num_attachments (create_data->comp);
if (n_attach > 0) {
- EwsAttachmentsData *attach_data = g_new0(EwsAttachmentsData, 1);
+ EwsAttachmentsData *attach_data = g_new0 (EwsAttachmentsData, 1);
attach_data->cbews = g_object_ref (create_data->cbews);
attach_data->comp = g_object_ref (create_data->comp);
@@ -1368,12 +1453,12 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
item_id, attachments,
ews_create_attachments_cb, NULL, attach_data);
- for (i = attachments; i ; i = i->next) g_free (i->data);
+ for (i = attachments; i; i = i->next) g_free (i->data);
g_slist_free (attachments);
}
/* get exclusive access to the store */
- e_cal_backend_store_freeze_changes(priv->store);
+ e_cal_backend_store_freeze_changes (priv->store);
/* set a new ical property containing the change key we got from the exchange server for future use */
if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_CALENDAR_ITEM)
@@ -1383,28 +1468,28 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
icalprop = icalproperty_new_x (item_id->id);
icalproperty_set_x_name (icalprop, "X-EVOLUTION-ITEMID");
- icalcomp = e_cal_component_get_icalcomponent(create_data->comp);
+ icalcomp = e_cal_component_get_icalcomponent (create_data->comp);
icalcomponent_add_property (icalcomp, icalprop);
icalprop = icalproperty_new_x (item_id->change_key);
icalproperty_set_x_name (icalprop, "X-EVOLUTION-CHANGEKEY");
- icalcomp = e_cal_component_get_icalcomponent(create_data->comp);
+ icalcomp = e_cal_component_get_icalcomponent (create_data->comp);
icalcomponent_add_property (icalcomp, icalprop);
/* update component internal data */
- e_cal_component_commit_sequence(create_data->comp);
+ e_cal_component_commit_sequence (create_data->comp);
put_component_to_store (create_data->cbews, create_data->comp);
- e_cal_component_get_uid(create_data->comp, &comp_uid);
+ e_cal_component_get_uid (create_data->comp, &comp_uid);
e_data_cal_respond_create_object (create_data->cal, create_data->context, error, comp_uid, create_data->comp);
-
+
/* notify the backend and the application that a new object was created */
- e_cal_backend_notify_component_created (E_CAL_BACKEND(create_data->cbews), create_data->comp);
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (create_data->cbews), create_data->comp);
/* place new component in our cache */
PRIV_LOCK (priv);
- g_hash_table_insert (priv->item_id_hash, g_strdup(item_id->id), g_object_ref (create_data->comp));
+ g_hash_table_insert (priv->item_id_hash, g_strdup (item_id->id), g_object_ref (create_data->comp));
PRIV_UNLOCK (priv);
/* update changes and release access to the store */
@@ -1412,10 +1497,10 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
/* Excluded occurrences */
g_clear_error (&error);
- icalprop = icalcomponent_get_first_property(icalcomp, ICAL_RRULE_PROPERTY);
+ icalprop = icalcomponent_get_first_property (icalcomp, ICAL_RRULE_PROPERTY);
if (icalprop != NULL) {
- icalprop = icalcomponent_get_first_property(icalcomp, ICAL_EXDATE_PROPERTY);
- for (; icalprop; icalprop = icalcomponent_get_next_property(icalcomp, ICAL_EXDATE_PROPERTY)) {
+ icalprop = icalcomponent_get_first_property (icalcomp, ICAL_EXDATE_PROPERTY);
+ for (; icalprop; icalprop = icalcomponent_get_next_property (icalcomp, ICAL_EXDATE_PROPERTY)) {
exceptions = g_slist_prepend (exceptions, g_strdup (icalproperty_get_value_as_string (icalprop)));
}
@@ -1424,17 +1509,17 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
comp_uid, i->data, CALOBJ_MOD_THIS);
}
- g_slist_foreach (exceptions, (GFunc)g_free, NULL);
+ g_slist_foreach (exceptions, (GFunc) g_free, NULL);
g_slist_free (exceptions);
}
/* no need to keep reference to the object */
- g_object_unref(create_data->comp);
+ g_object_unref (create_data->comp);
/* free memory allocated for create_data & unref contained objects */
- g_object_unref(create_data->cbews);
- g_object_unref(create_data->cal);
- g_free(create_data);
+ g_object_unref (create_data->cbews);
+ g_object_unref (create_data->cal);
+ g_free (create_data);
}
struct TzidCbData {
@@ -1442,7 +1527,7 @@ struct TzidCbData {
ECalBackendEws *cbews;
};
-static void tzid_cb(icalparameter *param, void *data)
+static void tzid_cb (icalparameter *param, gpointer data)
{
struct TzidCbData *cbd = data;
const gchar *tzid;
@@ -1453,19 +1538,23 @@ static void tzid_cb(icalparameter *param, void *data)
if (!tzid)
return;
- zone = resolve_tzid(tzid, cbd->cbews);
+ zone = resolve_tzid (tzid, cbd->cbews);
if (!zone)
return;
- new_comp = icaltimezone_get_component(zone);
+ new_comp = icaltimezone_get_component (zone);
if (!new_comp)
return;
- icalcomponent_add_component(cbd->comp, icalcomponent_new_clone (new_comp));
+ icalcomponent_add_component (cbd->comp, icalcomponent_new_clone (new_comp));
}
static void
-e_cal_backend_ews_create_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *calobj)
+e_cal_backend_ews_create_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *calobj)
{
EwsCreateData *create_data;
EwsConvertData *convert_data;
@@ -1476,21 +1565,21 @@ e_cal_backend_ews_create_object (ECalBackend *backend, EDataCal *cal, guint32 co
ECalComponent *comp;
struct icaltimetype current;
GError *error = NULL;
- const char *send_meeting_invitations;
+ const gchar *send_meeting_invitations;
struct TzidCbData cbd;
/* sanity check */
- e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), InvalidArg);
- e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', InvalidArg);
+ e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (backend), InvalidArg);
+ e_data_cal_error_if_fail (calobj != NULL && *calobj != '\0', InvalidArg);
- cbews = E_CAL_BACKEND_EWS(backend);
+ cbews = E_CAL_BACKEND_EWS (backend);
priv = cbews->priv;
- kind = e_cal_backend_get_kind(E_CAL_BACKEND(backend));
+ kind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
/* make sure we're not offline */
if (!priv->is_online) {
- g_propagate_error(&error, EDC_ERROR(RepositoryOffline));
+ g_propagate_error (&error, EDC_ERROR (RepositoryOffline));
goto exit;
}
@@ -1500,18 +1589,18 @@ e_cal_backend_ews_create_object (ECalBackend *backend, EDataCal *cal, guint32 co
g_propagate_error (&error, EDC_ERROR (InvalidObject));
return;
}
- icalcomp = e_cal_component_get_icalcomponent(comp);
+ icalcomp = e_cal_component_get_icalcomponent (comp);
/* make sure data was parsed properly */
if (!icalcomp) {
- g_propagate_error(&error, EDC_ERROR(InvalidObject));
+ g_propagate_error (&error, EDC_ERROR (InvalidObject));
goto exit;
}
/* make sure ical data we parse is actually an ical component */
- if (kind != icalcomponent_isa(icalcomp)) {
- icalcomponent_free(icalcomp);
- g_propagate_error(&error, EDC_ERROR(InvalidObject));
+ if (kind != icalcomponent_isa (icalcomp)) {
+ icalcomponent_free (icalcomp);
+ g_propagate_error (&error, EDC_ERROR (InvalidObject));
goto exit;
}
@@ -1520,17 +1609,17 @@ e_cal_backend_ews_create_object (ECalBackend *backend, EDataCal *cal, guint32 co
* them using the vtimezones in the current calendar */
cbd.cbews = cbews;
cbd.comp = icalcomp;
- icalcomponent_foreach_tzid(icalcomp, tzid_cb, &cbd);
+ icalcomponent_foreach_tzid (icalcomp, tzid_cb, &cbd);
/* prepare new calender component */
- current = icaltime_current_time_with_zone(icaltimezone_get_utc_timezone());
- e_cal_component_set_created(comp, ¤t);
- e_cal_component_set_last_modified(comp, ¤t);
+ current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+ e_cal_component_set_created (comp, ¤t);
+ e_cal_component_set_last_modified (comp, ¤t);
- create_data = g_new0(EwsCreateData, 1);
- create_data->cbews = g_object_ref(cbews);
+ create_data = g_new0 (EwsCreateData, 1);
+ create_data->cbews = g_object_ref (cbews);
create_data->comp = comp;
- create_data->cal = g_object_ref(cal);
+ create_data->cal = g_object_ref (cal);
create_data->context = context;
convert_data = g_new0 (EwsConvertData, 1);
@@ -1564,11 +1653,13 @@ e_cal_backend_ews_create_object (ECalBackend *backend, EDataCal *cal, guint32 co
return;
exit:
- e_data_cal_respond_create_object(cal, context, error, NULL, NULL);
+ e_data_cal_respond_create_object (cal, context, error, NULL, NULL);
}
static void
-ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_cal_modify_object_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsModifyData *modify_data = user_data;
@@ -1584,7 +1675,7 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
if (!e_ews_connection_update_items_finish (cnc, res, &ids, &error)) {
/* The calendar UI doesn't *display* errors unless they have
- the OtherError code */
+ * the OtherError code */
error->code = OtherError;
if (modify_data->context)
e_data_cal_respond_modify_object (modify_data->cal, modify_data->context, error, NULL, NULL);
@@ -1594,9 +1685,9 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
g_object_ref (modify_data->comp);
g_object_ref (modify_data->oldcomp);
- e_cal_backend_store_freeze_changes(priv->store);
+ e_cal_backend_store_freeze_changes (priv->store);
- item_id = e_ews_item_get_id((EEwsItem *)ids->data);
+ item_id = e_ews_item_get_id ((EEwsItem *) ids->data);
/* Update change key. id remains the same, but change key changed.*/
icalcomp = e_cal_component_get_icalcomponent (modify_data->comp);
@@ -1625,7 +1716,7 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
} else ews_start_sync (modify_data->cbews);
PRIV_LOCK (priv);
- g_hash_table_replace (priv->item_id_hash, g_strdup(modify_data->itemid), g_object_ref (modify_data->comp));
+ g_hash_table_replace (priv->item_id_hash, g_strdup (modify_data->itemid), g_object_ref (modify_data->comp));
PRIV_UNLOCK (priv);
e_cal_backend_store_thaw_changes (priv->store);
@@ -1634,17 +1725,22 @@ ews_cal_modify_object_cb (GObject *object, GAsyncResult *res, gpointer user_data
e_cal_component_free_id (id);
exit:
- g_free(modify_data->itemid);
- g_free(modify_data->changekey);
- g_object_unref(modify_data->comp);
- g_object_unref(modify_data->oldcomp);
- g_object_unref(modify_data->cbews);
- g_object_unref(modify_data->cal);
- g_free(modify_data);
+ g_free (modify_data->itemid);
+ g_free (modify_data->changekey);
+ g_object_unref (modify_data->comp);
+ g_object_unref (modify_data->oldcomp);
+ g_object_unref (modify_data->cbews);
+ g_object_unref (modify_data->cal);
+ g_free (modify_data);
}
static void
-convert_vevent_property_to_updatexml (ESoapMessage *msg, const gchar *name, const gchar *value, const gchar * prefix, const gchar *attr_name, const gchar *attr_value)
+convert_vevent_property_to_updatexml (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *attr_name,
+ const gchar *attr_value)
{
e_ews_message_start_set_item_field (msg, name, prefix, "CalendarItem");
e_ews_message_write_string_parameter_with_attribute (msg, name, NULL, value, attr_name, attr_value);
@@ -1652,7 +1748,8 @@ convert_vevent_property_to_updatexml (ESoapMessage *msg, const gchar *name, cons
}
static void
-convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
+convert_vevent_component_to_updatexml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsModifyData *modify_data = user_data;
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (modify_data->comp);
@@ -1660,16 +1757,16 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
GSList *required = NULL, *optional = NULL, *resource = NULL;
icaltimetype dtstart, dtend, dtstart_old, dtend_old;
icalproperty *prop, *transp;
- const char *org_email_address = NULL, *value = NULL, *old_value = NULL;
+ const gchar *org_email_address = NULL, *value = NULL, *old_value = NULL;
gboolean has_alarms, has_alarms_old, dt_changed = FALSE;
gint alarm = 0, alarm_old = 0;
gchar *recid;
GError *error = NULL;
/* Modifying a recurring meeting ? */
- if (icalcomponent_get_first_property(icalcomp_old, ICAL_RRULE_PROPERTY) != NULL) {
+ if (icalcomponent_get_first_property (icalcomp_old, ICAL_RRULE_PROPERTY) != NULL) {
/* A single occurrence ? */
- prop = icalcomponent_get_first_property(icalcomp, ICAL_RECURRENCEID_PROPERTY);
+ prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
if (prop != NULL) {
recid = icalproperty_get_value_as_string_r (prop);
e_ews_message_start_item_change (msg, E_EWS_ITEMCHANGE_TYPE_OCCURRENCEITEM,
@@ -1685,7 +1782,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
/* subject */
value = icalcomponent_get_summary (icalcomp);
old_value = icalcomponent_get_summary (icalcomp_old);
- if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
+ if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
(value && old_value == NULL)) {
convert_vevent_property_to_updatexml (msg, "Subject", value, "item", NULL, NULL);
} else if (!value && old_value)
@@ -1694,7 +1791,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
/*description*/
value = icalcomponent_get_description (icalcomp);
old_value = icalcomponent_get_description (icalcomp_old);
- if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
+ if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
(value && old_value == NULL)) {
convert_vevent_property_to_updatexml (msg, "Body", value, "item", "BodyType", "Text");
} else if (!value && old_value)
@@ -1708,7 +1805,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
if (has_alarms_old)
alarm_old = ews_get_alarm (modify_data->oldcomp);
if (!(alarm == alarm_old)) {
- char buf[20];
+ gchar buf[20];
snprintf (buf, 20, "%d", alarm);
convert_vevent_property_to_updatexml (msg, "ReminderIsSet", "true", "item", NULL, NULL);
convert_vevent_property_to_updatexml (msg, "ReminderMinutesBeforeStart", buf, "item", NULL, NULL);
@@ -1719,7 +1816,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
/*location*/
value = icalcomponent_get_location (icalcomp);
old_value = icalcomponent_get_location (icalcomp_old);
- if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
+ if ((value && old_value && g_ascii_strcasecmp (value, old_value)) ||
(value && old_value == NULL)) {
convert_vevent_property_to_updatexml (msg, "Location", value, "calendar", NULL, NULL);
} else if (!value && old_value)
@@ -1771,12 +1868,12 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
}
/*need to test it*/
- e_ews_collect_attendees(icalcomp, &required, &optional, &resource);
+ e_ews_collect_attendees (icalcomp, &required, &optional, &resource);
if (required != NULL) {
e_ews_message_start_set_item_field (msg, "RequiredAttendees", "calendar", "CalendarItem");
add_attendees_list_to_message (msg, "RequiredAttendees", required);
- g_slist_free(required);
+ g_slist_free (required);
e_ews_message_end_set_item_field (msg);
}
@@ -1784,7 +1881,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
e_ews_message_start_set_item_field (msg, "OptionalAttendees", "calendar", "CalendarItem");
add_attendees_list_to_message (msg, "OptionalAttendees", optional);
- g_slist_free(optional);
+ g_slist_free (optional);
e_ews_message_end_set_item_field (msg);
}
@@ -1792,7 +1889,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
e_ews_message_start_set_item_field (msg, "Resources", "calendar", "CalendarItem");
add_attendees_list_to_message (msg, "Resources", resource);
- g_slist_free(resource);
+ g_slist_free (resource);
e_ews_message_end_set_item_field (msg);
}
@@ -1808,7 +1905,7 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
if (prop != NULL && g_strcmp0 (value, old_value)) {
e_ews_message_start_set_item_field (msg, "Recurrence", "calendar", "CalendarItem");
- ewscal_set_reccurence(msg, prop, &dtstart);
+ ewscal_set_reccurence (msg, prop, &dtstart);
e_ews_message_end_set_item_field (msg);
}
@@ -1833,7 +1930,12 @@ convert_vevent_component_to_updatexml(ESoapMessage *msg, gpointer user_data)
}
static void
-convert_vtodo_property_to_updatexml (ESoapMessage *msg, const gchar *name, const gchar *value, const gchar * prefix, const gchar *attr_name, const gchar *attr_value)
+convert_vtodo_property_to_updatexml (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *attr_name,
+ const gchar *attr_value)
{
e_ews_message_start_set_item_field (msg, name, prefix, "Task");
e_ews_message_write_string_parameter_with_attribute (msg, name, NULL, value, attr_name, attr_value);
@@ -1841,14 +1943,15 @@ convert_vtodo_property_to_updatexml (ESoapMessage *msg, const gchar *name, const
}
static void
-convert_vtodo_component_to_updatexml (ESoapMessage *msg, gpointer user_data)
+convert_vtodo_component_to_updatexml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsModifyData *modify_data = user_data;
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (modify_data->comp);
icalproperty *prop;
icaltimetype dt;
- int value;
- char buffer[16];
+ gint value;
+ gchar buffer[16];
e_ews_message_start_item_change (msg, E_EWS_ITEMCHANGE_TYPE_ITEM,
modify_data->itemid, modify_data->changekey, 0);
@@ -1904,7 +2007,8 @@ convert_vtodo_component_to_updatexml (ESoapMessage *msg, gpointer user_data)
}
static void
-convert_component_to_updatexml (ESoapMessage *msg, gpointer user_data)
+convert_component_to_updatexml (ESoapMessage *msg,
+ gpointer user_data)
{
EwsModifyData *modify_data = user_data;
icalcomponent *icalcomp = e_cal_component_get_icalcomponent (modify_data->comp);
@@ -1922,8 +2026,12 @@ convert_component_to_updatexml (ESoapMessage *msg, gpointer user_data)
}
static void
-e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable,
- const gchar *calobj, CalObjModType mod)
+e_cal_backend_ews_modify_object (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *calobj,
+ CalObjModType mod)
{
EwsModifyData *modify_data;
ECalBackendEws *cbews;
@@ -1938,34 +2046,34 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
EwsAttachmentsData *attach_data;
struct TzidCbData cbd;
- e_data_cal_error_if_fail(E_IS_CAL_BACKEND_EWS(backend), InvalidArg);
- e_data_cal_error_if_fail(calobj != NULL && *calobj != '\0', InvalidArg);
+ e_data_cal_error_if_fail (E_IS_CAL_BACKEND_EWS (backend), InvalidArg);
+ e_data_cal_error_if_fail (calobj != NULL && *calobj != '\0', InvalidArg);
- cbews = E_CAL_BACKEND_EWS(backend);
+ cbews = E_CAL_BACKEND_EWS (backend);
priv = cbews->priv;
- kind = e_cal_backend_get_kind(E_CAL_BACKEND(backend));
+ kind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
if (!priv->is_online) {
- g_propagate_error(&error, EDC_ERROR(RepositoryOffline));
+ g_propagate_error (&error, EDC_ERROR (RepositoryOffline));
goto exit;
}
- icalcomp = icalparser_parse_string(calobj);
+ icalcomp = icalparser_parse_string (calobj);
if (!icalcomp) {
- g_propagate_error(&error, EDC_ERROR(InvalidObject));
+ g_propagate_error (&error, EDC_ERROR (InvalidObject));
goto exit;
}
- if (kind != icalcomponent_isa(icalcomp)) {
- icalcomponent_free(icalcomp);
- g_propagate_error(&error, EDC_ERROR(InvalidObject));
+ if (kind != icalcomponent_isa (icalcomp)) {
+ icalcomponent_free (icalcomp);
+ g_propagate_error (&error, EDC_ERROR (InvalidObject));
goto exit;
}
-
+
/* pick all the tzids out of the component and resolve
* them using the vtimezones in the current calendar */
cbd.cbews = cbews;
cbd.comp = icalcomp;
- icalcomponent_foreach_tzid(icalcomp, tzid_cb, &cbd);
+ icalcomponent_foreach_tzid (icalcomp, tzid_cb, &cbd);
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomp);
@@ -1974,7 +2082,7 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
ews_cal_component_get_item_id (comp, &itemid, &changekey);
if (!itemid) {
- g_propagate_error(&error, EDC_ERROR_EX(OtherError,
+ g_propagate_error (&error, EDC_ERROR_EX (OtherError,
"Cannot determine EWS ItemId"));
g_object_unref (comp);
goto exit;
@@ -1983,15 +2091,15 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
PRIV_LOCK (priv);
oldcomp = g_hash_table_lookup (priv->item_id_hash, itemid);
if (!oldcomp) {
- g_propagate_error (&error, EDC_ERROR(ObjectNotFound));
+ g_propagate_error (&error, EDC_ERROR (ObjectNotFound));
g_object_unref (comp);
goto exit;
}
PRIV_UNLOCK (priv);
cbd.comp = e_cal_component_get_icalcomponent (oldcomp);
- icalcomponent_foreach_tzid(cbd.comp, tzid_cb, &cbd);
-
+ icalcomponent_foreach_tzid (cbd.comp, tzid_cb, &cbd);
+
/*In case we have updated attachments we have to run update attachments
*before update items so attendees will receive mails with already updated attachments */
@@ -2026,10 +2134,10 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
/*in case we have a new attachmetns the update item will be preformed in ews_create_attachments_cb*/
if (added_attachments) {
- EwsId *item_id = g_new0(EwsId, 1);
+ EwsId *item_id = g_new0 (EwsId, 1);
item_id->id = itemid;
item_id->change_key = changekey;
- attach_data = g_new0(EwsAttachmentsData, 1);
+ attach_data = g_new0 (EwsAttachmentsData, 1);
attach_data->cbews = g_object_ref (cbews);
attach_data->comp = g_object_ref (comp);
@@ -2051,7 +2159,7 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
g_free (item_id);
} else {
- const char *send_meeting_invitations;
+ const gchar *send_meeting_invitations;
modify_data = g_new0 (EwsModifyData, 1);
modify_data->cbews = g_object_ref (cbews);
modify_data->comp = g_object_ref (comp);
@@ -2060,7 +2168,7 @@ e_cal_backend_ews_modify_object (ECalBackend *backend, EDataCal *cal, guint32 co
modify_data->context = context;
modify_data->itemid = itemid;
modify_data->changekey = changekey;
-
+
if (e_cal_component_has_attendees (comp))
send_meeting_invitations = "SendToAllAndSaveCopy";
else
@@ -2090,23 +2198,23 @@ exit:
}
typedef struct {
- const char *response_type;
- const char *item_id;
- const char *change_key;
+ const gchar *response_type;
+ const gchar *item_id;
+ const gchar *change_key;
} EwsAcceptData;
static gchar *
e_ews_get_icalcomponent_as_mime_content (icalcomponent *vevent)
{
icalcomponent *vcal;
- char *vcal_str;
+ gchar *vcal_str;
vcal = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
icalcomponent_add_property (vcal, icalproperty_new_version("2.0"));
- icalcomponent_add_property (vcal, icalproperty_new_method(ICAL_METHOD_REQUEST));
+ icalcomponent_add_property (vcal, icalproperty_new_method (ICAL_METHOD_REQUEST));
icalcomponent_add_component (vcal, icalcomponent_new_clone (vevent));
- vcal_str = icalcomponent_as_ical_string_r ((icalcomponent *)vcal);
+ vcal_str = icalcomponent_as_ical_string_r ((icalcomponent *) vcal);
icalcomponent_free (vcal);
@@ -2114,20 +2222,25 @@ e_ews_get_icalcomponent_as_mime_content (icalcomponent *vevent)
}
static void
-prepare_create_item_with_mime_content_request(ESoapMessage *msg, gpointer user_data)
+prepare_create_item_with_mime_content_request (ESoapMessage *msg,
+ gpointer user_data)
{
- gchar *mime_content = (gchar*) user_data;
+ gchar *mime_content = (gchar *) user_data;
/* Prepare CalendarItem node in the SOAP message */
e_soap_message_start_element(msg, "CalendarItem", NULL, NULL);
e_ews_message_write_base64_parameter (msg,"MimeContent",NULL,mime_content);
// end of "CalendarItem"
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
}
static void
-e_ews_receive_objects_no_exchange_mail (ECalBackendEwsPrivate *priv, icalcomponent *subcomp, GSList *ids, GCancellable *cancellable, GError *error)
+e_ews_receive_objects_no_exchange_mail (ECalBackendEwsPrivate *priv,
+ icalcomponent *subcomp,
+ GSList *ids,
+ GCancellable *cancellable,
+ GError *error)
{
gchar *mime_content = e_ews_get_icalcomponent_as_mime_content (subcomp);
e_ews_connection_create_items (priv->cnc, EWS_PRIORITY_MEDIUM,
@@ -2141,17 +2254,18 @@ e_ews_receive_objects_no_exchange_mail (ECalBackendEwsPrivate *priv, icalcompone
/*we still have to send a mail with accept to meeting organizer*/
}
-static const char*
-e_ews_get_current_user_meeting_reponse (icalcomponent *icalcomp, const char *current_user_mail)
+static const gchar *
+e_ews_get_current_user_meeting_reponse (icalcomponent *icalcomp,
+ const gchar *current_user_mail)
{
icalproperty *attendee;
- const char *attendee_str = NULL, *attendee_mail = NULL;
+ const gchar *attendee_str = NULL, *attendee_mail = NULL;
for (attendee = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
attendee != NULL;
attendee = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
attendee_str = icalproperty_get_attendee (attendee);
- if (attendee_str != NULL){
+ if (attendee_str != NULL) {
if (!strncasecmp (attendee_str, "MAILTO:", 7))
attendee_mail = attendee_str + 7;
else
@@ -2164,24 +2278,25 @@ e_ews_get_current_user_meeting_reponse (icalcomponent *icalcomp, const char *cur
}
static void
-prepare_accept_item_request (ESoapMessage *msg, gpointer user_data)
+prepare_accept_item_request (ESoapMessage *msg,
+ gpointer user_data)
{
EwsAcceptData *data = user_data;
- const char *response_type = data->response_type;
+ const gchar *response_type = data->response_type;
/* FORMAT OF A SAMPLE SOAP MESSAGE: http://msdn.microsoft.com/en-us/library/aa566464%28v=exchg.140%29.aspx
* Accept and Decline meeting have same method code (10032)
* The real status is reflected at Attendee property PARTSTAT
* need to find current user as attendee and make a decision what to do.
* Prepare AcceptItem node in the SOAP message */
-
+
if (response_type && !g_ascii_strcasecmp (response_type, "ACCEPTED"))
e_soap_message_start_element (msg, "AcceptItem", NULL, NULL);
else if (response_type && !g_ascii_strcasecmp (response_type, "DECLINED"))
e_soap_message_start_element (msg, "DeclineItem", NULL, NULL);
else
e_soap_message_start_element (msg, "TentativelyAcceptItem", NULL, NULL);
-
+
e_soap_message_start_element (msg, "ReferenceItemId", NULL, NULL);
e_soap_message_add_attribute (msg, "Id", data->item_id, NULL, NULL);
e_soap_message_add_attribute (msg, "ChangeKey", data->change_key, NULL, NULL);
@@ -2192,7 +2307,8 @@ prepare_accept_item_request (ESoapMessage *msg, gpointer user_data)
}
static void
-prepare_set_free_busy_status (ESoapMessage *msg, gpointer user_data)
+prepare_set_free_busy_status (ESoapMessage *msg,
+ gpointer user_data)
{
EwsAcceptData *data = user_data;
@@ -2208,7 +2324,11 @@ prepare_set_free_busy_status (ESoapMessage *msg, gpointer user_data)
}
static void
-e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *calobj)
+e_cal_backend_ews_receive_objects (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *calobj)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -2218,7 +2338,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, guint32
icalproperty_method method;
EwsAcceptData *accept_data;
- cbews = E_CAL_BACKEND_EWS(backend);
+ cbews = E_CAL_BACKEND_EWS (backend);
priv = cbews->priv;
/* make sure we're not offline */
@@ -2248,12 +2368,11 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, guint32
while (subcomp) {
ECalComponent *comp = e_cal_component_new ();
- const char *response_type;
+ const gchar *response_type;
gchar *item_id = NULL, *change_key = NULL;
GSList *ids = NULL, *l;
icalproperty *recurrence_id, *transp, *summary;
- char **split_subject;
-
+ gchar **split_subject;
/* duplicate the ical component */
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp));
@@ -2299,7 +2418,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, guint32
break;
}
}
- e_ews_connection_update_items (priv->cnc,
+ e_ews_connection_update_items (priv->cnc,
EWS_PRIORITY_MEDIUM,
"AlwaysOverwrite",
NULL, "SendToNone",
@@ -2334,7 +2453,7 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, guint32
icalproperty_set_value_from_string (summary, split_subject[1] , "NO");
g_strfreev (split_subject);
- e_cal_backend_ews_modify_object (backend, cal, 0, cancellable, icalcomponent_as_ical_string(subcomp), CALOBJ_MOD_ALL);
+ e_cal_backend_ews_modify_object (backend, cal, 0, cancellable, icalcomponent_as_ical_string (subcomp), CALOBJ_MOD_ALL);
}
break;
default:
@@ -2350,7 +2469,7 @@ exit:
e_data_cal_respond_receive_objects (cal, context, error);
}
-static const char *
+static const gchar *
e_cal_get_meeting_cancellation_comment (ECalComponent *comp)
{
icalproperty *prop;
@@ -2370,35 +2489,44 @@ e_cal_get_meeting_cancellation_comment (ECalComponent *comp)
}
-static icaltimezone*
-e_cal_get_timezone_from_ical_component (ECalBackend *backend, icalcomponent *comp) {
- icalproperty *prop;
- icalparameter *param;
-
- prop = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
- if ((param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER))) {
- const char *tzid = icalparameter_get_tzid (param);
- icaltimezone *zone;
+static icaltimezone *
+e_cal_get_timezone_from_ical_component (ECalBackend *backend,
+ icalcomponent *comp) {
+ icalproperty *prop;
+ icalparameter *param;
+
+ prop = icalcomponent_get_first_property (comp,
+ ICAL_DTSTART_PROPERTY);
+ if ((param = icalproperty_get_first_parameter (prop,
+ ICAL_TZID_PARAMETER))) {
+ const gchar *tzid = icalparameter_get_tzid (param);
+ icaltimezone *zone;
+
+ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ if (zone)
+ return zone;
+
+ return e_cal_backend_ews_internal_get_timezone (E_CAL_BACKEND (backend), tzid);
+ }
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (zone)
- return zone;
-
- return e_cal_backend_ews_internal_get_timezone (E_CAL_BACKEND (backend), tzid);
- }
-
g_warning ("EEE Cant figure the relevant timezone of the component\n");
- return NULL;
+ return NULL;
}
static void
-ewscal_send_cancellation_email (ECalBackend *backend, EEwsConnection *cnc, CamelAddress *from, CamelInternetAddress *recipient, const gchar *subject, const gchar *body, const gchar *calobj)
+ewscal_send_cancellation_email (ECalBackend *backend,
+ EEwsConnection *cnc,
+ CamelAddress *from,
+ CamelInternetAddress *recipient,
+ const gchar *subject,
+ const gchar *body,
+ const gchar *calobj)
{
CamelMimeMessage *message;
GError *error = NULL;
CamelMultipart *multi;
CamelMimePart *text_part, *vcal_part;
- char *ical_str;
+ gchar *ical_str;
icalcomponent *vcal, *vevent, *vtz;
icalproperty *prop;
icaltimezone *icaltz;
@@ -2407,11 +2535,11 @@ ewscal_send_cancellation_email (ECalBackend *backend, EEwsConnection *cnc, Camel
vcal = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
icalcomponent_add_property (vcal, icalproperty_new_version("2.0"));
icalcomponent_add_property (vcal, icalproperty_new_prodid("-//Evolution EWS backend//EN"));
- icalcomponent_add_property (vcal, icalproperty_new_method(ICAL_METHOD_CANCEL));
+ icalcomponent_add_property (vcal, icalproperty_new_method (ICAL_METHOD_CANCEL));
vevent = icalcomponent_new_from_string (calobj);
prop = icalcomponent_get_first_property (vevent, ICAL_STATUS_PROPERTY);
if (prop != NULL) icalcomponent_remove_property (vevent, prop);
- icalcomponent_add_property (vevent, icalproperty_new_status(ICAL_STATUS_CANCELLED));
+ icalcomponent_add_property (vevent, icalproperty_new_status (ICAL_STATUS_CANCELLED));
prop = icalcomponent_get_first_property (vevent, ICAL_METHOD_PROPERTY);
if (prop != NULL) icalcomponent_remove_property (vevent, prop);
dt = icalcomponent_get_dtstart (vevent);
@@ -2425,7 +2553,7 @@ ewscal_send_cancellation_email (ECalBackend *backend, EEwsConnection *cnc, Camel
vcal_part = camel_mime_part_new ();
camel_content_type_set_param(CAMEL_DATA_WRAPPER (vcal_part)->mime_type, "charset", "utf-8");
camel_content_type_set_param(CAMEL_DATA_WRAPPER (vcal_part)->mime_type, "method", "CANCEL");
- ical_str = icalcomponent_as_ical_string_r ((icalcomponent *)vcal);
+ ical_str = icalcomponent_as_ical_string_r ((icalcomponent *) vcal);
camel_mime_part_set_content (vcal_part, ical_str, strlen (ical_str), "text/calendar; method=CANCEL");
free (ical_str);
@@ -2442,7 +2570,7 @@ ewscal_send_cancellation_email (ECalBackend *backend, EEwsConnection *cnc, Camel
camel_mime_message_set_from (message, CAMEL_INTERNET_ADDRESS (from));
camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_TO, recipient);
- camel_medium_set_content ((CamelMedium *)message, (CamelDataWrapper *)multi);
+ camel_medium_set_content ((CamelMedium *) message, (CamelDataWrapper *) multi);
g_object_unref (multi);
camel_ews_utils_create_mime_message (cnc, "SendOnly", NULL, message, 0, from, NULL, NULL, NULL, &error);
@@ -2457,7 +2585,11 @@ ewscal_send_cancellation_email (ECalBackend *backend, EEwsConnection *cnc, Camel
}
static void
-e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable, const gchar *calobj)
+e_cal_backend_ews_send_objects (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const gchar *calobj)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -2466,8 +2598,7 @@ e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, guint32 con
GError *error = NULL;
gchar *subcalobj;
-
- cbews = E_CAL_BACKEND_EWS(backend);
+ cbews = E_CAL_BACKEND_EWS (backend);
priv = cbews->priv;
/* make sure we're not offline */
@@ -2500,18 +2631,18 @@ e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, guint32 con
subcomp = icalcomp;
while (subcomp) {
ECalComponent *comp = e_cal_component_new ();
- const char *new_body_content = NULL, *subject = NULL, *org_email = NULL;
+ const gchar *new_body_content = NULL, *subject = NULL, *org_email = NULL;
const gchar *org = NULL, *attendee = NULL;
icalproperty *prop, *org_prop = NULL;
CamelInternetAddress *org_addr = camel_internet_address_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp));
- new_body_content = e_cal_get_meeting_cancellation_comment(comp);
+ new_body_content = e_cal_get_meeting_cancellation_comment (comp);
subject = icalproperty_get_value_as_string (icalcomponent_get_first_property (subcomp, ICAL_SUMMARY_PROPERTY));
org_prop = icalcomponent_get_first_property (subcomp, ICAL_ORGANIZER_PROPERTY);
- org = icalproperty_get_organizer(org_prop);
+ org = icalproperty_get_organizer (org_prop);
if (!g_ascii_strncasecmp (org, "MAILTO:", 7))
org_email = (org) + 7;
else
@@ -2531,7 +2662,7 @@ e_cal_backend_ews_send_objects (ECalBackend *backend, EDataCal *cal, guint32 con
subcalobj = icalcomponent_as_ical_string_r (subcomp);
camel_internet_address_add (attendee_addr, icalproperty_get_parameter_as_string (prop, "CN"), attendee);
- ewscal_send_cancellation_email (backend, priv->cnc, CAMEL_ADDRESS(org_addr), attendee_addr, subject, new_body_content, subcalobj);
+ ewscal_send_cancellation_email (backend, priv->cnc, CAMEL_ADDRESS (org_addr), attendee_addr, subject, new_body_content, subcalobj);
g_object_unref (attendee_addr);
free (subcalobj);
}
@@ -2549,7 +2680,8 @@ exit:
/* TODO Do not replicate this in every backend */
static icaltimezone *
-resolve_tzid (const gchar *tzid, gpointer user_data)
+resolve_tzid (const gchar *tzid,
+ gpointer user_data)
{
icaltimezone *zone;
@@ -2565,7 +2697,7 @@ resolve_tzid (const gchar *tzid, gpointer user_data)
static void
put_component_to_store (ECalBackendEws *cbews,
- ECalComponent *comp)
+ ECalComponent *comp)
{
time_t time_start, time_end;
ECalBackendEwsPrivate *priv;
@@ -2582,11 +2714,13 @@ put_component_to_store (ECalBackendEws *cbews,
typedef struct {
ECalComponent *comp;
ECalBackendEws *cbews;
- gchar* itemid;
+ gchar * itemid;
} EwsAttachmentData;
static void
-ews_get_attachments_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+ews_get_attachments_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
EwsAttachmentData *att_data = user_data;
@@ -2639,13 +2773,14 @@ ews_get_attachments_ready_callback (GObject *object, GAsyncResult *res, gpointer
g_slist_foreach (uris, (GFunc) g_free, NULL);
g_slist_free (uris);
- g_free(itemid);
- g_object_unref(att_data->comp);
- g_free(att_data);
+ g_free (itemid);
+ g_object_unref (att_data->comp);
+ g_free (att_data);
}
static void
-ews_get_attachments (ECalBackendEws *cbews, EEwsItem *item)
+ews_get_attachments (ECalBackendEws *cbews,
+ EEwsItem *item)
{
gboolean has_attachment = FALSE;
@@ -2678,7 +2813,8 @@ ews_get_attachments (ECalBackendEws *cbews, EEwsItem *item)
}
static void
-add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
+add_item_to_cache (ECalBackendEws *cbews,
+ EEwsItem *item)
{
ECalBackendEwsPrivate *priv;
icalcomponent_kind kind;
@@ -2688,14 +2824,14 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
kind = e_cal_backend_get_kind ((ECalBackend *) cbews);
priv = cbews->priv;
- if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_TASK){
+ if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_TASK) {
icalproperty *icalprop;
icaltimetype due_date, start_date, complete_date, created;
icalproperty_status status = ICAL_STATUS_NONE;
icalproperty_class class = ICAL_CLASS_NONE;
- const char *ews_task_status, *sensitivity;
+ const gchar *ews_task_status, *sensitivity;
EwsImportance item_importance;
- int priority = 5;
+ gint priority = 5;
gboolean has_this_date = FALSE;
vcomp = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
@@ -2779,11 +2915,11 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
/*task assaingments*/
if (e_ews_item_get_delegator (item)!= NULL) {
- const char *task_owner = e_ews_item_get_delegator (item);
+ const gchar *task_owner = e_ews_item_get_delegator (item);
GSList *mailboxes = NULL, *l;
GError *error = NULL;
gboolean includes_last_item;
- char *mailtoname;
+ gchar *mailtoname;
icalparameter *param;
/*The task owner according to Exchange is current user, even that the task was assigned by
@@ -2791,7 +2927,7 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
mailtoname = g_strdup_printf ("mailto:%s", priv->user_email);
icalprop = icalproperty_new_attendee (mailtoname);
- g_free(mailtoname);
+ g_free (mailtoname);
param = icalparameter_new_cn (e_ews_item_get_owner (item));
icalproperty_add_parameter (icalprop, param);
@@ -2819,7 +2955,6 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
g_slist_free (mailboxes);
}
-
icalcomponent_add_component (vcomp,icalcomp);
} else {
struct icaltimetype dt;
@@ -2832,15 +2967,15 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
if (vtimezone) {
zone = icaltimezone_new ();
icaltimezone_set_component (zone, icalcomponent_new_clone (vtimezone));
- if (icaltimezone_get_tzid(zone))
+ if (icaltimezone_get_tzid (zone))
e_cal_backend_store_put_timezone (priv->store, zone);
icaltimezone_free (zone, TRUE);
}
zone = NULL;
- if (e_ews_item_get_tzid (item) && (zone = (icaltimezone *)e_cal_backend_store_get_timezone(priv->store, e_ews_item_get_tzid (item))) == NULL)
- zone = (icaltimezone *)icaltimezone_get_builtin_timezone(e_ews_item_get_tzid (item));
+ if (e_ews_item_get_tzid (item) && (zone = (icaltimezone *) e_cal_backend_store_get_timezone (priv->store, e_ews_item_get_tzid (item))) == NULL)
+ zone = (icaltimezone *) icaltimezone_get_builtin_timezone (e_ews_item_get_tzid (item));
if (zone) {
icalcomp = icalcomponent_get_first_component (vcomp, kind);
@@ -2864,26 +2999,26 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
const EwsId *item_id;
ECalComponentId *id;
const GSList *l = NULL;
- const char *org_email_address = e_ews_collect_organizer(icalcomp);
- const char *uid = e_ews_item_get_uid (item);
+ const gchar *org_email_address = e_ews_collect_organizer (icalcomp);
+ const gchar *uid = e_ews_item_get_uid (item);
item_id = e_ews_item_get_id (item);
/* Attendees */
for (l = e_ews_item_get_attendees (item); l != NULL; l = g_slist_next (l)) {
icalparameter *param, *cu_type;
- char *mailtoname;
- EwsAttendee *attendee = (EwsAttendee *)l->data;
+ gchar *mailtoname;
+ EwsAttendee *attendee = (EwsAttendee *) l->data;
/*remove organizer for attendees list*/
if (g_ascii_strcasecmp (org_email_address, attendee->mailbox->email)== 0)
continue;
mailtoname = g_strdup_printf("mailto:%s", attendee->mailbox->email);
- icalprop = icalproperty_new_attendee(mailtoname);
- g_free(mailtoname);
+ icalprop = icalproperty_new_attendee (mailtoname);
+ g_free (mailtoname);
- param = icalparameter_new_cn(attendee->mailbox->name);
- icalproperty_add_parameter(icalprop, param);
+ param = icalparameter_new_cn (attendee->mailbox->name);
+ icalproperty_add_parameter (icalprop, param);
if (g_ascii_strcasecmp(attendee->attendeetype, "Required") == 0) {
param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT);
@@ -2912,16 +3047,16 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
param = icalparameter_new_partstat (ICAL_PARTSTAT_NEEDSACTION);
else if (g_ascii_strcasecmp (attendee->responsetype, "Unknown") == 0)
param = icalparameter_new_partstat (ICAL_PARTSTAT_NONE);
- icalproperty_add_parameter(icalprop, param);
+ icalproperty_add_parameter (icalprop, param);
- icalcomponent_add_property(icalcomp, icalprop);
+ icalcomponent_add_property (icalcomp, icalprop);
}
/* Free/Busy */
freebusy = icalcomponent_get_first_property (icalcomp, ICAL_TRANSP_PROPERTY);
- if (!freebusy && (e_ews_item_get_item_type(item)!=E_EWS_ITEM_TYPE_TASK)) {
+ if (!freebusy && (e_ews_item_get_item_type (item) != E_EWS_ITEM_TYPE_TASK)) {
/* Busy by default */
- freebusy = icalproperty_new_transp(ICAL_TRANSP_OPAQUE);
+ freebusy = icalproperty_new_transp (ICAL_TRANSP_OPAQUE);
icalcomponent_add_property (icalcomp, freebusy);
}
for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
@@ -2930,9 +3065,9 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
if (g_strcmp0(icalproperty_get_x_name(icalprop), "X-MICROSOFT-CDO-BUSYSTATUS") == 0) {
if (g_strcmp0(icalproperty_get_value_as_string(icalprop), "BUSY") == 0) {
- icalproperty_set_transp(freebusy, ICAL_TRANSP_OPAQUE);
+ icalproperty_set_transp (freebusy, ICAL_TRANSP_OPAQUE);
} else {
- icalproperty_set_transp(freebusy, ICAL_TRANSP_TRANSPARENT);
+ icalproperty_set_transp (freebusy, ICAL_TRANSP_TRANSPARENT);
}
break;
@@ -2983,7 +3118,7 @@ add_item_to_cache (ECalBackendEws *cbews, EEwsItem *item)
}
}
- icalcomponent_set_uid (icalcomp,uid?uid:item_id->id);
+ icalcomponent_set_uid (icalcomp,uid ? uid : item_id->id);
icalprop = icalproperty_new_x (item_id->id);
icalproperty_set_x_name (icalprop, "X-EVOLUTION-ITEMID");
@@ -3025,7 +3160,9 @@ struct _ews_sync_data {
};
static void
-ews_cal_get_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
+ews_cal_get_items_ready_cb (GObject *obj,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc;
ECalBackendEws *cbews;
@@ -3052,7 +3189,7 @@ ews_cal_get_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
}
/* fetch modified occurrences */
- for (l = items; l != NULL; l = g_slist_next(l)) {
+ for (l = items; l != NULL; l = g_slist_next (l)) {
const GSList *modified_occurrences = e_ews_item_get_modified_occurrences (l->data);
if (modified_occurrences) {
@@ -3062,13 +3199,13 @@ ews_cal_get_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
sub_sync_data->cbews = sync_data->cbews;
sub_sync_data->master_uid = g_strdup (item_id->id);
- e_ews_connection_get_items_start(g_object_ref(cnc), EWS_PRIORITY_MEDIUM,
+ e_ews_connection_get_items_start (g_object_ref (cnc), EWS_PRIORITY_MEDIUM,
modified_occurrences,
"IdOnly", "item:Attachments item:HasAttachments item:MimeContent calendar:TimeZone calendar:UID calendar:Resources calendar:ModifiedOccurrences calendar:RequiredAttendees calendar:OptionalAttendees",
FALSE, NULL, ews_cal_get_items_ready_cb, NULL, NULL, NULL,
(gpointer) sub_sync_data);
- g_object_unref(cnc);
+ g_object_unref (cnc);
}
}
@@ -3084,7 +3221,6 @@ ews_cal_get_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
}
e_cal_backend_store_thaw_changes (priv->store);
-
if (sync_data->sync_state)
e_cal_backend_store_put_key_value (priv->store, SYNC_KEY, sync_data->sync_state);
if (sync_data->sync_pending)
@@ -3103,7 +3239,9 @@ exit:
}
static void
-ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
+ews_cal_sync_items_ready_cb (GObject *obj,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc;
ECalBackendEws *cbews;
@@ -3143,7 +3281,7 @@ ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data
l[1] = items_updated;
for (i = 0; i < 2; i++) {
- for (;l[i] != NULL; l[i] = g_slist_next (l[i])) {
+ for (; l[i] != NULL; l[i] = g_slist_next (l[i])) {
EEwsItem *item = (EEwsItem *) l[i]->data;
EEwsItemType type = e_ews_item_get_item_type (item);
const EwsId *id;
@@ -3167,7 +3305,7 @@ ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data
PRIV_UNLOCK (priv);
if (comp)
- ews_cal_delete_comp(cbews, comp, item_id);
+ ews_cal_delete_comp (cbews, comp, item_id);
g_free (m->data);
}
@@ -3215,7 +3353,6 @@ ews_cal_sync_items_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data
NULL, NULL, NULL,
(gpointer) sync_data);
-
exit:
if (cal_item_ids) {
g_slist_foreach (cal_item_ids, (GFunc) g_free, NULL);
@@ -3235,7 +3372,7 @@ exit:
}
static gboolean
-ews_start_sync (gpointer data)
+ews_start_sync (gpointer data)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -3269,7 +3406,7 @@ ews_cal_start_refreshing (ECalBackendEws *cbews)
PRIV_LOCK (priv);
if (!priv->refresh_timeout &&
- priv->is_online &&
+ priv->is_online &&
priv->cnc) {
ews_start_sync (cbews);
priv->refresh_timeout = g_timeout_add_seconds
@@ -3282,7 +3419,8 @@ ews_cal_start_refreshing (ECalBackendEws *cbews)
}
static void
-e_cal_backend_ews_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_ews_start_query (ECalBackend *backend,
+ EDataCalView *query)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -3334,7 +3472,10 @@ e_cal_backend_ews_start_query (ECalBackend *backend, EDataCalView *query)
}
static void
-e_cal_backend_ews_refresh (ECalBackend *backend, EDataCal *cal, guint32 context, GCancellable *cancellable)
+e_cal_backend_ews_refresh (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable)
{
ECalBackendEws *cbews;
ECalBackendEwsPrivate *priv;
@@ -3345,13 +3486,13 @@ e_cal_backend_ews_refresh (ECalBackend *backend, EDataCal *cal, guint32 context,
/* make sure we're not offline */
if (!priv->is_online) {
- g_propagate_error(&error, EDC_ERROR(RepositoryOffline));
+ g_propagate_error (&error, EDC_ERROR (RepositoryOffline));
goto exit;
}
- PRIV_LOCK(priv);
- ews_start_sync(cbews);
- PRIV_UNLOCK(priv);
+ PRIV_LOCK (priv);
+ ews_start_sync (cbews);
+ PRIV_UNLOCK (priv);
exit:
e_data_cal_respond_refresh (cal, context, error);
@@ -3368,7 +3509,8 @@ typedef struct {
} EwsFreeBusyData;
static void
-prepare_free_busy_request (ESoapMessage *msg, gpointer user_data)
+prepare_free_busy_request (ESoapMessage *msg,
+ gpointer user_data)
{
EwsFreeBusyData *free_busy_data = user_data;
GSList *addr;
@@ -3409,9 +3551,11 @@ prepare_free_busy_request (ESoapMessage *msg, gpointer user_data)
}
static void
-ews_cal_get_free_busy_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
+ews_cal_get_free_busy_cb (GObject *obj,
+ GAsyncResult *res,
+ gpointer user_data)
{
- EEwsConnection *cnc = (EEwsConnection *)obj;
+ EEwsConnection *cnc = (EEwsConnection *) obj;
EwsFreeBusyData *free_busy_data = user_data;
GSList *free_busy_sl = NULL, *i;
GSList *free_busy = NULL, *j;
@@ -3421,10 +3565,10 @@ ews_cal_get_free_busy_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
error->code = OtherError;
goto done;
}
-
+
for (i = free_busy_sl, j = free_busy_data->users; i && j; i = i->next, j = j->next) {
/* add attendee property */
- icalcomponent_add_property((icalcomponent *)i->data, icalproperty_new_attendee (j->data));
+ icalcomponent_add_property ((icalcomponent *) i->data, icalproperty_new_attendee (j->data));
free_busy = g_slist_append (free_busy, icalcomponent_as_ical_string_r (i->data));
}
@@ -3438,7 +3582,7 @@ done:
/* FIXME free free_busy_sl ? */
g_slist_foreach (free_busy, (GFunc) g_free, NULL);
g_slist_free (free_busy);
- g_slist_foreach (free_busy_data->users, (GFunc)free, NULL);
+ g_slist_foreach (free_busy_data->users, (GFunc) free, NULL);
g_slist_free (free_busy_data->users);
g_object_unref (free_busy_data->cal);
g_object_unref (free_busy_data->cbews);
@@ -3446,9 +3590,13 @@ done:
}
static void
-e_cal_backend_ews_get_free_busy (ECalBackend *backend, EDataCal *cal,
- guint32 context, GCancellable *cancellable, const GSList *users,
- time_t start, time_t end)
+e_cal_backend_ews_get_free_busy (ECalBackend *backend,
+ EDataCal *cal,
+ guint32 context,
+ GCancellable *cancellable,
+ const GSList *users,
+ time_t start,
+ time_t end)
{
ECalBackendEws *cbews = E_CAL_BACKEND_EWS (backend);
ECalBackendEwsPrivate *priv = cbews->priv;
@@ -3463,14 +3611,14 @@ e_cal_backend_ews_get_free_busy (ECalBackend *backend, EDataCal *cal,
}
/* EWS can support only 100 identities, which is the maximum number of identities that the Web service method can request
- see http://msdn.microsoft.com/en-us/library/aa564001%28v=EXCHG.140%29.aspx*/
+ see http://msdn.microsoft.com / en - us / library / aa564001 % 28v = EXCHG.140 % 29.aspx */
if (g_slist_length ((GSList *) users) > 100)
{
g_propagate_error (&error, EDC_ERROR (SearchSizeLimitExceeded));
goto exit;
}
- for (;users; users = users->next)
+ for (; users; users = users->next)
users_copy = g_slist_append (users_copy, g_strdup (users->data));
free_busy_data = g_new0 (EwsFreeBusyData, 1);
@@ -3498,13 +3646,13 @@ exit:
}
static void
-e_cal_backend_ews_get_backend_property (ECalBackend *backend,
+e_cal_backend_ews_get_backend_property (ECalBackend *backend,
EDataCal *cal,
- guint32 opid,
+ guint32 opid,
GCancellable *cancellable,
const gchar *prop_name)
{
- gchar *prop_value = NULL;
+ gchar *prop_value = NULL;
GError *error = NULL;
g_return_if_fail (prop_name != NULL);
@@ -3563,7 +3711,7 @@ e_cal_backend_ews_get_backend_property (ECalBackend *backend,
static void
e_cal_backend_ews_notify_online_cb (ECalBackend *backend,
- GParamSpec *spec)
+ GParamSpec *spec)
{
ECalBackendEws *cbgw;
ECalBackendEwsPrivate *priv;
@@ -3661,7 +3809,7 @@ e_cal_backend_ews_finalize (GObject *object)
e_credentials_free (priv->credentials);
priv->credentials = NULL;
-
+
g_free (priv);
cbews->priv = NULL;
@@ -3711,7 +3859,7 @@ e_cal_backend_ews_class_init (ECalBackendEwsClass *class)
backend_class->get_backend_property = e_cal_backend_ews_get_backend_property;
backend_class->start_view = e_cal_backend_ews_start_query;
-
+
/* Many of these can be moved to Base class */
backend_class->add_timezone = e_cal_backend_ews_add_timezone;
backend_class->get_timezone = e_cal_backend_ews_get_timezone;
@@ -3723,7 +3871,6 @@ e_cal_backend_ews_class_init (ECalBackendEwsClass *class)
backend_class->get_object_list = e_cal_backend_ews_get_object_list;
backend_class->remove = e_cal_backend_ews_remove;
-
backend_class->discard_alarm = e_cal_backend_ews_discard_alarm;
backend_class->create_object = e_cal_backend_ews_create_object;
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index 3b4c661..f43e55f 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -24,7 +24,7 @@
/* This file is broken and suffers from multiple author syndrome.
This needs to be rewritten with a lot of functions cleaned up.
-
+ *
There are a lot of places where code is unneccesarily duplicated,
which needs to be better organized via functions */
@@ -98,13 +98,15 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
G_DEFINE_TYPE (CamelEwsFolder, camel_ews_folder, CAMEL_TYPE_OFFLINE_FOLDER)
static gchar *
-ews_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
+ews_get_filename (CamelFolder *folder,
+ const gchar *uid,
+ GError **error)
{
- CamelEwsFolder *ews_folder = CAMEL_EWS_FOLDER(folder);
+ CamelEwsFolder *ews_folder = CAMEL_EWS_FOLDER (folder);
GChecksum *sha = g_checksum_new (G_CHECKSUM_SHA256);
gchar *ret;
- g_checksum_update(sha, (guchar *)uid, strlen(uid));
+ g_checksum_update (sha, (guchar *) uid, strlen (uid));
ret = camel_data_cache_get_filename (ews_folder->cache, "cur",
g_checksum_get_string (sha),
error);
@@ -114,14 +116,14 @@ ews_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
static gint
ews_data_cache_remove (CamelDataCache *cdc,
- const gchar *path,
- const gchar *key,
- GError **error)
+ const gchar *path,
+ const gchar *key,
+ GError **error)
{
GChecksum *sha = g_checksum_new (G_CHECKSUM_SHA256);
gint ret;
- g_checksum_update(sha, (guchar *)key, strlen(key));
+ g_checksum_update (sha, (guchar *) key, strlen (key));
ret = camel_data_cache_remove (cdc, path, g_checksum_get_string (sha),
error);
g_checksum_free (sha);
@@ -130,14 +132,14 @@ ews_data_cache_remove (CamelDataCache *cdc,
static CamelStream *
ews_data_cache_get (CamelDataCache *cdc,
- const gchar *path,
- const gchar *key,
- GError **error)
+ const gchar *path,
+ const gchar *key,
+ GError **error)
{
GChecksum *sha = g_checksum_new (G_CHECKSUM_SHA256);
CamelStream *ret;
- g_checksum_update(sha, (guchar *)key, strlen(key));
+ g_checksum_update (sha, (guchar *) key, strlen (key));
ret = camel_data_cache_get (cdc, path, g_checksum_get_string (sha),
error);
g_checksum_free (sha);
@@ -146,14 +148,14 @@ ews_data_cache_get (CamelDataCache *cdc,
static gchar *
ews_data_cache_get_filename (CamelDataCache *cdc,
- const gchar *path,
- const gchar *key,
- GError **error)
+ const gchar *path,
+ const gchar *key,
+ GError **error)
{
GChecksum *sha = g_checksum_new (G_CHECKSUM_SHA256);
gchar *ret;
- g_checksum_update(sha, (guchar *)key, strlen(key));
+ g_checksum_update (sha, (guchar *) key, strlen (key));
ret = camel_data_cache_get_filename (cdc, path,
g_checksum_get_string (sha),
error);
@@ -161,9 +163,11 @@ ews_data_cache_get_filename (CamelDataCache *cdc,
return ret;
}
-
static CamelMimeMessage *
-camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder, const gchar *uid, GCancellable *cancellable, GError **error)
+camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder,
+ const gchar *uid,
+ GCancellable *cancellable,
+ GError **error)
{
CamelStream *stream;
CamelMimeMessage *msg;
@@ -193,7 +197,7 @@ camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder, const gchar
msg = camel_mime_message_new ();
if (!camel_data_wrapper_construct_from_stream_sync (
- (CamelDataWrapper *)msg, stream, cancellable, error)) {
+ (CamelDataWrapper *) msg, stream, cancellable, error)) {
g_object_unref (msg);
msg = NULL;
}
@@ -205,7 +209,7 @@ camel_ews_folder_get_message_from_cache (CamelEwsFolder *ews_folder, const gchar
}
static CamelMimePart *
-ews_get_calendar_mime_part (CamelMimePart* mimepart)
+ews_get_calendar_mime_part (CamelMimePart *mimepart)
{
guint partnumber, i;
CamelDataWrapper *datawrapper;
@@ -221,7 +225,7 @@ ews_get_calendar_mime_part (CamelMimePart* mimepart)
if (!child_mimepart)
goto exit;
- ret_mimepart = ews_get_calendar_mime_part (child_mimepart) ;
+ ret_mimepart = ews_get_calendar_mime_part (child_mimepart);
if (ret_mimepart)
return ret_mimepart;
}
@@ -240,12 +244,15 @@ ews_get_calendar_mime_part (CamelMimePart* mimepart)
}
static gchar *
-ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId* item_id, gboolean is_calendar_UID, GError **error)
+ews_update_mgtrequest_mime_calendar_itemid (const gchar *mime_fname,
+ const EwsId *item_id,
+ gboolean is_calendar_UID,
+ GError **error)
{
CamelMimeParser *mimeparser;
CamelMimeMessage *msg;
CamelMimePart *mimepart = NULL;
- int fd_old;
+ gint fd_old;
gchar *mime_fname_new = NULL;
// original mime file
@@ -264,7 +271,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
}
msg = camel_mime_message_new ();
- if (camel_mime_part_construct_from_parser_sync (CAMEL_MIME_PART(msg),
+ if (camel_mime_part_construct_from_parser_sync (CAMEL_MIME_PART (msg),
mimeparser, NULL,
error) == -1) {
g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -281,7 +288,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
icalproperty *icalprop;
gchar *calstring_new, *dir;
const gchar *temp;
- int fd;
+ gint fd;
gboolean success = FALSE;
dw = camel_medium_get_content (CAMEL_MEDIUM (mimepart));
@@ -301,7 +308,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
/* In order to accept items we have to store AssociatedCalendarItemId (X-EVOLUTION-ITEMID)
* or mail id (X-EVOLUTION-ACCEPT-ID ) when we do not have AssociatedCalendarItemId */
icalcomponent_add_property (subcomp, icalprop);
- if (is_calendar_UID){
+ if (is_calendar_UID) {
icalprop = icalproperty_new_x (item_id->id);
icalproperty_set_x_name (icalprop, "X-EVOLUTION-ITEMID");
icalcomponent_add_property (subcomp, icalprop);
@@ -312,7 +319,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
}
calstring_new = icalcomponent_as_ical_string_r (icalcomp);
camel_mime_part_set_content (mimepart,
- (const gchar*) calstring_new, strlen (calstring_new),
+ (const gchar *) calstring_new, strlen (calstring_new),
"text/calendar");
g_free (calstring_new);
icalcomponent_free (icalcomp);
@@ -363,7 +370,11 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
}
static CamelMimeMessage *
-camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, GCancellable *cancellable, GError **error)
+camel_ews_folder_get_message (CamelFolder *folder,
+ const gchar *uid,
+ gint pri,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -392,10 +403,10 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
/* If another thread is already fetching this message, wait for it */
/* FIXME: We might end up refetching a message anyway, if another
- thread has already finished fetching it by the time we get to
- this point in the code â ews_folder_get_message_sync() doesn't
- hold any locks when it calls get_message_from_cache() and then
- falls back to this function. */
+ * thread has already finished fetching it by the time we get to
+ * this point in the code â ews_folder_get_message_sync() doesn't
+ * hold any locks when it calls get_message_from_cache() and then
+ * falls back to this function. */
if (g_hash_table_lookup (priv->uid_eflags, uid)) {
do {
g_cond_wait (priv->fetch_cond, priv->state_lock);
@@ -408,9 +419,9 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
}
/* Because we're using this as a form of mutex, we *know* that
- we won't be inserting where an entry already exists. So it's
- OK to insert uid itself, not g_strdup (uid) */
- g_hash_table_insert (priv->uid_eflags, (gchar *)uid, (gchar *)uid);
+ * we won't be inserting where an entry already exists. So it's
+ * OK to insert uid itself, not g_strdup (uid) */
+ g_hash_table_insert (priv->uid_eflags, (gchar *) uid, (gchar *) uid);
g_mutex_unlock (priv->state_lock);
cnc = camel_ews_store_get_connection (ews_store);
@@ -430,7 +441,7 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
res = e_ews_connection_get_items (cnc, pri, ids, "IdOnly", "item:MimeContent",
TRUE, mime_dir,
&items,
- (ESoapProgressFn)camel_operation_progress,
+ (ESoapProgressFn) camel_operation_progress,
(gpointer) cancellable,
cancellable, error);
g_free (mime_dir);
@@ -439,13 +450,13 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
goto exit;
/* The mime_content actually contains the *filename*, due to the
- streaming hack in ESoapMessage */
+ * streaming hack in ESoapMessage */
mime_content = e_ews_item_get_mime_content (items->data);
/* Exchange returns random UID for associated calendar item, which has no way
- to match with calendar components saved in calendar cache. So manually get
- AssociatedCalendarItemId, replace the random UID with this ItemId,
- And save updated message data to a new temp file */
+ * to match with calendar components saved in calendar cache. So manually get
+ * AssociatedCalendarItemId, replace the random UID with this ItemId,
+ * And save updated message data to a new temp file */
if (e_ews_item_get_item_type (items->data) == E_EWS_ITEM_TYPE_MEETING_REQUEST ||
e_ews_item_get_item_type (items->data) == E_EWS_ITEM_TYPE_MEETING_CANCELLATION ||
e_ews_item_get_item_type (items->data) == E_EWS_ITEM_TYPE_MEETING_MESSAGE ||
@@ -458,7 +469,7 @@ camel_ews_folder_get_message (CamelFolder *folder, const gchar *uid, gint pri, G
res = e_ews_connection_get_items (cnc, pri, ids, "IdOnly", "meeting:AssociatedCalendarItemId",
FALSE, NULL,
&items_req,
- (ESoapProgressFn)camel_operation_progress,
+ (ESoapProgressFn) camel_operation_progress,
(gpointer) cancellable,
cancellable, error);
if (!res) {
@@ -536,11 +547,14 @@ exit:
/* Get the message from cache if available otherwise get it from server */
static CamelMimeMessage *
-ews_folder_get_message_sync (CamelFolder *folder, const gchar *uid, GCancellable *cancellable, GError **error )
+ews_folder_get_message_sync (CamelFolder *folder,
+ const gchar *uid,
+ GCancellable *cancellable,
+ GError **error)
{
CamelMimeMessage *message;
- message = camel_ews_folder_get_message_from_cache ((CamelEwsFolder *)folder, uid, cancellable, NULL);
+ message = camel_ews_folder_get_message_from_cache ((CamelEwsFolder *) folder, uid, cancellable, NULL);
if (!message)
message = camel_ews_folder_get_message (folder, uid, EWS_ITEM_HIGH, cancellable, error);
@@ -548,7 +562,9 @@ ews_folder_get_message_sync (CamelFolder *folder, const gchar *uid, GCancellable
}
static GPtrArray *
-ews_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
+ews_folder_search_by_expression (CamelFolder *folder,
+ const gchar *expression,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -568,7 +584,9 @@ ews_folder_search_by_expression (CamelFolder *folder, const gchar *expression, G
}
static guint32
-ews_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
+ews_folder_count_by_expression (CamelFolder *folder,
+ const gchar *expression,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -588,7 +606,10 @@ ews_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GE
}
static GPtrArray *
-ews_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
+ews_folder_search_by_uids (CamelFolder *folder,
+ const gchar *expression,
+ GPtrArray *uids,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -611,7 +632,8 @@ ews_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArra
}
static void
-ews_folder_search_free (CamelFolder *folder, GPtrArray *uids)
+ews_folder_search_free (CamelFolder *folder,
+ GPtrArray *uids)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -632,9 +654,9 @@ ews_folder_search_free (CamelFolder *folder, GPtrArray *uids)
/********************* folder functions*************************/
-
static void
-msg_update_flags (ESoapMessage *msg, gpointer user_data)
+msg_update_flags (ESoapMessage *msg,
+ gpointer user_data)
{
GSList *mi_list = user_data;
CamelEwsMessageInfo *mi;
@@ -649,7 +671,7 @@ msg_update_flags (ESoapMessage *msg, gpointer user_data)
e_ews_message_start_item_change (msg, E_EWS_ITEMCHANGE_TYPE_ITEM,
mi->info.uid, mi->change_key, 0);
if (flags_changed & CAMEL_MESSAGE_FLAGGED) {
- const char *flag;
+ const gchar *flag;
if (mi->info.flags & CAMEL_MESSAGE_FLAGGED)
flag = "High";
@@ -685,8 +707,8 @@ msg_update_flags (ESoapMessage *msg, gpointer user_data)
e_soap_message_end_element (msg); /* SetItemField */
}
/* Ick Ick Ick. Why in hell is there a field in the database for the Icon
- *anyway*? Why isn't there a better place for forwarded/answered status? */
- if (flags_changed & (CAMEL_MESSAGE_FORWARDED|CAMEL_MESSAGE_ANSWERED)) {
+ * *anyway*? Why isn't there a better place for forwarded/answered status? */
+ if (flags_changed & (CAMEL_MESSAGE_FORWARDED | CAMEL_MESSAGE_ANSWERED)) {
gint icon = (mi->info.flags & CAMEL_MESSAGE_SEEN) ? 0x100 : 0x101;
if (mi->info.flags & CAMEL_MESSAGE_ANSWERED)
@@ -726,7 +748,7 @@ msg_update_flags (ESoapMessage *msg, gpointer user_data)
e_soap_message_start_element (msg, "Message", NULL, NULL);
e_soap_message_start_element (msg, "Categories", NULL, NULL);
- ews_utils_replace_server_user_flags(msg, mi);
+ ews_utils_replace_server_user_flags (msg, mi);
e_soap_message_end_element (msg); /* Categories */
e_soap_message_end_element (msg); /* Message */
@@ -745,7 +767,10 @@ msg_update_flags (ESoapMessage *msg, gpointer user_data)
}
static gboolean
-ews_sync_mi_flags (CamelFolder *folder, GSList *mi_list, GCancellable *cancellable, GError **error)
+ews_sync_mi_flags (CamelFolder *folder,
+ GSList *mi_list,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
EEwsConnection *cnc;
@@ -760,14 +785,17 @@ ews_sync_mi_flags (CamelFolder *folder, GSList *mi_list, GCancellable *cancellab
cancellable, error);
}
static gboolean
-ews_synchronize_sync (CamelFolder *folder, gboolean expunge, GCancellable *cancellable, GError **error)
+ews_synchronize_sync (CamelFolder *folder,
+ gboolean expunge,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
GPtrArray *uids;
GSList *mi_list = NULL, *deleted_uids = NULL;
- int mi_list_len = 0;
+ gint mi_list_len = 0;
gboolean success = TRUE;
- int i;
+ gint i;
ews_store = (CamelEwsStore *) camel_folder_get_parent_store (folder);
@@ -782,19 +810,19 @@ ews_synchronize_sync (CamelFolder *folder, gboolean expunge, GCancellable *cance
for (i = 0; success && i < uids->len; i++) {
guint32 flags_changed;
- CamelEwsMessageInfo *mi = (void *)camel_folder_summary_get (folder->summary, uids->pdata[i]);
+ CamelEwsMessageInfo *mi = (gpointer) camel_folder_summary_get (folder->summary, uids->pdata[i]);
if (!mi)
continue;
flags_changed = mi->server_flags ^ mi->info.flags;
/* Exchange doesn't seem to have a sane representation
- for most flags â not even replied/forwarded. */
- if (flags_changed & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_FORWARDED|CAMEL_MESSAGE_FLAGGED)) {
+ * for most flags â not even replied/forwarded. */
+ if (flags_changed & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_FORWARDED | CAMEL_MESSAGE_FLAGGED)) {
mi_list = g_slist_append (mi_list, mi);
mi_list_len++;
} else if (flags_changed & CAMEL_MESSAGE_DELETED) {
- deleted_uids = g_slist_prepend (deleted_uids, (gpointer) camel_pstring_strdup (uids->pdata [i]));
+ deleted_uids = g_slist_prepend (deleted_uids, (gpointer) camel_pstring_strdup (uids->pdata[i]));
camel_message_info_free (mi);
} else {
/* OK, the change must have been the labels */
@@ -822,7 +850,9 @@ ews_synchronize_sync (CamelFolder *folder, gboolean expunge, GCancellable *cance
}
static void
-ews_folder_count_notify_cb (CamelFolderSummary *folder_summary, GParamSpec *param, CamelFolder *folder)
+ews_folder_count_notify_cb (CamelFolderSummary *folder_summary,
+ GParamSpec *param,
+ CamelFolder *folder)
{
gint count;
CamelEwsStore *ews_store;
@@ -854,7 +884,11 @@ ews_folder_count_notify_cb (CamelFolderSummary *folder_summary, GParamSpec *para
}
CamelFolder *
-camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *folder_dir, GCancellable *cancellable, GError **error)
+camel_ews_folder_new (CamelStore *store,
+ const gchar *folder_name,
+ const gchar *folder_dir,
+ GCancellable *cancellable,
+ GError **error)
{
CamelFolder *folder;
CamelEwsFolder *ews_folder;
@@ -872,7 +906,7 @@ camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
"display_name", short_name, "full-name", folder_name,
"parent_store", store, NULL);
- ews_folder = CAMEL_EWS_FOLDER(folder);
+ ews_folder = CAMEL_EWS_FOLDER (folder);
folder->summary = camel_ews_summary_new (folder);
@@ -888,7 +922,7 @@ camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
state_file = g_build_filename (folder_dir, "cmeta", NULL);
camel_object_set_state_filename (CAMEL_OBJECT (folder), state_file);
camel_object_state_read (CAMEL_OBJECT (folder));
- g_free(state_file);
+ g_free (state_file);
ews_folder->cache = camel_data_cache_new (folder_dir, error);
if (!ews_folder->cache) {
@@ -916,20 +950,23 @@ camel_ews_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
}
static void
-sync_updated_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *updated_items, GCancellable *cancellable, GError **error)
+sync_updated_items (CamelEwsFolder *ews_folder,
+ EEwsConnection *cnc,
+ GSList *updated_items,
+ GCancellable *cancellable,
+ GError **error)
{
CamelFolder *folder = (CamelFolder *) ews_folder;
GSList *items = NULL, *l;
GSList *generic_item_ids = NULL, *msg_ids = NULL;
-
for (l = updated_items; l != NULL; l = g_slist_next (l)) {
EEwsItem *item = (EEwsItem *) l->data;
const EwsId *id = e_ews_item_get_id (item);
CamelMessageInfo *mi;
/* Compare the item_type from summary as the updated items seems to
- arrive as generic types while its not the case */
+ * arrive as generic types while its not the case */
mi = camel_folder_summary_get (folder->summary, id->id);
if (!mi) {
g_object_unref (item);
@@ -937,13 +974,13 @@ sync_updated_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *upd
}
/* Check if the item has really changed */
- if (!strcmp (((CamelEwsMessageInfo *)mi)->change_key, id->change_key)) {
+ if (!strcmp (((CamelEwsMessageInfo *) mi)->change_key, id->change_key)) {
camel_message_info_free (mi);
g_object_unref (item);
continue;
}
- if (((CamelEwsMessageInfo *)mi)->item_type == E_EWS_ITEM_TYPE_GENERIC_ITEM)
+ if (((CamelEwsMessageInfo *) mi)->item_type == E_EWS_ITEM_TYPE_GENERIC_ITEM)
generic_item_ids = g_slist_append (generic_item_ids, g_strdup (id->id));
else
msg_ids = g_slist_append (msg_ids, g_strdup (id->id));
@@ -986,7 +1023,11 @@ exit:
}
static void
-sync_created_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *created_items, GCancellable *cancellable, GError **error)
+sync_created_items (CamelEwsFolder *ews_folder,
+ EEwsConnection *cnc,
+ GSList *created_items,
+ GCancellable *cancellable,
+ GError **error)
{
GSList *items = NULL, *l;
GSList *generic_item_ids = NULL, *msg_ids = NULL, *post_item_ids = NULL;
@@ -1002,9 +1043,9 @@ sync_created_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *cre
id = e_ews_item_get_id (item);
item_type = e_ews_item_get_item_type (item);
/* created_msg_ids are items other than generic item. We fetch them
- separately since the property sets vary */
+ * separately since the property sets vary */
/* FIXME: Do we need to handle any other item types
- "specially"? */
+ * "specially"? */
if (item_type == E_EWS_ITEM_TYPE_MESSAGE ||
item_type == E_EWS_ITEM_TYPE_MEETING_REQUEST ||
item_type == E_EWS_ITEM_TYPE_MEETING_MESSAGE ||
@@ -1073,7 +1114,9 @@ exit:
}
static gboolean
-ews_refresh_info_sync (CamelFolder *folder, GCancellable *cancellable, GError **error)
+ews_refresh_info_sync (CamelFolder *folder,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelEwsFolderPrivate *priv;
@@ -1110,11 +1153,11 @@ ews_refresh_info_sync (CamelFolder *folder, GCancellable *cancellable, GError **
full_name);
/* Sync folder items does not return the fields ToRecipients,
- CCRecipients. With the item_type unknown, its not possible
- to fetch the right properties which are valid for an item type.
- Due to these reasons we just get the item ids and its type in
- SyncFolderItem request and fetch the item using the
- GetItem request. */
+ * CCRecipients. With the item_type unknown, its not possible
+ * to fetch the right properties which are valid for an item type.
+ * Due to these reasons we just get the item ids and its type in
+ * SyncFolderItem request and fetch the item using the
+ * GetItem request. */
sync_state = ((CamelEwsSummary *) folder->summary)->sync_state;
do
{
@@ -1176,7 +1219,7 @@ ews_refresh_info_sync (CamelFolder *folder, GCancellable *cancellable, GError **
priv->refreshing = FALSE;
g_mutex_unlock (priv->state_lock);
if (sync_state != ((CamelEwsSummary *) folder->summary)->sync_state)
- g_free(sync_state);
+ g_free (sync_state);
g_object_unref (cnc);
g_free (id);
@@ -1184,10 +1227,12 @@ ews_refresh_info_sync (CamelFolder *folder, GCancellable *cancellable, GError **
}
static gboolean
-ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
- CamelMessageInfo *info,
- gchar **appended_uid,
- GCancellable *cancellable, GError **error)
+ews_append_message_sync (CamelFolder *folder,
+ CamelMimeMessage *message,
+ CamelMessageInfo *info,
+ gchar **appended_uid,
+ GCancellable *cancellable,
+ GError **error)
{
gchar *itemid, *changekey;
const gchar *folder_name;
@@ -1196,7 +1241,7 @@ ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
CamelEwsStore *ews_store;
EEwsConnection *cnc;
- ews_store = (CamelEwsStore *)camel_folder_get_parent_store(folder);
+ ews_store = (CamelEwsStore *) camel_folder_get_parent_store (folder);
folder_name = camel_folder_get_full_name (folder);
folder_id = camel_ews_store_summary_get_folder_id_from_name (ews_store->summary,
@@ -1206,7 +1251,7 @@ ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
from = CAMEL_ADDRESS (camel_mime_message_get_from (message));
- cnc = camel_ews_store_get_connection(ews_store);
+ cnc = camel_ews_store_get_connection (ews_store);
if (!cnc) {
g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -1226,7 +1271,7 @@ ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
g_free (folder_id);
/* FIXME: Do we have to add it to the summary info ourselves?
- Hopefully, since we need to store the changekey with it... */
+ * Hopefully, since we need to store the changekey with it... */
if (appended_uid)
*appended_uid = itemid;
else
@@ -1240,13 +1285,13 @@ ews_append_message_sync (CamelFolder *folder, CamelMimeMessage *message,
/* move messages */
static gboolean
-ews_transfer_messages_to_sync (CamelFolder *source,
- GPtrArray *uids,
- CamelFolder *destination,
- gboolean delete_originals,
- GPtrArray **transferred_uids,
- GCancellable *cancellable,
- GError **error)
+ews_transfer_messages_to_sync (CamelFolder *source,
+ GPtrArray *uids,
+ CamelFolder *destination,
+ gboolean delete_originals,
+ GPtrArray **transferred_uids,
+ GCancellable *cancellable,
+ GError **error)
{
EEwsConnection *cnc;
CamelEwsStore *dst_ews_store;
@@ -1269,7 +1314,7 @@ ews_transfer_messages_to_sync (CamelFolder *source,
dst_full_name);
for (i = 0; i < uids->len; i++) {
- ids = g_slist_append(ids, (gchar *)uids->pdata[i]);
+ ids = g_slist_append (ids, (gchar *) uids->pdata[i]);
}
if (e_ews_connection_move_items (cnc, EWS_PRIORITY_MEDIUM,
@@ -1278,7 +1323,7 @@ ews_transfer_messages_to_sync (CamelFolder *source,
cancellable, &rerror)) {
if (delete_originals) {
changes = camel_folder_change_info_new ();
- for (i=0; i < uids->len; i++) {
+ for (i = 0; i < uids->len; i++) {
camel_folder_summary_remove_uid (source->summary, uids->pdata[i]);
camel_folder_change_info_remove_uid (changes, uids->pdata[i]);
}
@@ -1303,7 +1348,11 @@ ews_transfer_messages_to_sync (CamelFolder *source,
}
static gboolean
-ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expunge, GCancellable *cancellable, GError **error)
+ews_delete_messages (CamelFolder *folder,
+ GSList *deleted_items,
+ gboolean expunge,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsFolder *ews_folder;
CamelStore *parent_store;
@@ -1312,7 +1361,7 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
EEwsConnection *cnc;
gboolean status = TRUE;
GSList *deleted_head = NULL;
-
+
parent_store = camel_folder_get_parent_store (folder);
ews_folder = CAMEL_EWS_FOLDER (folder);
ews_store = CAMEL_EWS_STORE (parent_store);
@@ -1334,15 +1383,15 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
if (!status && rerror->code == EWS_CONNECTION_ERROR_ITEMNOTFOUND) {
/* If delete failed due to the item not found, ignore the error,
- trigger folder info refresh and then go on to clear the
- cache of the deleted items anyway. */
- g_clear_error(&rerror);
+ * trigger folder info refresh and then go on to clear the
+ * cache of the deleted items anyway. */
+ g_clear_error (&rerror);
status = ews_refresh_info_sync (folder, cancellable, &rerror);
}
if (status) {
while (deleted_items) {
- const gchar *uid = (gchar *)deleted_items->data;
+ const gchar *uid = (gchar *) deleted_items->data;
camel_folder_summary_lock (folder->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
camel_folder_change_info_remove_uid (changes, uid);
camel_folder_summary_remove_uid (folder->summary, uid);
@@ -1362,12 +1411,14 @@ ews_delete_messages (CamelFolder *folder, GSList *deleted_items, gboolean expung
}
camel_folder_change_info_free (changes);
-
+
return status;
}
static gboolean
-ews_expunge_sync (CamelFolder *folder, GCancellable *cancellable, GError **error)
+ews_expunge_sync (CamelFolder *folder,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
CamelEwsMessageInfo *ews_info;
@@ -1382,7 +1433,7 @@ ews_expunge_sync (CamelFolder *folder, GCancellable *cancellable, GError **error
if (!camel_ews_store_connected (ews_store, error))
return FALSE;
-
+
/* FIXME Run expunge on just trash folder once we are able to identify the exact trash */
camel_folder_summary_prepare_fetch_all (folder->summary, NULL);
@@ -1408,7 +1459,9 @@ ews_expunge_sync (CamelFolder *folder, GCancellable *cancellable, GError **error
}
static gint
-ews_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
+ews_cmp_uids (CamelFolder *folder,
+ const gchar *uid1,
+ const gchar *uid2)
{
g_return_val_if_fail (uid1 != NULL, 0);
g_return_val_if_fail (uid2 != NULL, 0);
@@ -1514,7 +1567,7 @@ camel_ews_folder_init (CamelEwsFolder *ews_folder)
ews_folder->priv->search_lock = g_mutex_new ();
ews_folder->priv->state_lock = g_mutex_new ();
- g_static_rec_mutex_init(&ews_folder->priv->cache_lock);
+ g_static_rec_mutex_init (&ews_folder->priv->cache_lock);
ews_folder->priv->refreshing = FALSE;
diff --git a/src/camel/camel-ews-folder.h b/src/camel/camel-ews-folder.h
index b4d1a4d..8a89470 100644
--- a/src/camel/camel-ews-folder.h
+++ b/src/camel/camel-ews-folder.h
@@ -71,7 +71,7 @@ struct _CamelEwsFolderClass {
GType camel_ews_folder_get_type (void);
/* implemented */
-CamelFolder * camel_ews_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *folder_name, GCancellable *cancellable, GError **error);
+CamelFolder * camel_ews_folder_new (CamelStore *store, const gchar *folder_dir, const gchar *folder_name, GCancellable *cancellable, GError **error);
void ews_update_summary ( CamelFolder *folder, GList *item_list, GCancellable *cancellable, GError **error);
G_END_DECLS
diff --git a/src/camel/camel-ews-private.h b/src/camel/camel-ews-private.h
index 4443e23..baf41a0 100644
--- a/src/camel/camel-ews-private.h
+++ b/src/camel/camel-ews-private.h
@@ -23,7 +23,7 @@
#define CAMEL_EWS_PRIVATE_H
/* need a way to configure and save this data, if this header is to
- be installed. For now, dont install it */
+ * be installed. For now, dont install it */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -31,13 +31,13 @@
#ifdef ENABLE_THREADS
#define CAMEL_EWS_FOLDER_LOCK(f, l) \
- (g_static_mutex_lock(&((CamelEwsFolder *)f)->priv->l))
+ (g_static_mutex_lock (&((CamelEwsFolder *) f)->priv->l))
#define CAMEL_EWS_FOLDER_UNLOCK(f, l) \
- (g_static_mutex_unlock(&((CamelEwsFolder *)f)->priv->l))
+ (g_static_mutex_unlock (&((CamelEwsFolder *) f)->priv->l))
#define CAMEL_EWS_FOLDER_REC_LOCK(f, l) \
- (g_static_rec_mutex_lock(&((CamelEwsFolder *)f)->priv->l))
+ (g_static_rec_mutex_lock (&((CamelEwsFolder *) f)->priv->l))
#define CAMEL_EWS_FOLDER_REC_UNLOCK(f, l) \
- (g_static_rec_mutex_unlock(&((CamelEwsFolder *)f)->priv->l))
+ (g_static_rec_mutex_unlock (&((CamelEwsFolder *) f)->priv->l))
#else
#define CAMEL_EWS_FOLDER_LOCK(f, l)
#define CAMEL_EWS_FOLDER_UNLOCK(f, l)
diff --git a/src/camel/camel-ews-provider.c b/src/camel/camel-ews-provider.c
index 267a367..9b01ab1 100644
--- a/src/camel/camel-ews-provider.c
+++ b/src/camel/camel-ews-provider.c
@@ -94,7 +94,7 @@ CamelServiceAuthType camel_ews_password_authtype = {
};
void
-camel_provider_module_init(void)
+camel_provider_module_init (void)
{
ews_provider.url_hash = ews_url_hash;
ews_provider.url_equal = ews_url_equal;
@@ -108,7 +108,8 @@ camel_provider_module_init(void)
}
static void
-add_hash (guint *hash, gchar *s)
+add_hash (guint *hash,
+ gchar *s)
{
if (s)
*hash ^= g_str_hash(s);
@@ -117,7 +118,7 @@ add_hash (guint *hash, gchar *s)
static guint
ews_url_hash (gconstpointer key)
{
- const CamelURL *u = (CamelURL *)key;
+ const CamelURL *u = (CamelURL *) key;
guint hash = 0;
add_hash (&hash, u->user);
@@ -128,7 +129,8 @@ ews_url_hash (gconstpointer key)
}
static gint
-check_equal (gchar *s1, gchar *s2)
+check_equal (gchar *s1,
+ gchar *s2)
{
if (s1 == NULL) {
if (s2 == NULL)
@@ -144,7 +146,8 @@ check_equal (gchar *s1, gchar *s2)
}
static gint
-ews_url_equal (gconstpointer a, gconstpointer b)
+ews_url_equal (gconstpointer a,
+ gconstpointer b)
{
const CamelURL *u1 = a, *u2 = b;
diff --git a/src/camel/camel-ews-store-summary.c b/src/camel/camel-ews-store-summary.c
index 678c5a6..83a8490 100644
--- a/src/camel/camel-ews-store-summary.c
+++ b/src/camel/camel-ews-store-summary.c
@@ -14,12 +14,12 @@ struct _CamelEwsStoreSummaryPrivate {
gboolean dirty;
gchar *path;
/* Note: We use the *same* strings in both of these hash tables, and
- only id_fname_hash has g_free() hooked up as the destructor func.
- So entries must always be removed from fname_id_hash *first*. */
+ * only id_fname_hash has g_free() hooked up as the destructor func.
+ * So entries must always be removed from fname_id_hash *first*. */
GHashTable *id_fname_hash;
GHashTable *fname_id_hash;
GStaticRecMutex s_lock;
-
+
GFileMonitor *monitor_delete;
};
@@ -124,17 +124,21 @@ load_id_fname_hash (CamelEwsStoreSummary *ews_summary)
/* we only care about delete and ignore create */
static void
-monitor_delete_cb (GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event, gpointer user_data)
+monitor_delete_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event,
+ gpointer user_data)
{
CamelEwsStoreSummary *ews_summary = (CamelEwsStoreSummary *) user_data;
if (event == G_FILE_MONITOR_EVENT_DELETED) {
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
if (ews_summary->priv->key_file)
camel_ews_store_summary_clear (ews_summary);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
}
@@ -166,39 +170,39 @@ camel_ews_store_summary_new (const gchar *path)
gboolean
camel_ews_store_summary_load (CamelEwsStoreSummary *ews_summary,
- GError **error)
+ GError **error)
{
CamelEwsStoreSummaryPrivate *priv = ews_summary->priv;
gboolean ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_load_from_file (priv->key_file,
priv->path,
0, error);
load_id_fname_hash (ews_summary);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gboolean
camel_ews_store_summary_save (CamelEwsStoreSummary *ews_summary,
- GError **error)
+ GError **error)
{
CamelEwsStoreSummaryPrivate *priv = ews_summary->priv;
gboolean ret = TRUE;
GFile *file;
gchar *contents = NULL;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
if (!priv->dirty)
goto exit;
contents = g_key_file_to_data (priv->key_file, NULL,
- NULL);
+ NULL);
file = g_file_new_for_path (priv->path);
ret = g_file_replace_contents (file, contents, strlen (contents),
NULL, FALSE, G_FILE_CREATE_PRIVATE,
@@ -207,7 +211,7 @@ camel_ews_store_summary_save (CamelEwsStoreSummary *ews_summary,
priv->dirty = FALSE;
exit:
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
g_free (contents);
return ret;
@@ -217,13 +221,13 @@ gboolean
camel_ews_store_summary_clear (CamelEwsStoreSummary *ews_summary)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_free (ews_summary->priv->key_file);
ews_summary->priv->key_file = g_key_file_new ();
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return TRUE;
}
@@ -233,14 +237,14 @@ camel_ews_store_summary_remove (CamelEwsStoreSummary *ews_summary)
{
gint ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
if (ews_summary->priv->key_file)
camel_ews_store_summary_clear (ews_summary);
ret = g_unlink (ews_summary->priv->path);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return (ret == 0);
}
@@ -252,7 +256,9 @@ struct subfolder_match {
};
static void
-match_subfolder (gpointer key, gpointer value, gpointer user_data)
+match_subfolder (gpointer key,
+ gpointer value,
+ gpointer user_data)
{
struct subfolder_match *sm = user_data;
@@ -261,7 +267,7 @@ match_subfolder (gpointer key, gpointer value, gpointer user_data)
}
/* Must be called with the summary lock held, and gets to keep
- both its string arguments */
+ * both its string arguments */
static void ews_ss_hash_replace (CamelEwsStoreSummary *ews_summary,
gchar *folder_id, gchar *full_name,
gboolean recurse)
@@ -275,9 +281,9 @@ static void ews_ss_hash_replace (CamelEwsStoreSummary *ews_summary,
ofname = g_hash_table_lookup (ews_summary->priv->id_fname_hash,
folder_id);
/* Remove the old fullname->id hash entry *iff* it's pointing
- to this folder id. */
+ * to this folder id. */
if (ofname) {
- char *ofid = g_hash_table_lookup (ews_summary->priv->fname_id_hash,
+ gchar *ofid = g_hash_table_lookup (ews_summary->priv->fname_id_hash,
ofname);
if (!strcmp (folder_id, ofid)) {
g_hash_table_remove (ews_summary->priv->fname_id_hash,
@@ -290,7 +296,7 @@ static void ews_ss_hash_replace (CamelEwsStoreSummary *ews_summary,
g_hash_table_insert (ews_summary->priv->fname_id_hash, full_name, folder_id);
/* Replace, not insert. The difference is that it frees the *old* folder_id
- key, not the new one which we just inserted into fname_id_hash too. */
+ * key, not the new one which we just inserted into fname_id_hash too. */
g_hash_table_replace (ews_summary->priv->id_fname_hash, folder_id, full_name);
if (sm.match) {
@@ -311,10 +317,10 @@ static void ews_ss_hash_replace (CamelEwsStoreSummary *ews_summary,
void
camel_ews_store_summary_set_folder_name (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- const gchar *display_name)
+ const gchar *folder_id,
+ const gchar *display_name)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_string (ews_summary->priv->key_file, folder_id,
"DisplayName", display_name);
@@ -322,21 +328,20 @@ camel_ews_store_summary_set_folder_name (CamelEwsStoreSummary *ews_summary,
ews_ss_hash_replace (ews_summary, g_strdup (folder_id), NULL, TRUE);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
-
void
camel_ews_store_summary_new_folder (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- const gchar *parent_fid,
- const gchar *change_key,
- const gchar *display_name,
- guint64 folder_type,
- guint64 folder_flags,
- guint64 total)
+ const gchar *folder_id,
+ const gchar *parent_fid,
+ const gchar *change_key,
+ const gchar *display_name,
+ guint64 folder_type,
+ guint64 folder_flags,
+ guint64 total)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_string (ews_summary->priv->key_file, folder_id,
"ParentFolderId", parent_fid);
@@ -355,16 +360,15 @@ camel_ews_store_summary_new_folder (CamelEwsStoreSummary *ews_summary,
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
-
void
camel_ews_store_summary_set_parent_folder_id (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- const gchar *parent_id)
+ const gchar *folder_id,
+ const gchar *parent_id)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
if (parent_id)
g_key_file_set_string (ews_summary->priv->key_file, folder_id,
@@ -377,310 +381,309 @@ camel_ews_store_summary_set_parent_folder_id (CamelEwsStoreSummary *ews_summary,
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
-camel_ews_store_summary_set_change_key (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- const gchar *change_key)
+camel_ews_store_summary_set_change_key (CamelEwsStoreSummary *ews_summary,
+ const gchar *folder_id,
+ const gchar *change_key)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_string (ews_summary->priv->key_file, folder_id,
"ChangeKey", change_key);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_set_sync_state (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- const gchar *sync_state)
+ const gchar *folder_id,
+ const gchar *sync_state)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_string (ews_summary->priv->key_file, folder_id,
"SyncState", sync_state);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_set_folder_flags (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- guint64 flags)
+ const gchar *folder_id,
+ guint64 flags)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
"Flags", flags);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_set_folder_unread (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- guint64 unread)
+ const gchar *folder_id,
+ guint64 unread)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
"UnRead", unread);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_set_folder_total (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- guint64 total)
+ const gchar *folder_id,
+ guint64 total)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
"Total", total);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_set_folder_type (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- guint64 ews_folder_type)
+ const gchar *folder_id,
+ guint64 ews_folder_type)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_uint64 (ews_summary->priv->key_file, folder_id,
"FolderType", ews_folder_type);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
void
camel_ews_store_summary_store_string_val (CamelEwsStoreSummary *ews_summary,
- const gchar *key,
- const gchar *value)
+ const gchar *key,
+ const gchar *value)
{
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
g_key_file_set_string (ews_summary->priv->key_file, STORE_GROUP_NAME,
key, value);
ews_summary->priv->dirty = TRUE;
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
}
gchar *
camel_ews_store_summary_get_folder_name (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_string (ews_summary->priv->key_file, folder_id,
"DisplayName", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
camel_ews_store_summary_get_folder_full_name (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_hash_table_lookup (ews_summary->priv->id_fname_hash, folder_id);
if (ret)
ret = g_strdup (ret);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
camel_ews_store_summary_get_parent_folder_id (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_string (ews_summary->priv->key_file, folder_id,
"ParentFolderId", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
camel_ews_store_summary_get_change_key (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_string (ews_summary->priv->key_file, folder_id,
"ChangeKey", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
camel_ews_store_summary_get_sync_state (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_string (ews_summary->priv->key_file, folder_id,
"SyncState", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
guint64
camel_ews_store_summary_get_folder_flags (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
guint64 ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_uint64 (ews_summary->priv->key_file, folder_id,
"Flags", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
-
guint64
camel_ews_store_summary_get_folder_unread (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
guint64 ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_uint64 (ews_summary->priv->key_file, folder_id,
"UnRead", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
guint64
camel_ews_store_summary_get_folder_total (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
guint64 ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_uint64 (ews_summary->priv->key_file, folder_id,
"Total", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
guint64
camel_ews_store_summary_get_folder_type (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
guint64 ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_uint64 (ews_summary->priv->key_file, folder_id,
"FolderType", error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
-camel_ews_store_summary_get_string_val (CamelEwsStoreSummary *ews_summary,
- const gchar *key,
- GError **error)
+camel_ews_store_summary_get_string_val (CamelEwsStoreSummary *ews_summary,
+ const gchar *key,
+ GError **error)
{
gchar *ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_get_string (ews_summary->priv->key_file, STORE_GROUP_NAME,
key, error);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
GSList *
camel_ews_store_summary_get_folders (CamelEwsStoreSummary *ews_summary,
- const gchar *prefix)
+ const gchar *prefix)
{
GSList *folders = NULL;
gchar **groups = NULL;
gsize length;
- int prefixlen = 0;
+ gint prefixlen = 0;
gint i;
if (prefix)
- prefixlen = strlen(prefix);
+ prefixlen = strlen (prefix);
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
groups = g_key_file_get_groups (ews_summary->priv->key_file, &length);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
for (i = 0; i < length; i++) {
- if (!g_ascii_strcasecmp (groups [i], STORE_GROUP_NAME))
+ 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]);
- if (!fname || strncmp(fname, prefix, prefixlen) ||
+ if (!fname || strncmp (fname, prefix, prefixlen) ||
(fname[prefixlen] && fname[prefixlen] != '/'))
continue;
}
- folders = g_slist_append (folders, g_strdup (groups [i]));
+ folders = g_slist_append (folders, g_strdup (groups[i]));
}
g_strfreev (groups);
@@ -689,13 +692,13 @@ camel_ews_store_summary_get_folders (CamelEwsStoreSummary *ews_summary,
gboolean
camel_ews_store_summary_remove_folder (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_id,
- GError **error)
+ const gchar *folder_id,
+ GError **error)
{
gboolean ret = FALSE;
gchar *full_name;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
full_name = g_hash_table_lookup (ews_summary->priv->id_fname_hash, folder_id);
if (!full_name)
@@ -710,38 +713,39 @@ camel_ews_store_summary_remove_folder (CamelEwsStoreSummary *ews_summary,
ews_summary->priv->dirty = TRUE;
unlock:
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
gchar *
camel_ews_store_summary_get_folder_id_from_name (CamelEwsStoreSummary *ews_summary,
- const gchar *folder_name)
+ const gchar *folder_name)
{
gchar *folder_id;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
folder_id = g_hash_table_lookup (ews_summary->priv->fname_id_hash, folder_name);
if (folder_id)
folder_id = g_strdup (folder_id);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return folder_id;
}
gboolean
-camel_ews_store_summary_has_folder (CamelEwsStoreSummary *ews_summary, const gchar *folder_id)
+camel_ews_store_summary_has_folder (CamelEwsStoreSummary *ews_summary,
+ const gchar *folder_id)
{
gboolean ret;
- S_LOCK(ews_summary);
+ S_LOCK (ews_summary);
ret = g_key_file_has_group (ews_summary->priv->key_file, folder_id);
- S_UNLOCK(ews_summary);
+ S_UNLOCK (ews_summary);
return ret;
}
diff --git a/src/camel/camel-ews-store-summary.h b/src/camel/camel-ews-store-summary.h
index e7df985..b048b4b 100644
--- a/src/camel/camel-ews-store-summary.h
+++ b/src/camel/camel-ews-store-summary.h
@@ -122,7 +122,6 @@ GSList * camel_ews_store_summary_get_folders
(CamelEwsStoreSummary *ews_summary,
const gchar *prefix);
-
void camel_ews_store_summary_store_string_val
(CamelEwsStoreSummary *ews_summary,
const gchar *key,
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index d86243b..b71a577 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -68,9 +68,9 @@ struct _CamelEwsStorePrivate {
EEwsConnection *cnc;
};
-extern CamelServiceAuthType camel_ews_password_authtype; /*for the query_auth_types function*/
+extern CamelServiceAuthType camel_ews_password_authtype; /*for the query_auth_types function */
static gboolean ews_store_construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, GError **error);
+ CamelProvider *provider, GError **error);
static void camel_ews_store_initable_init (GInitableIface *interface);
static GInitableIface *parent_initable_interface;
@@ -123,9 +123,9 @@ ews_migrate_to_user_cache_dir (CamelService *service)
}
static gboolean
-ews_store_initable_init (GInitable *initable,
- GCancellable *cancellable,
- GError **error)
+ews_store_initable_init (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error)
{
CamelService *service;
CamelSession *session;
@@ -159,20 +159,21 @@ camel_ews_store_initable_init (GInitableIface *interface)
}
static gboolean
-ews_store_construct (CamelService *service, CamelSession *session,
- CamelProvider *provider, GError **error)
+ews_store_construct (CamelService *service,
+ CamelSession *session,
+ CamelProvider *provider,
+ GError **error)
{
CamelEwsStore *ews_store;
CamelEwsStorePrivate *priv;
gchar *summary_file, *session_storage_path;
-
ews_store = (CamelEwsStore *) service;
priv = ews_store->priv;
/* Disable virtual trash and junk folders. Exchange has real
- folders for that */
- ((CamelStore *)ews_store)->flags &= ~(CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK);
+ * folders for that */
+ ((CamelStore *) ews_store)->flags &= ~(CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK);
/*storage path*/
session_storage_path = g_strdup (camel_service_get_user_cache_dir (service));
@@ -186,7 +187,7 @@ ews_store_construct (CamelService *service, CamelSession *session,
ews_store->storage_path = session_storage_path;
/* Note. update account-listener plugin if filename is changed here, as it would remove the summary
- by forming the path itself */
+ * by forming the path itself */
g_mkdir_with_parents (ews_store->storage_path, 0700);
summary_file = g_build_filename (ews_store->storage_path, "folder-tree", NULL);
ews_store->summary = camel_ews_store_summary_new (summary_file);
@@ -203,7 +204,8 @@ ews_hash_folder_name (gconstpointer key)
}
static gint
-ews_compare_folder_name (gconstpointer a, gconstpointer b)
+ews_compare_folder_name (gconstpointer a,
+ gconstpointer b)
{
gconstpointer aname = a, bname = b;
@@ -211,9 +213,12 @@ ews_compare_folder_name (gconstpointer a, gconstpointer b)
}
static void
-ews_update_folder_hierarchy (CamelEwsStore *ews_store, gchar *sync_state,
- gboolean includes_last_folder, GSList *folders_created,
- GSList *folders_deleted, GSList *folders_updated)
+ews_update_folder_hierarchy (CamelEwsStore *ews_store,
+ gchar *sync_state,
+ gboolean includes_last_folder,
+ GSList *folders_created,
+ GSList *folders_deleted,
+ GSList *folders_updated)
{
ews_utils_sync_folders (ews_store, folders_created, folders_deleted, folders_updated);
camel_ews_store_summary_store_string_val (ews_store->summary, "sync_state", sync_state);
@@ -229,9 +234,11 @@ ews_update_folder_hierarchy (CamelEwsStore *ews_store, gchar *sync_state,
}
static void
-ews_store_authenticate (EEwsConnection *cnc,
- SoupMessage *msg, SoupAuth *auth,
- gboolean retrying, gpointer data)
+ews_store_authenticate (EEwsConnection *cnc,
+ SoupMessage *msg,
+ SoupAuth *auth,
+ gboolean retrying,
+ gpointer data)
{
CamelNetworkSettings *network_settings;
CamelSettings *settings;
@@ -251,7 +258,9 @@ ews_store_authenticate (EEwsConnection *cnc,
}
static gboolean
-ews_connect_sync (CamelService *service, GCancellable *cancellable, GError **error)
+ews_connect_sync (CamelService *service,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
CamelEwsStorePrivate *priv;
@@ -316,7 +325,10 @@ ews_connect_sync (CamelService *service, GCancellable *cancellable, GError **err
}
static gboolean
-ews_disconnect_sync (CamelService *service, gboolean clean, GCancellable *cancellable, GError **error)
+ews_disconnect_sync (CamelService *service,
+ gboolean clean,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store = (CamelEwsStore *) service;
CamelServiceClass *service_class;
@@ -343,7 +355,7 @@ typedef struct {
gint info_flags;
} SystemFolder;
-static SystemFolder system_folder [] = {
+static SystemFolder system_folder[] = {
{"calendar", CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_TYPE_EVENTS},
{"contacts", CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_TYPE_CONTACTS},
{"deleteditems", CAMEL_FOLDER_SYSTEM | CAMEL_FOLDER_TYPE_TRASH},
@@ -360,11 +372,11 @@ static SystemFolder system_folder [] = {
{"searchfolders", CAMEL_FOLDER_SYSTEM},
};
-
static void
-ews_store_set_flags (CamelEwsStore *ews_store, GSList *folders)
+ews_store_set_flags (CamelEwsStore *ews_store,
+ GSList *folders)
{
- GSList *temp=NULL;
+ GSList *temp = NULL;
EEwsFolder *folder = NULL;
const EwsFolderId *fid = NULL;
gint n = 0;
@@ -376,14 +388,17 @@ ews_store_set_flags (CamelEwsStore *ews_store, GSList *folders)
if (camel_ews_store_summary_has_folder (ews_store->summary, fid->id))
camel_ews_store_summary_set_folder_flags (ews_store->summary, fid->id, system_folder[n].info_flags);
-
+
temp = temp->next;
n++;
}
}
static CamelAuthenticationResult
-ews_authenticate_sync (CamelService *service, const gchar *mechanism, GCancellable *cancellable, GError **error)
+ews_authenticate_sync (CamelService *service,
+ const gchar *mechanism,
+ GCancellable *cancellable,
+ GError **error)
{
CamelAuthenticationResult result;
CamelEwsStore *ews_store;
@@ -478,8 +493,10 @@ ews_authenticate_sync (CamelService *service, const gchar *mechanism, GCancellab
return result;
}
-static GList*
-ews_store_query_auth_types_sync (CamelService *service, GCancellable *cancellable, GError **error)
+static GList *
+ews_store_query_auth_types_sync (CamelService *service,
+ GCancellable *cancellable,
+ GError **error)
{
GList *auth_types = NULL;
@@ -488,10 +505,14 @@ ews_store_query_auth_types_sync (CamelService *service, GCancellable *cancellabl
return auth_types;
}
-static CamelFolderInfo* ews_create_folder_sync (CamelStore *store, const gchar *parent_name,const gchar *folder_name, GCancellable *cancellable, GError **error);
+static CamelFolderInfo * ews_create_folder_sync (CamelStore *store, const gchar *parent_name,const gchar *folder_name, GCancellable *cancellable, GError **error);
static CamelFolder *
-ews_get_folder_sync (CamelStore *store, const gchar *folder_name, guint32 flags, GCancellable *cancellable, GError **error)
+ews_get_folder_sync (CamelStore *store,
+ const gchar *folder_name,
+ guint32 flags,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
CamelFolder *folder = NULL;
@@ -546,7 +567,10 @@ ews_get_folder_sync (CamelStore *store, const gchar *folder_name, guint32 flags,
}
static CamelFolderInfo *
-folder_info_from_store_summary (CamelEwsStore *store, const gchar *top, guint32 flags, GError **error)
+folder_info_from_store_summary (CamelEwsStore *store,
+ const gchar *top,
+ guint32 flags,
+ GError **error)
{
CamelEwsStoreSummary *ews_summary;
GSList *folders, *l;
@@ -583,7 +607,9 @@ folder_info_from_store_summary (CamelEwsStore *store, const gchar *top, guint32
}
static void
-ews_folder_hierarchy_ready_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
+ews_folder_hierarchy_ready_cb (GObject *obj,
+ GAsyncResult *res,
+ gpointer user_data)
{
GSList *folders_created = NULL, *folders_updated = NULL;
GSList *folders_deleted = NULL;
@@ -622,7 +648,7 @@ static gboolean
ews_refresh_finfo (CamelEwsStore *ews_store)
{
gchar *sync_state;
-
+
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (ews_store)))
return FALSE;
@@ -631,7 +657,6 @@ ews_refresh_finfo (CamelEwsStore *ews_store)
sync_state = camel_ews_store_summary_get_string_val (ews_store->summary, "sync_state", NULL);
-
e_ews_connection_sync_folder_hierarchy_start (ews_store->priv->cnc, EWS_PRIORITY_MEDIUM,
sync_state, ews_folder_hierarchy_ready_cb,
NULL, g_object_ref (ews_store));
@@ -640,7 +665,11 @@ ews_refresh_finfo (CamelEwsStore *ews_store)
}
static CamelFolderInfo *
-ews_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, GCancellable *cancellable, GError **error)
+ews_get_folder_info_sync (CamelStore *store,
+ const gchar *top,
+ guint32 flags,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store;
CamelEwsStorePrivate *priv;
@@ -656,7 +685,7 @@ ews_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, GC
g_mutex_lock (priv->get_finfo_lock);
if (!(camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
- && camel_service_connect_sync ((CamelService *)store, error))) {
+ && camel_service_connect_sync ((CamelService *) store, error))) {
g_mutex_unlock (priv->get_finfo_lock);
goto offline;
}
@@ -667,7 +696,7 @@ ews_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, GC
if (!initial_setup && flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) {
time_t now = time (NULL);
-
+
g_free (sync_state);
if (now - priv->last_refresh_time > FINFO_REFRESH_INTERVAL && ews_refresh_finfo (ews_store))
ews_store->priv->last_refresh_time = time (NULL);
@@ -698,12 +727,12 @@ offline:
return fi;
}
-static CamelFolderInfo*
+static CamelFolderInfo *
ews_create_folder_sync (CamelStore *store,
- const gchar *parent_name,
- const gchar *folder_name,
- GCancellable *cancellable,
- GError **error)
+ const gchar *parent_name,
+ const gchar *folder_name,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store = CAMEL_EWS_STORE (store);
CamelEwsStoreSummary *ews_summary = ews_store->summary;
@@ -712,7 +741,6 @@ ews_create_folder_sync (CamelStore *store,
EwsFolderId *folder_id;
CamelFolderInfo *fi = NULL;
-
/* Get Parent folder ID */
if (parent_name && parent_name[0]) {
fid = camel_ews_store_summary_get_folder_id_from_name (ews_summary,
@@ -762,10 +790,10 @@ ews_create_folder_sync (CamelStore *store,
}
static gboolean
-ews_delete_folder_sync (CamelStore *store,
- const gchar *folder_name,
- GCancellable *cancellable,
- GError **error)
+ews_delete_folder_sync (CamelStore *store,
+ const gchar *folder_name,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store = CAMEL_EWS_STORE (store);
CamelEwsStoreSummary *ews_summary = ews_store->summary;
@@ -812,7 +840,9 @@ struct _rename_cb_data {
const gchar *folder_id;
};
-static void rename_folder_cb (ESoapMessage *msg, gpointer user_data)
+static void
+rename_folder_cb (ESoapMessage *msg,
+ gpointer user_data)
{
struct _rename_cb_data *rename_data = user_data;
@@ -832,11 +862,11 @@ static void rename_folder_cb (ESoapMessage *msg, gpointer user_data)
}
static gboolean
-ews_rename_folder_sync (CamelStore *store,
- const gchar *old_name,
- const gchar *new_name,
- GCancellable *cancellable,
- GError **error)
+ews_rename_folder_sync (CamelStore *store,
+ const gchar *old_name,
+ const gchar *new_name,
+ GCancellable *cancellable,
+ GError **error)
{
CamelEwsStore *ews_store = CAMEL_EWS_STORE (store);
CamelEwsStoreSummary *ews_summary = ews_store->summary;
@@ -885,22 +915,22 @@ ews_rename_folder_sync (CamelStore *store,
new_slash = new_name;
if (strcmp (old_slash, new_slash)) {
- int parent_len = old_slash - old_name;
+ gint parent_len = old_slash - old_name;
struct _rename_cb_data *rename_data;
/* Folder basename changed (i.e. UpdateFolder needed).
- Therefore, we can only do it if the folder hasn't also
- been moved from one parent folder to another.
-
- Strictly speaking, we could probably handle this, even
- if there are name collisions. We could UpdateFolder to
- a new temporary name that doesn't exist in either the
- old or new parent folders, then MoveFolder, then issue
- another UpdateFolder to the name we actually wanted.
- But since the Evolution UI doesn't seem to let us
- make both changes at the same time anyway, we'll just
- bail out for now; we can deal with it later if we need
- to.
+ * Therefore, we can only do it if the folder hasn't also
+ * been moved from one parent folder to another.
+ *
+ * Strictly speaking, we could probably handle this, even
+ * if there are name collisions. We could UpdateFolder to
+ * a new temporary name that doesn't exist in either the
+ * old or new parent folders, then MoveFolder, then issue
+ * another UpdateFolder to the name we actually wanted.
+ * But since the Evolution UI doesn't seem to let us
+ * make both changes at the same time anyway, we'll just
+ * bail out for now; we can deal with it later if we need
+ * to.
*/
if (new_slash - new_name != parent_len ||
strncmp (old_name, new_name, parent_len)) {
@@ -928,7 +958,7 @@ ews_rename_folder_sync (CamelStore *store,
gchar *parent_name;
/* If we are not moving to the root folder, work out the ItemId of
- the new parent folder */
+ * the new parent folder */
if (new_slash != new_name) {
parent_name = g_strndup (new_name, new_slash - new_name - 1);
pfid = camel_ews_store_summary_get_folder_id_from_name (ews_summary,
@@ -959,7 +989,8 @@ ews_rename_folder_sync (CamelStore *store,
}
gchar *
-ews_get_name (CamelService *service, gboolean brief)
+ews_get_name (CamelService *service,
+ gboolean brief)
{
CamelNetworkSettings *network_settings;
CamelSettings *settings;
@@ -986,24 +1017,29 @@ camel_ews_store_get_connection (CamelEwsStore *ews_store)
}
static CamelFolder *
-ews_get_trash_folder_sync (CamelStore *store, GCancellable *cancellable, GError **error)
+ews_get_trash_folder_sync (CamelStore *store,
+ GCancellable *cancellable,
+ GError **error)
{
return NULL;
}
static gboolean
-ews_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
+ews_can_refresh_folder (CamelStore *store,
+ CamelFolderInfo *info,
+ GError **error)
{
/* Skip unselectable folders from automatic refresh */
if (info && (info->flags & CAMEL_FOLDER_NOSELECT) != 0) return FALSE;
/* Delegate decision to parent class */
- return CAMEL_STORE_CLASS(camel_ews_store_parent_class)->can_refresh_folder (store, info, error) ||
+ return CAMEL_STORE_CLASS (camel_ews_store_parent_class)->can_refresh_folder (store, info, error) ||
camel_ews_settings_get_check_all (CAMEL_EWS_SETTINGS (camel_service_get_settings (CAMEL_SERVICE (store))));
}
gboolean
-camel_ews_store_connected (CamelEwsStore *ews_store, GError **error)
+camel_ews_store_connected (CamelEwsStore *ews_store,
+ GError **error)
{
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (ews_store))) {
diff --git a/src/camel/camel-ews-summary.c b/src/camel/camel-ews-summary.c
index 88a351e..ac37c4d 100644
--- a/src/camel/camel-ews-summary.c
+++ b/src/camel/camel-ews-summary.c
@@ -44,7 +44,7 @@
#define d(x)
/*Prototypes*/
-static gboolean ews_info_set_flags(CamelMessageInfo *info, guint32 flags, guint32 set);
+static gboolean ews_info_set_flags (CamelMessageInfo *info, guint32 flags, guint32 set);
static gboolean summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
@@ -58,26 +58,28 @@ static CamelMessageContentInfo * content_info_from_db (CamelFolderSummary *s, Ca
G_DEFINE_TYPE (CamelEwsSummary, camel_ews_summary, CAMEL_TYPE_FOLDER_SUMMARY)
static CamelMessageInfo *
-ews_message_info_clone(CamelFolderSummary *s, const CamelMessageInfo *mi)
+ews_message_info_clone (CamelFolderSummary *s,
+ const CamelMessageInfo *mi)
{
CamelEwsMessageInfo *to;
- const CamelEwsMessageInfo *from = (const CamelEwsMessageInfo *)mi;
+ const CamelEwsMessageInfo *from = (const CamelEwsMessageInfo *) mi;
- to = (CamelEwsMessageInfo *)CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->message_info_clone(s, mi);
+ to = (CamelEwsMessageInfo *) CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->message_info_clone (s, mi);
to->server_flags = from->server_flags;
to->item_type = from->item_type;
to->change_key = g_strdup (from->change_key);
/* FIXME: parent clone should do this */
- to->info.content = camel_folder_summary_content_info_new(s);
+ to->info.content = camel_folder_summary_content_info_new (s);
- return (CamelMessageInfo *)to;
+ return (CamelMessageInfo *) to;
}
static void
-ews_message_info_free (CamelFolderSummary *s, CamelMessageInfo *mi)
+ews_message_info_free (CamelFolderSummary *s,
+ CamelMessageInfo *mi)
{
- CamelEwsMessageInfo *emi = (void *)mi;
+ CamelEwsMessageInfo *emi = (gpointer) mi;
g_free (emi->change_key);
CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->message_info_free (s, mi);
@@ -144,7 +146,8 @@ camel_ews_summary_new (struct _CamelFolder *folder)
}
static gboolean
-summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
+summary_header_from_db (CamelFolderSummary *s,
+ CamelFIRecord *mir)
{
CamelEwsSummary *gms = CAMEL_EWS_SUMMARY (s);
gchar *part;
@@ -155,7 +158,7 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
part = mir->bdata;
if (part)
- EXTRACT_FIRST_DIGIT(gms->version);
+ EXTRACT_FIRST_DIGIT (gms->version);
if (part && part++ && strcmp (part, "(null)")) {
gms->sync_state = g_strdup (part);
@@ -165,9 +168,10 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
}
static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, GError **error)
+summary_header_to_db (CamelFolderSummary *s,
+ GError **error)
{
- CamelEwsSummary *ims = CAMEL_EWS_SUMMARY(s);
+ CamelEwsSummary *ims = CAMEL_EWS_SUMMARY (s);
struct _CamelFIRecord *fir;
fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->summary_header_to_db (s, error);
@@ -181,7 +185,8 @@ summary_header_to_db (CamelFolderSummary *s, GError **error)
}
static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
+message_info_from_db (CamelFolderSummary *s,
+ CamelMIRecord *mir)
{
CamelMessageInfo *info;
CamelEwsMessageInfo *iinfo;
@@ -191,12 +196,12 @@ message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
gchar *part = mir->bdata;
gchar **values;
- iinfo = (CamelEwsMessageInfo *)info;
+ iinfo = (CamelEwsMessageInfo *) info;
values = g_strsplit (part, " ", -1);
- iinfo->server_flags = g_ascii_strtoll (values [0], NULL, 10);
- iinfo->item_type = g_ascii_strtoll (values [1], NULL, 10);
- iinfo->change_key = g_strdup (values [2]);
+ iinfo->server_flags = g_ascii_strtoll (values[0], NULL, 10);
+ iinfo->item_type = g_ascii_strtoll (values[1], NULL, 10);
+ iinfo->change_key = g_strdup (values[2]);
g_strfreev (values);
}
@@ -205,9 +210,10 @@ message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
}
static CamelMIRecord *
-message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
+message_info_to_db (CamelFolderSummary *s,
+ CamelMessageInfo *info)
{
- CamelEwsMessageInfo *iinfo = (CamelEwsMessageInfo *)info;
+ CamelEwsMessageInfo *iinfo = (CamelEwsMessageInfo *) info;
struct _CamelMIRecord *mir;
mir = CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->message_info_to_db (s, info);
@@ -218,10 +224,11 @@ message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
}
static CamelMessageContentInfo *
-content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
+content_info_from_db (CamelFolderSummary *s,
+ CamelMIRecord *mir)
{
gchar *part = mir->cinfo;
- guint32 type=0;
+ guint32 type = 0;
if (part) {
if (*part == ' ')
@@ -238,7 +245,9 @@ content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
}
static gboolean
-content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
+content_info_to_db (CamelFolderSummary *s,
+ CamelMessageContentInfo *info,
+ CamelMIRecord *mir)
{
if (info->type) {
@@ -251,15 +260,17 @@ content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelM
}
static gboolean
-ews_info_set_flags (CamelMessageInfo *info, guint32 flags, guint32 set)
+ews_info_set_flags (CamelMessageInfo *info,
+ guint32 flags,
+ guint32 set)
{
return CAMEL_FOLDER_SUMMARY_CLASS (camel_ews_summary_parent_class)->info_set_flags (info, flags, set);
}
void
-camel_ews_summary_add_message (CamelFolderSummary *summary,
- const gchar *uid,
- CamelMimeMessage *message)
+camel_ews_summary_add_message (CamelFolderSummary *summary,
+ const gchar *uid,
+ CamelMimeMessage *message)
{
CamelEwsMessageInfo *mi;
CamelMessageInfo *info;
@@ -269,33 +280,33 @@ camel_ews_summary_add_message (CamelFolderSummary *summary,
info = camel_folder_summary_get (summary, uid);
/* Create summary entry */
- mi = (CamelEwsMessageInfo *)camel_folder_summary_info_new_from_message (summary, message, NULL);
+ mi = (CamelEwsMessageInfo *) camel_folder_summary_info_new_from_message (summary, message, NULL);
/* Copy flags 'n' tags */
- mi->info.flags = camel_message_info_flags(info);
+ mi->info.flags = camel_message_info_flags (info);
- flag = camel_message_info_user_flags(info);
+ flag = camel_message_info_user_flags (info);
while (flag) {
- camel_message_info_set_user_flag((CamelMessageInfo *)mi, flag->name, TRUE);
+ camel_message_info_set_user_flag ((CamelMessageInfo *) mi, flag->name, TRUE);
flag = flag->next;
}
- tag = camel_message_info_user_tags(info);
+ tag = camel_message_info_user_tags (info);
while (tag) {
- camel_message_info_set_user_tag((CamelMessageInfo *)mi, tag->name, tag->value);
+ camel_message_info_set_user_tag ((CamelMessageInfo *) mi, tag->name, tag->value);
tag = tag->next;
}
- mi->info.size = camel_message_info_size(info);
+ mi->info.size = camel_message_info_size (info);
mi->info.uid = camel_pstring_strdup (uid);
- camel_folder_summary_add (summary, (CamelMessageInfo *)mi);
+ camel_folder_summary_add (summary, (CamelMessageInfo *) mi);
camel_message_info_free (info);
}
void
-camel_ews_summary_add_message_info (CamelFolderSummary *summary,
- guint32 server_flags,
- CamelMessageInfo *mi)
+camel_ews_summary_add_message_info (CamelFolderSummary *summary,
+ guint32 server_flags,
+ CamelMessageInfo *mi)
{
CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) mi;
CamelEwsMessageInfo *einfo = (CamelEwsMessageInfo *) mi;
@@ -306,11 +317,12 @@ camel_ews_summary_add_message_info (CamelFolderSummary *summary,
/* TODO update user flags */
binfo->flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
- camel_folder_summary_add (summary, (CamelMessageInfo *)mi);
+ camel_folder_summary_add (summary, (CamelMessageInfo *) mi);
}
static gboolean
-ews_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags)
+ews_update_user_flags (CamelMessageInfo *info,
+ CamelFlag *server_user_flags)
{
gboolean changed = FALSE;
CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) info;
@@ -329,10 +341,10 @@ ews_update_user_flags (CamelMessageInfo *info, CamelFlag *server_user_flags)
}
gboolean
-camel_ews_update_message_info_flags (CamelFolderSummary *summary,
- CamelMessageInfo *info,
- guint32 server_flags,
- CamelFlag *server_user_flags)
+camel_ews_update_message_info_flags (CamelFolderSummary *summary,
+ CamelMessageInfo *info,
+ guint32 server_flags,
+ CamelFlag *server_user_flags)
{
CamelEwsMessageInfo *einfo = (CamelEwsMessageInfo *) info;
gboolean changed = FALSE;
@@ -358,8 +370,8 @@ camel_ews_update_message_info_flags (CamelFolderSummary *summary,
}
void
-ews_summary_clear (CamelFolderSummary *summary,
- gboolean uncache)
+ews_summary_clear (CamelFolderSummary *summary,
+ gboolean uncache)
{
CamelFolderChangeInfo *changes;
GPtrArray *known_uids;
diff --git a/src/camel/camel-ews-summary.h b/src/camel/camel-ews-summary.h
index 7c21c71..a6a889a 100644
--- a/src/camel/camel-ews-summary.h
+++ b/src/camel/camel-ews-summary.h
@@ -52,8 +52,8 @@ typedef struct _CamelEwsMessageContentInfo CamelEwsMessageContentInfo;
/* extra summary flags*/
enum {
- CAMEL_GW_MESSAGE_JUNK = 1<<17,
- CAMEL_GW_MESSAGE_NOJUNK = 1<<18
+ CAMEL_GW_MESSAGE_JUNK = 1 << 17,
+ CAMEL_GW_MESSAGE_NOJUNK = 1 << 18
};
struct _CamelEwsMessageInfo {
diff --git a/src/camel/camel-ews-transport.c b/src/camel/camel-ews-transport.c
index 3637a50..0e1068b 100644
--- a/src/camel/camel-ews-transport.c
+++ b/src/camel/camel-ews-transport.c
@@ -43,7 +43,7 @@ G_DEFINE_TYPE (CamelEwsTransport, camel_ews_transport, CAMEL_TYPE_TRANSPORT)
static gboolean
ews_transport_connect_sync (CamelService *service,
GCancellable *cancellable,
- GError **error)
+ GError **error)
{
return TRUE;
}
@@ -71,11 +71,11 @@ ews_transport_get_name (CamelService *service,
static gboolean
ews_send_to_sync (CamelTransport *transport,
- CamelMimeMessage *message,
- CamelAddress *from,
- CamelAddress *recipients,
- GCancellable *cancellable,
- GError **error)
+ CamelMimeMessage *message,
+ CamelAddress *from,
+ CamelAddress *recipients,
+ GCancellable *cancellable,
+ GError **error)
{
CamelNetworkSettings *network_settings;
CamelEwsSettings *ews_settings;
diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c
index 7cc547b..41026c4 100644
--- a/src/camel/camel-ews-utils.c
+++ b/src/camel/camel-ews-utils.c
@@ -54,7 +54,8 @@
* Returns: the expanded path
**/
gchar *
-e_path_to_physical (const gchar *prefix, const gchar *vpath)
+e_path_to_physical (const gchar *prefix,
+ const gchar *vpath)
{
const gchar *p, *newp;
gchar *dp;
@@ -129,8 +130,10 @@ e_path_to_physical (const gchar *prefix, const gchar *vpath)
}
static gboolean
-find_folders_recursive (const gchar *physical_path, const gchar *path,
- EPathFindFoldersCallback callback, gpointer data)
+find_folders_recursive (const gchar *physical_path,
+ const gchar *path,
+ EPathFindFoldersCallback callback,
+ gpointer data)
{
GDir *dir;
gchar *subfolder_directory_path;
@@ -202,8 +205,8 @@ find_folders_recursive (const gchar *physical_path, const gchar *path,
**/
gboolean
e_path_find_folders (const gchar *prefix,
- EPathFindFoldersCallback callback,
- gpointer data)
+ EPathFindFoldersCallback callback,
+ gpointer data)
{
return find_folders_recursive (prefix, "", callback, data);
}
@@ -222,7 +225,8 @@ e_path_find_folders (const gchar *prefix,
* the parent directory.
**/
gint
-e_path_rmdir (const gchar *prefix, const gchar *vpath)
+e_path_rmdir (const gchar *prefix,
+ const gchar *vpath)
{
gchar *physical_path, *p;
@@ -255,14 +259,17 @@ e_path_rmdir (const gchar *prefix, const gchar *vpath)
}
void
-do_flags_diff (flags_diff_t *diff, guint32 old, guint32 _new)
+do_flags_diff (flags_diff_t *diff,
+ guint32 old,
+ guint32 _new)
{
diff->changed = old ^ _new;
diff->bits = _new & diff->changed;
}
gchar *
-ews_concat ( const gchar *prefix, const gchar *suffix)
+ews_concat (const gchar *prefix,
+ const gchar *suffix)
{
gsize len;
@@ -274,7 +281,9 @@ ews_concat ( const gchar *prefix, const gchar *suffix)
}
void
-strip_lt_gt (gchar **string, gint s_offset, gint e_offset)
+strip_lt_gt (gchar **string,
+ gint s_offset,
+ gint e_offset)
{
gchar *temp = NULL;
gint len;
@@ -288,7 +297,8 @@ strip_lt_gt (gchar **string, gint s_offset, gint e_offset)
}
CamelFolderInfo *
-camel_ews_utils_build_folder_info (CamelEwsStore *store, const gchar *fid)
+camel_ews_utils_build_folder_info (CamelEwsStore *store,
+ const gchar *fid)
{
CamelEwsStoreSummary *ews_summary = store->summary;
CamelFolderInfo *fi;
@@ -318,7 +328,6 @@ static gboolean ews_do_remove_esource (gpointer user_data)
{
struct remove_esrc_data *remove_data = user_data;
-
ews_esource_utils_remove_esource (remove_data->fid,
remove_data->account_name,
remove_data->ftype);
@@ -330,7 +339,8 @@ static gboolean ews_do_remove_esource (gpointer user_data)
}
static void
-sync_deleted_folders (CamelEwsStore *store, GSList *deleted_folders)
+sync_deleted_folders (CamelEwsStore *store,
+ GSList *deleted_folders)
{
CamelEwsStoreSummary *ews_summary = store->summary;
CamelEwsSettings *ews_settings;
@@ -363,7 +373,7 @@ sync_deleted_folders (CamelEwsStore *store, GSList *deleted_folders)
g_clear_error (&error);
} else {
- struct remove_esrc_data *remove_data = g_new0(struct remove_esrc_data, 1);
+ struct remove_esrc_data *remove_data = g_new0 (struct remove_esrc_data, 1);
remove_data->fid = g_strdup (fid);
remove_data->account_name = g_strdup (email);
@@ -398,7 +408,8 @@ static gboolean ews_utils_rename_folder (CamelEwsStore *store, EwsFolderType fty
}
static void
-sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
+sync_updated_folders (CamelEwsStore *store,
+ GSList *updated_folders)
{
CamelEwsStoreSummary *ews_summary = store->summary;
GSList *l;
@@ -415,7 +426,7 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
ftype == EWS_FOLDER_TYPE_TASKS ||
ftype == EWS_FOLDER_TYPE_CONTACTS) {
/* TODO Update esource */
- } else if (ftype != EWS_FOLDER_TYPE_MAILBOX)
+ } else if (ftype != EWS_FOLDER_TYPE_MAILBOX)
continue;
fid = e_ews_folder_get_id (ews_folder);
@@ -425,8 +436,8 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
display_name = g_strdup (e_ews_folder_get_name (ews_folder));
/* If the folder is moved or renamed (which are separate
- operations in Exchange, unfortunately, then the name
- or parent folder will change. Handle both... */
+ * operations in Exchange, unfortunately, then the name
+ * or parent folder will change. Handle both... */
if (pfid || display_name) {
GError *error = NULL;
gchar *new_fname = NULL;
@@ -435,7 +446,7 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
gchar *pfname;
/* If the display name wasn't changed, its basename is still
- the same as it was before... */
+ * the same as it was before... */
if (!display_name)
display_name = camel_ews_store_summary_get_folder_name (ews_summary,
fid->id, NULL);
@@ -445,7 +456,7 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
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. */
+ * is the message folder root. */
if (pfname) {
new_fname = g_strconcat (pfname, "/", display_name, NULL);
g_free (pfname);
@@ -464,10 +475,10 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
new_fname = g_strdup (display_name);
}
- if (strcmp(new_fname, folder_name))
+ if (strcmp (new_fname, folder_name))
ews_utils_rename_folder (store, ftype,
fid->id, fid->change_key,
- pfid?pfid->id:NULL,
+ pfid ? pfid->id : NULL,
display_name, folder_name, &error);
g_free (new_fname);
g_clear_error (&error);
@@ -479,9 +490,10 @@ sync_updated_folders (CamelEwsStore *store, GSList *updated_folders)
}
/* FIXME get the real folder ids of the system folders using
- by fetching them using distinguished folder ids once */
+ * by fetching them using distinguished folder ids once */
static void
-add_folder_to_summary (CamelEwsStore *store, EEwsFolder *folder)
+add_folder_to_summary (CamelEwsStore *store,
+ EEwsFolder *folder)
{
CamelEwsStoreSummary *ews_summary = store->summary;
const EwsFolderId *pfid, *fid;
@@ -515,7 +527,6 @@ static gboolean ews_do_add_esource (gpointer user_data)
{
struct add_esrc_data *add_data = user_data;
-
ews_esource_utils_add_esource (add_data->folder, add_data->account_uri,
add_data->account_name,
add_data->username, add_data->email_id,
@@ -532,9 +543,9 @@ static gboolean ews_do_add_esource (gpointer user_data)
return FALSE;
}
-
static void
-sync_created_folders (CamelEwsStore *ews_store, GSList *created_folders)
+sync_created_folders (CamelEwsStore *ews_store,
+ GSList *created_folders)
{
CamelNetworkSettings *network_settings;
CamelEwsSettings *ews_settings;
@@ -582,16 +593,16 @@ sync_created_folders (CamelEwsStore *ews_store, GSList *created_folders)
/* This uses GConf so has to be done in the main thread */
g_idle_add_full (G_PRIORITY_DEFAULT, ews_do_add_esource, add_data, NULL);
- } else if (ftype != EWS_FOLDER_TYPE_MAILBOX)
+ } else if (ftype != EWS_FOLDER_TYPE_MAILBOX)
continue;
fid = e_ews_folder_get_id (folder);
/* FIXME: Sort folders so that a child is always added *after*
- its parent. But since the old code was already completely
- broken and would just go into an endless loop if the server
- didn't return the folders in the 'right' order for that,
- let's worry about that in a later commit. */
+ * its parent. But since the old code was already completely
+ * broken and would just go into an endless loop if the server
+ * didn't return the folders in the 'right' order for that,
+ * let's worry about that in a later commit. */
add_folder_to_summary (ews_store, folder);
if (ftype == EWS_FOLDER_TYPE_MAILBOX) {
@@ -603,7 +614,10 @@ sync_created_folders (CamelEwsStore *ews_store, GSList *created_folders)
}
void
-ews_utils_sync_folders (CamelEwsStore *ews_store, GSList *created_folders, GSList *deleted_folders, GSList *updated_folders)
+ews_utils_sync_folders (CamelEwsStore *ews_store,
+ GSList *created_folders,
+ GSList *deleted_folders,
+ GSList *updated_folders)
{
GError *error = NULL;
@@ -620,7 +634,8 @@ ews_utils_sync_folders (CamelEwsStore *ews_store, GSList *created_folders, GSLis
}
void
-camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder, GSList *items_deleted)
+camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder,
+ GSList *items_deleted)
{
CamelFolder *folder;
const gchar *full_name;
@@ -645,7 +660,7 @@ camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder, GSList *items_de
}
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 (((CamelStore *) ews_store)->cdb_w, full_name, items_deleted_list, NULL);
g_list_free (items_deleted_list);
camel_folder_changed ((CamelFolder *) ews_folder, ci);
@@ -655,8 +670,9 @@ camel_ews_utils_sync_deleted_items (CamelEwsFolder *ews_folder, GSList *items_de
g_slist_free (items_deleted);
}
-static const gchar*
-ews_utils_rename_label (const gchar *cat, int from_cat)
+static const gchar *
+ews_utils_rename_label (const gchar *cat,
+ gint from_cat)
{
gint i;
@@ -687,7 +703,8 @@ ews_utils_rename_label (const gchar *cat, int from_cat)
}
void
-ews_utils_replace_server_user_flags (ESoapMessage *msg, CamelEwsMessageInfo *mi)
+ews_utils_replace_server_user_flags (ESoapMessage *msg,
+ CamelEwsMessageInfo *mi)
{
const CamelFlag *flag;
@@ -710,7 +727,8 @@ ews_utils_replace_server_user_flags (ESoapMessage *msg, CamelEwsMessageInfo *mi)
}
static void
-ews_utils_merge_server_user_flags (EEwsItem *item, CamelEwsMessageInfo *mi)
+ews_utils_merge_server_user_flags (EEwsItem *item,
+ CamelEwsMessageInfo *mi)
{
GSList *list = NULL;
const GSList *p;
@@ -719,19 +737,19 @@ ews_utils_merge_server_user_flags (EEwsItem *item, CamelEwsMessageInfo *mi)
/* transfer camel flags to a list */
for (flag = camel_message_info_user_flags (&mi->info); flag;
flag = flag->next)
- list = g_slist_append (list, (gchar *)flag->name);
+ list = g_slist_append (list, (gchar *) flag->name);
/* we're transferring from server only, so just dump them */
for (p = list; p; p = p->next) {
camel_flag_set (&mi->info.user_flags, p->data, 0);
}
- //g_slist_foreach(list, (GFunc)g_free, NULL);
- g_slist_free(list);
+ //g_slist_foreach (list, (GFunc) g_free, NULL);
+ g_slist_free (list);
/* now transfer over all the categories */
for (p = e_ews_item_get_categories (item); p; p = p->next) {
camel_flag_set (&mi->info.user_flags,
- ews_utils_rename_label(p->data, 1), 1);
+ ews_utils_rename_label (p->data, 1), 1);
}
}
@@ -847,7 +865,8 @@ get_md5_digest (const guchar *str)
}
static void
-ews_set_threading_data (CamelEwsMessageInfo *mi, EEwsItem *item)
+ews_set_threading_data (CamelEwsMessageInfo *mi,
+ EEwsItem *item)
{
const gchar *references, *inreplyto;
gint count = 0;
@@ -860,7 +879,7 @@ ews_set_threading_data (CamelEwsMessageInfo *mi, EEwsItem *item)
message_id = e_ews_item_get_msg_id (item);
msgid = camel_header_msgid_decode (message_id);
if (msgid) {
- digest = get_md5_digest ((const guchar *)msgid);
+ digest = get_md5_digest ((const guchar *) msgid);
memcpy (mi->info.message_id.id.hash, digest, sizeof (mi->info.message_id.id.hash));
g_free (digest);
g_free (msgid);
@@ -881,7 +900,7 @@ ews_set_threading_data (CamelEwsMessageInfo *mi, EEwsItem *item)
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;
@@ -899,7 +918,8 @@ ews_set_threading_data (CamelEwsMessageInfo *mi, EEwsItem *item)
}
void
-camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder, GSList *items_updated)
+camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
+ GSList *items_updated)
{
CamelFolder *folder;
CamelFolderChangeInfo *ci;
@@ -920,7 +940,7 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder, GSList *items_up
server_flags = ews_utils_get_server_flags (item);
ews_utils_merge_server_user_flags (item, mi);
- if (camel_ews_update_message_info_flags (folder->summary, (CamelMessageInfo *)mi,
+ if (camel_ews_update_message_info_flags (folder->summary, (CamelMessageInfo *) mi,
server_flags, NULL))
camel_folder_change_info_change_uid (ci, mi->info.uid);
@@ -943,7 +963,8 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder, GSList *items_up
}
void
-camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder, GSList *items_created)
+camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
+ GSList *items_created)
{
CamelFolder *folder;
CamelFolderChangeInfo *ci;
@@ -976,7 +997,7 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder, GSList *items_cr
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);
diff --git a/src/camel/camel-ews-utils.h b/src/camel/camel-ews-utils.h
index 961c9a8..6b2f106 100644
--- a/src/camel/camel-ews-utils.h
+++ b/src/camel/camel-ews-utils.h
@@ -56,7 +56,7 @@ 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 */
+ * 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,
@@ -92,7 +92,6 @@ void camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
void ews_utils_replace_server_user_flags (ESoapMessage *msg,
CamelEwsMessageInfo *mi);
-
G_END_DECLS
#endif
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index f26cce1..1432647 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -58,10 +58,11 @@ static gint comp_func (gconstpointer a, gconstpointer b);
typedef void (*response_cb) (ESoapParameter *param, struct _EwsNode *enode);
static void ews_response_cb (SoupSession *session, SoupMessage *msg, gpointer data);
-static void
-ews_connection_authenticate (SoupSession *sess, SoupMessage *msg,
- SoupAuth *auth, gboolean retrying,
- gpointer data);
+static void ews_connection_authenticate (SoupSession *sess,
+ SoupMessage *msg,
+ SoupAuth *auth,
+ gboolean retrying,
+ gpointer data);
/* Connection APIS */
@@ -109,7 +110,7 @@ struct _EwsNode {
GSimpleAsyncResult *simple;
gboolean complete_sync;
- gint pri; /* the command priority */
+ gint pri; /* the command priority */
response_cb cb;
GCancellable *cancellable;
@@ -117,8 +118,8 @@ struct _EwsNode {
};
typedef struct {
- GAsyncResult *res;
- EFlag *eflag;
+ GAsyncResult *res;
+ EFlag *eflag;
} EwsSyncData;
/* Static Functions */
@@ -143,9 +144,9 @@ async_data_free (EwsAsyncData *async_data)
}
static void
-ews_sync_reply_cb (GObject *object,
- GAsyncResult *res,
- gpointer user_data)
+ews_sync_reply_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EwsSyncData *sync_data = user_data;
@@ -164,16 +165,17 @@ ews_node_new ()
}
static gboolean
-autodiscover_parse_protocol (xmlNode *node, EwsUrls *urls)
+autodiscover_parse_protocol (xmlNode *node,
+ EwsUrls *urls)
{
for (node = node->children; node; node = node->next) {
if (node->type == XML_ELEMENT_NODE &&
!strcmp((char *)node->name, "ASUrl")) {
- urls->as_url = (gchar *) xmlNodeGetContent(node);
+ urls->as_url = (gchar *) xmlNodeGetContent (node);
} else if (node->type == XML_ELEMENT_NODE &&
!strcmp((char *)node->name, "OABUrl"))
- urls->oab_url = (gchar *) xmlNodeGetContent(node);
-
+ urls->oab_url = (gchar *) xmlNodeGetContent (node);
+
if (urls->as_url && urls->oab_url)
return TRUE;
}
@@ -182,7 +184,8 @@ autodiscover_parse_protocol (xmlNode *node, EwsUrls *urls)
}
static gint
-comp_func (gconstpointer a, gconstpointer b)
+comp_func (gconstpointer a,
+ gconstpointer b)
{
EwsNode *node1 = (EwsNode *) a;
EwsNode *node2 = (EwsNode *) b;
@@ -196,24 +199,25 @@ comp_func (gconstpointer a, gconstpointer b)
}
static void
-ews_parse_soap_fault (ESoapResponse *response, GError **error)
+ews_parse_soap_fault (ESoapResponse *response,
+ GError **error)
{
ESoapParameter *param;
gchar *faultstring = NULL;
param = e_soap_response_get_first_parameter_by_name(response, "faultstring");
if (param)
- faultstring = e_soap_parameter_get_string_value(param);
-
+ faultstring = e_soap_parameter_get_string_value (param);
g_set_error (error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_UNKNOWN,
"%s", faultstring?:"No <ResponseMessages> or <FreeBusyResponseArray> or SOAP <faultstring> in response");
- g_free(faultstring);
+ g_free (faultstring);
}
static gboolean
-ews_get_response_status (ESoapParameter *param, GError **error)
+ews_get_response_status (ESoapParameter *param,
+ GError **error)
{
ESoapParameter *subparam;
gchar *value;
@@ -234,17 +238,17 @@ ews_get_response_status (ESoapParameter *param, GError **error)
error_code = ews_get_error_code ((const gchar *) res);
/* FIXME: This happens because of a bug in the Exchange server,
- which doesn't like returning <Recurrence> for any appointment
- without a timezone, even if it's an all day event like a
- birthday. We need to handle the error and correctly report it
- to the user, but for now we'll just ignore it... */
+ * which doesn't like returning <Recurrence> for any appointment
+ * without a timezone, even if it's an all day event like a
+ * birthday. We need to handle the error and correctly report it
+ * to the user, but for now we'll just ignore it... */
if (error_code != EWS_CONNECTION_ERROR_CORRUPTDATA &&
/* Ick, another one. If we try to set the IsRead flag on certain
- types of item (task requests, those stupid 'recall' requests),
- it complains. We really need to find a better way to return
- individual errors for each response to a multiple request; it
- isn't necessarily the case that a single error should be reported
- as an error for the whole transaction */
+ * types of item (task requests, those stupid 'recall' requests),
+ * it complains. We really need to find a better way to return
+ * individual errors for each response to a multiple request; it
+ * isn't necessarily the case that a single error should be reported
+ * as an error for the whole transaction */
error_code != EWS_CONNECTION_ERROR_INVALIDPROPERTYREQUEST) {
g_set_error (error,
EWS_CONNECTION_ERROR,
@@ -301,7 +305,7 @@ ews_next_request (gpointer _cnc)
return FALSE;
}
-static void ews_trigger_next_request(EEwsConnection *cnc)
+static void ews_trigger_next_request (EEwsConnection *cnc)
{
GSource *source;
@@ -320,7 +324,8 @@ static void ews_trigger_next_request(EEwsConnection *cnc)
* Returns:
**/
static void
-ews_active_job_done (EEwsConnection *cnc, EwsNode *ews_node)
+ews_active_job_done (EEwsConnection *cnc,
+ EwsNode *ews_node)
{
QUEUE_LOCK (cnc);
@@ -330,14 +335,14 @@ ews_active_job_done (EEwsConnection *cnc, EwsNode *ews_node)
QUEUE_UNLOCK (cnc);
- ews_trigger_next_request(cnc);
+ ews_trigger_next_request (cnc);
g_object_unref (ews_node->simple);
g_free (ews_node);
}
static void
ews_cancel_request (GCancellable *cancellable,
- gpointer user_data)
+ gpointer user_data)
{
EwsNode *node = user_data;
EEwsConnection *cnc = node->cnc;
@@ -365,7 +370,13 @@ ews_cancel_request (GCancellable *cancellable,
}
static void
-ews_connection_queue_request (EEwsConnection *cnc, ESoapMessage *msg, response_cb cb, gint pri, GCancellable *cancellable, GSimpleAsyncResult *simple, gboolean complete_sync)
+ews_connection_queue_request (EEwsConnection *cnc,
+ ESoapMessage *msg,
+ response_cb cb,
+ gint pri,
+ GCancellable *cancellable,
+ GSimpleAsyncResult *simple,
+ gboolean complete_sync)
{
EwsNode *node;
@@ -379,7 +390,7 @@ ews_connection_queue_request (EEwsConnection *cnc, ESoapMessage *msg, response_c
QUEUE_LOCK (cnc);
cnc->priv->jobs = g_slist_insert_sorted (cnc->priv->jobs, (gpointer *) node, (GCompareFunc) comp_func);
- QUEUE_UNLOCK (cnc);
+ QUEUE_UNLOCK (cnc);
if (cancellable) {
node->cancellable = cancellable;
@@ -388,13 +399,15 @@ ews_connection_queue_request (EEwsConnection *cnc, ESoapMessage *msg, response_c
(gpointer) node, NULL);
}
- ews_trigger_next_request(cnc);
+ ews_trigger_next_request (cnc);
}
/* Response callbacks */
static void
-ews_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
+ews_response_cb (SoupSession *session,
+ SoupMessage *msg,
+ gpointer data)
{
EwsNode *enode = (EwsNode *) data;
ESoapResponse *response;
@@ -420,12 +433,12 @@ ews_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
GError *error = NULL;
/* TODO: The stdout can be replaced with Evolution's
- Logging framework also */
+ * Logging framework also */
if (response && g_getenv ("EWS_DEBUG") && (atoi (g_getenv ("EWS_DEBUG")) >= 1))
e_soap_response_dump_response (response, stdout);
param = e_soap_response_get_first_parameter_by_name (response, "ResponseMessages");
- if (!param)
+ if (!param)
param = e_soap_response_get_first_parameter_by_name (response, "FreeBusyResponseArray");
if (param) {
@@ -433,7 +446,7 @@ ews_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
for (subparam = e_soap_parameter_get_first_child (param);
subparam;
subparam = e_soap_parameter_get_next_child (subparam)) {
- int l = strlen ((char *)subparam->name);
+ gint l = strlen ((gchar *) subparam->name);
if (l < 15 || (strcmp((char *)subparam->name + l - 15, "ResponseMessage") &&
strcmp((char *)subparam->name, "FreeBusyResponse")&&
strcmp((char *)subparam->name, "DelegateUserResponseMessageType"))) {
@@ -475,11 +488,11 @@ exit:
GAsyncResult *async = G_ASYNC_RESULT (enode->simple);
/* If we just call g_simple_async_result_complete() then it
- will bitch about being called in the wrong context, even
- though we *know* it's OK. So instead, just call the
- callback directly. We *know* it's ews_sync_reply_cb(),
- because that's the only way the complete_sync flag gets
- set */
+ * will bitch about being called in the wrong context, even
+ * though we *know* it's OK. So instead, just call the
+ * callback directly. We *know* it's ews_sync_reply_cb(),
+ * because that's the only way the complete_sync flag gets
+ * set */
ews_sync_reply_cb (NULL, async, g_async_result_get_user_data (async));
} else {
g_simple_async_result_complete_in_idle (enode->simple);
@@ -490,8 +503,11 @@ exit:
typedef gpointer (*ItemParser) (ESoapParameter *param);
static void
-sync_xxx_response_cb (ESoapParameter *subparam, EwsNode *enode, ItemParser parser,
- const gchar *last_tag, const gchar *delete_id_tag)
+sync_xxx_response_cb (ESoapParameter *subparam,
+ EwsNode *enode,
+ ItemParser parser,
+ const gchar *last_tag,
+ const gchar *delete_id_tag)
{
ESoapParameter *node;
EwsAsyncData *async_data;
@@ -560,22 +576,26 @@ sync_xxx_response_cb (ESoapParameter *subparam, EwsNode *enode, ItemParser parse
}
static void
-sync_hierarchy_response_cb (ESoapParameter *subparam, EwsNode *enode)
+sync_hierarchy_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
- sync_xxx_response_cb (subparam, enode, (ItemParser)e_ews_folder_new_from_soap_parameter,
+ sync_xxx_response_cb (subparam, enode, (ItemParser) e_ews_folder_new_from_soap_parameter,
"IncludesLastFolderInRange", "FolderId");
}
static void
-sync_folder_items_response_cb (ESoapParameter *subparam, EwsNode *enode)
+sync_folder_items_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
sync_xxx_response_cb (subparam, enode, (ItemParser) e_ews_item_new_from_soap_parameter,
"IncludesLastItemInRange", "ItemId");
}
static void
-get_folder_response_cb (ESoapParameter *subparam, EwsNode *enode)
-{ ESoapParameter *node;
+get_folder_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
+{
+ ESoapParameter *node;
EwsAsyncData *async_data;
EEwsFolder *folder;
@@ -589,8 +609,9 @@ get_folder_response_cb (ESoapParameter *subparam, EwsNode *enode)
}
}
-static void
-find_folder_items_response_cb (ESoapParameter *subparam, EwsNode *enode)
+static void
+find_folder_items_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
ESoapParameter *node, *subparam1;
EwsAsyncData *async_data;
@@ -623,7 +644,8 @@ find_folder_items_response_cb (ESoapParameter *subparam, EwsNode *enode)
/* Used for CreateItems and GetItems */
static void
-get_items_response_cb (ESoapParameter *subparam, EwsNode *enode)
+get_items_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
ESoapParameter *node;
EwsAsyncData *async_data;
@@ -670,7 +692,8 @@ get_text_from_html (gchar *html_text)
}
static void
-get_oof_settings_response_cb (ESoapParameter *subparam, EwsNode *enode)
+get_oof_settings_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
ESoapParameter *node, *node_1;
EwsAsyncData *async_data;
@@ -716,11 +739,10 @@ get_oof_settings_response_cb (ESoapParameter *subparam, EwsNode *enode)
if (g_time_val_from_iso8601 (end_tm, &time_val))
oof_settings->end_tm = time_val.tv_sec;
-
+
oof_settings->int_reply = int_msg;
oof_settings->ext_reply = ext_msg;
-
async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
async_data->items = g_slist_append (async_data->items, oof_settings);
@@ -729,7 +751,8 @@ get_oof_settings_response_cb (ESoapParameter *subparam, EwsNode *enode)
}
static void
-resolve_names_response_cb (ESoapParameter *subparam, EwsNode *enode)
+resolve_names_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
ESoapParameter *node;
gboolean includes_last_item;
@@ -757,7 +780,7 @@ resolve_names_response_cb (ESoapParameter *subparam, EwsNode *enode)
mailboxes = g_slist_prepend (mailboxes, mb);
/* 'mailboxes' and 'contact_items' match 1:1, but if the contact information
- wasn't found, then NULL is stored in the corresponding position */
+ * wasn't found, then NULL is stored in the corresponding position */
node = e_soap_parameter_get_first_child_by_name (subparam, "Contact");
rc = e_ews_item_resolve_contact_from_soap_param (node);
contact_items = g_slist_prepend (contact_items, rc);
@@ -773,7 +796,8 @@ resolve_names_response_cb (ESoapParameter *subparam, EwsNode *enode)
}
static void
-expand_dl_response_cb (ESoapParameter *subparam, EwsNode *enode)
+expand_dl_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
gboolean includes_last_item;
GSList *mailboxes = NULL;
@@ -806,7 +830,8 @@ expand_dl_response_cb (ESoapParameter *subparam, EwsNode *enode)
/* TODO scan all folders if we support creating multiple folders in the request */
static void
-ews_create_folder_cb (ESoapParameter *soapparam, EwsNode *enode)
+ews_create_folder_cb (ESoapParameter *soapparam,
+ EwsNode *enode)
{
ESoapParameter *param, *node;
EwsAsyncData *async_data;
@@ -853,13 +878,13 @@ e_ews_connection_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (priv->soup_session, ews_connection_authenticate, cnc);
if (priv->soup_session) {
- g_main_loop_quit(priv->soup_loop);
- g_thread_join(priv->soup_thread);
+ g_main_loop_quit (priv->soup_loop);
+ g_thread_join (priv->soup_thread);
priv->soup_thread = NULL;
- g_main_loop_unref(priv->soup_loop);
+ g_main_loop_unref (priv->soup_loop);
priv->soup_loop = NULL;
- g_main_context_unref(priv->soup_context);
+ g_main_context_unref (priv->soup_context);
priv->soup_context = NULL;
}
@@ -941,7 +966,6 @@ e_ews_connection_class_init (EEwsConnectionClass *klass)
SOUP_TYPE_MESSAGE, SOUP_TYPE_AUTH, G_TYPE_BOOLEAN);
}
-
static gpointer e_ews_soup_thread (gpointer user_data)
{
EEwsConnectionPrivate *priv = user_data;
@@ -968,18 +992,17 @@ e_ews_connection_init (EEwsConnection *cnc)
priv->soup_context = g_main_context_new ();
priv->soup_loop = g_main_loop_new (priv->soup_context, FALSE);
- priv->soup_thread = g_thread_create(e_ews_soup_thread, priv, TRUE, NULL);
+ priv->soup_thread = g_thread_create (e_ews_soup_thread, priv, TRUE, NULL);
/* create the SoupSession for this connection */
priv->soup_session = soup_session_async_new_with_options (SOUP_SESSION_USE_NTLM, TRUE,
SOUP_SESSION_ASYNC_CONTEXT, priv->soup_context, NULL);
if (getenv("EWS_DEBUG") && (atoi (g_getenv ("EWS_DEBUG")) >= 2)) {
- SoupLogger *logger;
- logger = soup_logger_new(SOUP_LOGGER_LOG_BODY, -1);
- soup_session_add_feature(priv->soup_session, SOUP_SESSION_FEATURE(logger));
- }
-
+ SoupLogger *logger;
+ logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
+ soup_session_add_feature (priv->soup_session, SOUP_SESSION_FEATURE (logger));
+ }
g_static_rec_mutex_init (&priv->queue_lock);
@@ -987,9 +1010,11 @@ e_ews_connection_init (EEwsConnection *cnc)
}
static void
-ews_connection_authenticate (SoupSession *sess, SoupMessage *msg,
- SoupAuth *auth, gboolean retrying,
- gpointer data)
+ews_connection_authenticate (SoupSession *sess,
+ SoupMessage *msg,
+ SoupAuth *auth,
+ gboolean retrying,
+ gpointer data)
{
EEwsConnection *cnc = data;
@@ -1008,23 +1033,25 @@ ews_connection_authenticate (SoupSession *sess, SoupMessage *msg,
}
void
-ews_user_id_free (EwsUserId *id)
+ews_user_id_free (EwsUserId *id)
{
if (id)
{
- g_free(id->sid);
- g_free(id->primary_smtp_add);
- g_free(id->display_name);
- g_free(id->distinguished_user);
- g_free(id->external_user);
- g_free(id);
+ g_free (id->sid);
+ g_free (id->primary_smtp_add);
+ g_free (id->display_name);
+ g_free (id->distinguished_user);
+ g_free (id->external_user);
+ g_free (id);
}
}
void
e_ews_connection_authenticate (EEwsConnection *cnc,
- SoupAuth *auth, const gchar *user,
- const gchar *passwd, GError *error)
+ SoupAuth *auth,
+ const gchar *user,
+ const gchar *passwd,
+ GError *error)
{
if (error) {
g_warning ("Auth error: %s", error->message);
@@ -1038,7 +1065,7 @@ e_ews_connection_authenticate (EEwsConnection *cnc,
}
g_free (cnc->priv->password);
- cnc->priv->password = g_strdup(passwd);
+ cnc->priv->password = g_strdup (passwd);
soup_auth_authenticate (auth, cnc->priv->username,
cnc->priv->password);
@@ -1055,7 +1082,8 @@ e_ews_connection_authenticate (EEwsConnection *cnc,
* Returns: EEwsConnection
**/
EEwsConnection *
-e_ews_connection_find (const gchar *uri, const gchar *username)
+e_ews_connection_find (const gchar *uri,
+ const gchar *username)
{
EEwsConnection *cnc;
gchar *hash_key;
@@ -1095,9 +1123,12 @@ e_ews_connection_find (const gchar *uri, const gchar *username)
* Returns: EEwsConnection
**/
EEwsConnection *
-e_ews_connection_new (const gchar *uri, const gchar *username, const gchar *password,
- GCallback authenticate_cb, gpointer authenticate_ctx,
- GError **error)
+e_ews_connection_new (const gchar *uri,
+ const gchar *username,
+ const gchar *password,
+ GCallback authenticate_cb,
+ gpointer authenticate_ctx,
+ GError **error)
{
EEwsConnection *cnc;
gchar *hash_key;
@@ -1147,7 +1178,7 @@ e_ews_connection_new (const gchar *uri, const gchar *username, const gchar *pass
}
static xmlDoc *
-e_ews_autodiscover_ws_xml(const gchar *email)
+e_ews_autodiscover_ws_xml (const gchar *email)
{
xmlDoc *doc;
xmlNode *node;
@@ -1155,13 +1186,13 @@ e_ews_autodiscover_ws_xml(const gchar *email)
doc = xmlNewDoc((xmlChar *) "1.0");
node = xmlNewDocNode(doc, NULL, (xmlChar *)"Autodiscover", NULL);
- xmlDocSetRootElement(doc, node);
+ xmlDocSetRootElement (doc, node);
ns = xmlNewNs (node,
(xmlChar *)"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006", NULL);
node = xmlNewChild(node, ns, (xmlChar *)"Request", NULL);
xmlNewChild(node, ns, (xmlChar *)"EMailAddress",
- (xmlChar *)email);
+ (xmlChar *) email);
xmlNewChild(node, ns, (xmlChar *)"AcceptableResponseSchema",
(xmlChar *)"http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a");
@@ -1178,7 +1209,7 @@ struct _autodiscover_data {
};
/* Called in the context e_ews_autodiscover_ws_url() was called from,
- with the final result. */
+ * with the final result. */
static void autodiscover_done_cb (GObject *cnc, GAsyncResult *res,
gpointer user_data)
{
@@ -1213,7 +1244,9 @@ ews_dump_raw_soup_response (SoupMessage *msg)
/* Called when each soup message completes */
static void
-autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
+autodiscover_response_cb (SoupSession *session,
+ SoupMessage *msg,
+ gpointer data)
{
GError *error = NULL;
@@ -1222,7 +1255,7 @@ autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
guint status = msg->status_code;
xmlDoc *doc;
xmlNode *node;
- int idx;
+ gint idx;
gboolean success = FALSE;
for (idx = 0; idx < 4; idx++) {
@@ -1255,7 +1288,7 @@ autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
_("Failed to parse autodiscover response XML"));
goto failed;
}
- node = xmlDocGetRootElement(doc);
+ node = xmlDocGetRootElement (doc);
if (strcmp((char *)node->name, "Autodiscover")) {
g_set_error (
&error, EWS_CONNECTION_ERROR,
@@ -1292,7 +1325,7 @@ autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
for (node = node->children; node; node = node->next) {
if (node->type == XML_ELEMENT_NODE &&
!strcmp((char *)node->name, "Protocol")) {
- success = autodiscover_parse_protocol(node, urls);
+ success = autodiscover_parse_protocol (node, urls);
break;
}
}
@@ -1316,7 +1349,7 @@ autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer data)
m, SOUP_STATUS_CANCELLED);
}
}
-
+
g_simple_async_result_set_op_res_gpointer (ad->simple, urls, NULL);
g_simple_async_result_complete_in_idle (ad->simple);
g_object_unref (ad->simple);
@@ -1326,16 +1359,16 @@ failed:
for (idx = 0; idx < 4; idx++) {
if (ad->msgs[idx]) {
/* There's another request outstanding.
- Hope that it has better luck. */
+ * Hope that it has better luck. */
g_clear_error (&error);
return;
}
}
/* FIXME: We're actually returning the *last* error here,
- and in some cases (stupid firewalls causing timeouts)
- that's going to be the least interesting one. We probably
- want the *first* error */
+ * and in some cases (stupid firewalls causing timeouts)
+ * that's going to be the least interesting one. We probably
+ * want the *first* error */
g_simple_async_result_set_from_error (ad->simple, error);
g_simple_async_result_complete_in_idle (ad->simple);
g_object_unref (ad->simple);
@@ -1346,17 +1379,18 @@ static void post_restarted (SoupMessage *msg, gpointer data)
xmlOutputBuffer *buf = data;
/* In violation of RFC2616, libsoup will change a POST request to
- a GET on receiving a 302 redirect. */
+ * a GET on receiving a 302 redirect. */
printf("Working around libsoup bug with redirect\n");
g_object_set (msg, SOUP_MESSAGE_METHOD, "POST", NULL);
soup_message_set_request(msg, "text/xml", SOUP_MEMORY_COPY,
- (gchar *)buf->buffer->content,
+ (gchar *) buf->buffer->content,
buf->buffer->use);
}
static SoupMessage *
-e_ews_get_msg_for_url (const gchar *url, xmlOutputBuffer *buf)
+e_ews_get_msg_for_url (const gchar *url,
+ xmlOutputBuffer *buf)
{
SoupMessage *msg;
@@ -1364,10 +1398,9 @@ e_ews_get_msg_for_url (const gchar *url, xmlOutputBuffer *buf)
soup_message_headers_append (msg->request_headers,
"User-Agent", "libews/0.1");
-
if (buf) {
soup_message_set_request (msg, "text/xml; charset=utf-8", SOUP_MEMORY_COPY,
- (gchar *)buf->buffer->content,
+ (gchar *) buf->buffer->content,
buf->buffer->use);
g_signal_connect (msg, "restarted",
G_CALLBACK (post_restarted), buf);
@@ -1387,9 +1420,12 @@ e_ews_get_msg_for_url (const gchar *url, xmlOutputBuffer *buf)
}
void
-e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
- const gchar *email, const gchar *password,
- const gchar *ews_url, const gchar *username)
+e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb,
+ gpointer cbdata,
+ const gchar *email,
+ const gchar *password,
+ const gchar *ews_url,
+ const gchar *username)
{
struct _autodiscover_data *ad;
xmlOutputBuffer *buf;
@@ -1406,7 +1442,7 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
goto err;
}
- domain = strchr(email, '@');
+ domain = strchr (email, '@');
if (!(domain && *domain)) {
g_set_error (&error, EWS_CONNECTION_ERROR,
-1, _("Wrong email id"));
@@ -1414,10 +1450,10 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
}
domain++;
- doc = e_ews_autodiscover_ws_xml(email);
- buf = xmlAllocOutputBuffer(NULL);
- xmlNodeDumpOutput(buf, doc, xmlDocGetRootElement(doc), 0, 1, NULL);
- xmlOutputBufferFlush(buf);
+ doc = e_ews_autodiscover_ws_xml (email);
+ buf = xmlAllocOutputBuffer (NULL);
+ xmlNodeDumpOutput (buf, doc, xmlDocGetRootElement (doc), 0, 1, NULL);
+ xmlOutputBufferFlush (buf);
url1 = NULL;
url2 = NULL;
@@ -1433,7 +1469,7 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
url2 = g_strdup_printf ("http%s://autodiscover.%s/autodiscover/autodiscover.xml", use_secure ? "s" : "", soup_uri_get_host (uri));
soup_uri_free (uri);
}
- }
+ }
url3 = g_strdup_printf ("http%s://%s/autodiscover/autodiscover.xml", use_secure ? "s" : "", domain);
url4 = g_strdup_printf ("http%s://autodiscover.%s/autodiscover/autodiscover.xml", use_secure ? "s" : "", domain);
@@ -1472,7 +1508,7 @@ e_ews_autodiscover_ws_url (EEwsAutoDiscoverCallback cb, gpointer cbdata,
ad->msgs[3] = url4 ? e_ews_get_msg_for_url (url4, buf) : NULL;
/* These have to be submitted only after they're both set in ad->msgs[]
- or there will be races with fast completion */
+ * or there will be races with fast completion */
if (ad->msgs[0])
soup_session_queue_message (cnc->priv->soup_session, ad->msgs[0],
autodiscover_response_cb, ad);
@@ -1503,7 +1539,7 @@ struct _oal_req_data {
gulong cancel_handler_id;
gchar *oal_id;
gchar *oal_element;
-
+
/* for dowloading oal file */
gchar *cache_filename;
GError *error;
@@ -1514,24 +1550,26 @@ struct _oal_req_data {
};
static gchar *
-get_property (xmlNodePtr node_ptr, const gchar *name)
+get_property (xmlNodePtr node_ptr,
+ const gchar *name)
{
xmlChar *xml_s;
gchar *s;
-
+
xml_s = xmlGetProp (node_ptr, (const xmlChar *) name);
- s = g_strdup ((gchar *)xml_s);
+ s = g_strdup ((gchar *) xml_s);
xmlFree (xml_s);
return s;
}
static guint32
-get_property_as_uint32 (xmlNodePtr node_ptr, const gchar *name)
+get_property_as_uint32 (xmlNodePtr node_ptr,
+ const gchar *name)
{
gchar *s;
guint32 val = -1;
-
+
s = get_property (node_ptr, name);
if (s)
sscanf (s,"%"G_GUINT32_FORMAT, &val);
@@ -1547,19 +1585,20 @@ get_content (xmlNodePtr node_ptr)
gchar *s;
xml_s = xmlNodeGetContent (node_ptr);
- s = g_strdup ((gchar *)xml_s);
+ s = g_strdup ((gchar *) xml_s);
xmlFree (xml_s);
return s;
}
static GSList *
-parse_oal_full_details (xmlNode *node, const gchar *element)
+parse_oal_full_details (xmlNode *node,
+ const gchar *element)
{
GSList *elements = NULL;
-
+
for (node = node->children; node; node = node->next) {
- if (node->type == XML_ELEMENT_NODE && !strcmp((char *)node->name, element)) {
+ if (node->type == XML_ELEMENT_NODE && !strcmp ((gchar *) node->name, element)) {
EwsOALDetails *det = g_new0 (EwsOALDetails, 1);
det->seq = get_property_as_uint32 (node, "seq");
@@ -1568,10 +1607,10 @@ parse_oal_full_details (xmlNode *node, const gchar *element)
det->uncompressed_size = get_property_as_uint32 (node, "uncompressedsize");
det->sha = get_property (node, "uncompressedsize");
det->filename = g_strstrip (get_content (node));
-
+
elements = g_slist_prepend (elements, det);
if (!strcmp (element, "Full"))
- break;
+ break;
}
}
@@ -1579,7 +1618,9 @@ parse_oal_full_details (xmlNode *node, const gchar *element)
}
static void
-oal_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
+oal_response_cb (SoupSession *session,
+ SoupMessage *msg,
+ gpointer user_data)
{
GError *error = NULL;
guint status = msg->status_code;
@@ -1595,7 +1636,7 @@ oal_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
goto exit;
}
ews_dump_raw_soup_response (msg);
-
+
doc = xmlReadMemory (msg->response_body->data, msg->response_body->length,
"oab.xml", NULL, 0);
if (!doc) {
@@ -1604,7 +1645,7 @@ oal_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
goto exit;
}
- node = xmlDocGetRootElement(doc);
+ node = xmlDocGetRootElement (doc);
if (strcmp((char *)node->name, "OAB")) {
g_set_error (&error, EWS_CONNECTION_ERROR, -1,
_("Failed to find <OAB> element\n"));
@@ -1623,7 +1664,7 @@ oal_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
oals = g_slist_prepend (oals, oal);
} else {
gchar *id = get_property (node, "id");
-
+
if (!strcmp (id, data->oal_id)) {
/* parse details of full_details file */
oals = parse_oal_full_details (node, data->oal_element);
@@ -1657,47 +1698,47 @@ exit:
static void
ews_cancel_msg (GCancellable *cancellable,
- gpointer user_data)
+ gpointer user_data)
{
struct _oal_req_data *data = (struct _oal_req_data *) user_data;
soup_session_cancel_message (data->cnc->priv->soup_session, SOUP_MESSAGE (data->msg), SOUP_STATUS_CANCELLED);
}
-void
-e_ews_connection_get_oal_list_start (EEwsConnection *cnc,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+void
+e_ews_connection_get_oal_list_start (EEwsConnection *cnc,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
SoupMessage *msg;
struct _oal_req_data *data;
msg = e_ews_get_msg_for_url (cnc->priv->uri, NULL);
-
+
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_get_oal_list_start);
+ cb,
+ user_data,
+ e_ews_connection_get_oal_list_start);
data = g_new0 (struct _oal_req_data, 1);
data->cnc = cnc;
data->simple = simple;
data->cancellable = cancellable;
data->msg = msg;
-
+
if (cancellable)
data->cancel_handler_id = g_cancellable_connect (cancellable,
- G_CALLBACK (ews_cancel_msg), (gpointer) data, NULL);
+ G_CALLBACK (ews_cancel_msg), (gpointer) data, NULL);
soup_session_queue_message (cnc->priv->soup_session, msg,
oal_response_cb, data);
}
-gboolean
-e_ews_connection_get_oal_list_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **oals,
- GError **error)
+gboolean
+e_ews_connection_get_oal_list_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **oals,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -1710,30 +1751,30 @@ e_ews_connection_get_oal_list_finish (EEwsConnection *cnc,
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
-
+
*oals= g_simple_async_result_get_op_res_gpointer (simple);
return TRUE;
}
-void
-e_ews_connection_get_oal_detail_start (EEwsConnection *cnc,
- const gchar *oal_id,
- const gchar *oal_element,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+void
+e_ews_connection_get_oal_detail_start (EEwsConnection *cnc,
+ const gchar *oal_id,
+ const gchar *oal_element,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
SoupMessage *msg;
struct _oal_req_data *data;
msg = e_ews_get_msg_for_url (cnc->priv->uri, NULL);
-
+
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_get_oal_detail_start);
+ cb,
+ user_data,
+ e_ews_connection_get_oal_detail_start);
data = g_new0 (struct _oal_req_data, 1);
data->cnc = cnc;
data->simple = simple;
@@ -1741,20 +1782,20 @@ e_ews_connection_get_oal_detail_start (EEwsConnection *cnc,
data->msg = msg;
data->oal_id = g_strdup (oal_id);
data->oal_element = g_strdup (oal_element);
-
+
if (cancellable)
data->cancel_handler_id = g_cancellable_connect (cancellable,
- G_CALLBACK (ews_cancel_msg), (gpointer) data, NULL);
+ G_CALLBACK (ews_cancel_msg), (gpointer) data, NULL);
soup_session_queue_message (cnc->priv->soup_session, msg,
oal_response_cb, data);
}
-gboolean
-e_ews_connection_get_oal_detail_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **elements,
- GError **error)
+gboolean
+e_ews_connection_get_oal_detail_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **elements,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -1767,7 +1808,7 @@ e_ews_connection_get_oal_detail_finish (EEwsConnection *cnc,
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
-
+
*elements = g_simple_async_result_get_op_res_gpointer (simple);
return TRUE;
@@ -1786,13 +1827,13 @@ e_ews_connection_get_oal_detail_finish (EEwsConnection *cnc,
*
* Returns:
**/
-gboolean
-e_ews_connection_get_oal_detail (EEwsConnection *cnc,
- const gchar *oal_id,
- const gchar *oal_element,
- GSList **elements,
- GCancellable *cancellable,
- GError **error)
+gboolean
+e_ews_connection_get_oal_detail (EEwsConnection *cnc,
+ const gchar *oal_id,
+ const gchar *oal_element,
+ GSList **elements,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -1807,7 +1848,7 @@ e_ews_connection_get_oal_detail (EEwsConnection *cnc,
e_flag_wait (sync_data->eflag);
- result = e_ews_connection_get_oal_detail_finish
+ result = e_ews_connection_get_oal_detail_finish
(cnc, sync_data->res,
elements, error);
@@ -1819,7 +1860,9 @@ e_ews_connection_get_oal_detail (EEwsConnection *cnc,
}
static void
-oal_download_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
+oal_download_response_cb (SoupSession *session,
+ SoupMessage *msg,
+ gpointer user_data)
{
GError *error = NULL;
guint status = msg->status_code;
@@ -1850,21 +1893,23 @@ exit:
g_free (data);
}
-static void
-ews_soup_got_headers (SoupMessage *msg, gpointer user_data)
+static void
+ews_soup_got_headers (SoupMessage *msg,
+ gpointer user_data)
{
struct _oal_req_data *data = (struct _oal_req_data *) user_data;
- const char *size;
+ const gchar *size;
size = soup_message_headers_get_one (msg->response_headers,
"Content-Length");
if (size)
- data->response_size = strtol(size, NULL, 10);
+ data->response_size = strtol (size, NULL, 10);
}
-static void
-ews_soup_restarted (SoupMessage *msg, gpointer user_data)
+static void
+ews_soup_restarted (SoupMessage *msg,
+ gpointer user_data)
{
struct _oal_req_data *data = (struct _oal_req_data *) user_data;
@@ -1872,8 +1917,10 @@ ews_soup_restarted (SoupMessage *msg, gpointer user_data)
data->received_size = 0;
}
-static void
-ews_soup_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
+static void
+ews_soup_got_chunk (SoupMessage *msg,
+ SoupBuffer *chunk,
+ gpointer user_data)
{
struct _oal_req_data *data = (struct _oal_req_data *) user_data;
gint fd;
@@ -1884,13 +1931,13 @@ ews_soup_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
data->received_size += chunk->length;
if (data->response_size && data->progress_fn) {
- int pc = data->received_size * 100 / data->response_size;
+ gint pc = data->received_size * 100 / data->response_size;
data->progress_fn (data->progress_data, pc);
}
fd = g_open (data->cache_filename, O_RDONLY | O_WRONLY | O_APPEND | O_CREAT, 0600);
if (fd != -1) {
- if (write (fd, (const gchar*)chunk->data, chunk->length) != chunk->length) {
+ if (write (fd, (const gchar *) chunk->data, chunk->length) != chunk->length) {
g_set_error (&data->error, EWS_CONNECTION_ERROR, EWS_CONNECTION_ERROR_UNKNOWN,
"Failed to write streaming data to file : %d ", errno);
}
@@ -1905,14 +1952,14 @@ ews_soup_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
}
}
-void
-e_ews_connection_download_oal_file_start (EEwsConnection *cnc,
- const gchar *cache_filename,
- GAsyncReadyCallback cb,
- EwsProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- gpointer user_data)
+void
+e_ews_connection_download_oal_file_start (EEwsConnection *cnc,
+ const gchar *cache_filename,
+ GAsyncReadyCallback cb,
+ EwsProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
SoupMessage *msg;
@@ -1936,7 +1983,7 @@ e_ews_connection_download_oal_file_start (EEwsConnection *cnc,
if (cancellable)
data->cancel_handler_id = g_cancellable_connect (cancellable,
G_CALLBACK (ews_cancel_msg), (gpointer) data, NULL);
-
+
soup_message_body_set_accumulate (SOUP_MESSAGE (msg)->response_body,
FALSE);
g_signal_connect (msg, "got-headers", G_CALLBACK (ews_soup_got_headers), data);
@@ -1947,10 +1994,10 @@ e_ews_connection_download_oal_file_start (EEwsConnection *cnc,
oal_download_response_cb, data);
}
-gboolean
-e_ews_connection_download_oal_file_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+gboolean
+e_ews_connection_download_oal_file_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -1967,13 +2014,13 @@ e_ews_connection_download_oal_file_finish (EEwsConnection *cnc,
return TRUE;
}
-gboolean
-e_ews_connection_download_oal_file (EEwsConnection *cnc,
- const gchar *cache_filename,
- EwsProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- GError **error)
+gboolean
+e_ews_connection_download_oal_file (EEwsConnection *cnc,
+ const gchar *cache_filename,
+ EwsProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -1982,7 +2029,7 @@ e_ews_connection_download_oal_file (EEwsConnection *cnc,
sync_data->eflag = e_flag_new ();
e_ews_connection_download_oal_file_start
- (cnc, cache_filename,
+ (cnc, cache_filename,
ews_sync_reply_cb,
progress_fn, progress_data,
cancellable, sync_data);
@@ -2001,8 +2048,8 @@ e_ews_connection_download_oal_file (EEwsConnection *cnc,
}
void
-e_ews_connection_set_mailbox (EEwsConnection *cnc,
- const gchar *email)
+e_ews_connection_set_mailbox (EEwsConnection *cnc,
+ const gchar *email)
{
g_return_if_fail (email != NULL);
@@ -2012,19 +2059,20 @@ e_ews_connection_set_mailbox (EEwsConnection *cnc,
}
static void
-ews_append_additional_props_to_msg (ESoapMessage *msg, EwsAdditionalProps *add_props)
+ews_append_additional_props_to_msg (ESoapMessage *msg,
+ EwsAdditionalProps *add_props)
{
GSList *l;
if (!add_props)
return;
-
+
e_soap_message_start_element (msg, "AdditionalProperties", NULL, NULL);
if (add_props->field_uri) {
gchar **prop = g_strsplit (add_props->field_uri, " ", 0);
gint i = 0;
-
+
while (prop[i]) {
e_ews_message_write_string_parameter_with_attribute (msg, "FieldURI", NULL, NULL, "FieldURI", prop [i]);
i++;
@@ -2036,9 +2084,9 @@ ews_append_additional_props_to_msg (ESoapMessage *msg, EwsAdditionalProps *add_p
if (add_props->extended_furis) {
for (l = add_props->extended_furis; l != NULL; l = g_slist_next (l)) {
EwsExtendedFieldURI *ex_furi = (EwsExtendedFieldURI *) l->data;
-
+
e_soap_message_start_element (msg, "ExtendedFieldURI", NULL, NULL);
-
+
if (ex_furi->distinguished_prop_set_id)
e_soap_message_add_attribute (msg, "DistinguishedPropertySetId", ex_furi->distinguished_prop_set_id, NULL, NULL);
@@ -2047,10 +2095,10 @@ ews_append_additional_props_to_msg (ESoapMessage *msg, EwsAdditionalProps *add_p
if (ex_furi->prop_name)
e_soap_message_add_attribute (msg, "PropertyName", ex_furi->prop_name, NULL, NULL);
-
+
if (ex_furi->prop_id)
e_soap_message_add_attribute (msg, "PropertyId", ex_furi->prop_id, NULL, NULL);
-
+
if (ex_furi->prop_type)
e_soap_message_add_attribute (msg, "PropertyType", ex_furi->prop_type, NULL, NULL);
@@ -2063,10 +2111,10 @@ ews_append_additional_props_to_msg (ESoapMessage *msg, EwsAdditionalProps *add_p
EwsIndexedFieldURI *in_furi = (EwsIndexedFieldURI *) l->data;
e_soap_message_start_element (msg, "IndexedFieldURI", NULL, NULL);
-
+
e_soap_message_add_attribute (msg, "FieldURI", in_furi->field_uri, NULL, NULL);
e_soap_message_add_attribute (msg, "FieldIndex", in_furi->field_index, NULL, NULL);
-
+
e_soap_message_end_element (msg);
}
}
@@ -2075,7 +2123,8 @@ ews_append_additional_props_to_msg (ESoapMessage *msg, EwsAdditionalProps *add_p
}
static void
-ews_write_sort_order_to_msg (ESoapMessage *msg, EwsSortOrder *sort_order)
+ews_write_sort_order_to_msg (ESoapMessage *msg,
+ EwsSortOrder *sort_order)
{
if (!sort_order)
return;
@@ -2095,9 +2144,9 @@ ews_write_sort_order_to_msg (ESoapMessage *msg, EwsSortOrder *sort_order)
e_soap_message_end_element (msg);
} else if (sort_order->uri_type == EXTENDED_FIELD_URI) {
EwsExtendedFieldURI *ex_furi = (EwsExtendedFieldURI *) sort_order->field_uri;
-
+
e_soap_message_start_element (msg, "ExtendedFieldURI", NULL, NULL);
-
+
if (ex_furi->distinguished_prop_set_id)
e_soap_message_add_attribute (msg, "DistinguishedPropertySetId", ex_furi->distinguished_prop_set_id, NULL, NULL);
if (ex_furi->prop_set_id)
@@ -2130,16 +2179,16 @@ ews_write_sort_order_to_msg (ESoapMessage *msg, EwsSortOrder *sort_order)
* @user_data: user data passed to callback
**/
void
-e_ews_connection_sync_folder_items_start (EEwsConnection *cnc,
- gint pri,
- const gchar *sync_state,
- const gchar *fid,
- const gchar *default_props,
- const gchar *additional_props,
- guint max_entries,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_sync_folder_items_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *sync_state,
+ const gchar *fid,
+ const gchar *default_props,
+ const gchar *additional_props,
+ guint max_entries,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2177,10 +2226,10 @@ e_ews_connection_sync_folder_items_start (EEwsConnection *cnc,
/* Complete the footer and print the request */
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_sync_folder_items_start);
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
+ user_data,
+ e_ews_connection_sync_folder_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2191,14 +2240,14 @@ e_ews_connection_sync_folder_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_sync_folder_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- gchar **sync_state,
- gboolean *includes_last_item,
- GSList **items_created,
- GSList **items_updated,
- GSList **items_deleted,
- GError **error)
+e_ews_connection_sync_folder_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ gchar **sync_state,
+ gboolean *includes_last_item,
+ GSList **items_created,
+ GSList **items_updated,
+ GSList **items_deleted,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -2224,19 +2273,19 @@ e_ews_connection_sync_folder_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_sync_folder_items (EEwsConnection *cnc,
- gint pri,
- gchar **sync_state,
- const gchar *fid,
- const gchar *default_props,
- const gchar *additional_props,
- guint max_entries,
- gboolean *includes_last_item,
- GSList **items_created,
- GSList **items_updated,
- GSList **items_deleted,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_sync_folder_items (EEwsConnection *cnc,
+ gint pri,
+ gchar **sync_state,
+ const gchar *fid,
+ const gchar *default_props,
+ const gchar *additional_props,
+ guint max_entries,
+ gboolean *includes_last_item,
+ GSList **items_created,
+ GSList **items_updated,
+ GSList **items_deleted,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2268,10 +2317,12 @@ e_ews_connection_sync_folder_items (EEwsConnection *cnc,
}
static void
-ews_append_folder_ids_to_msg (ESoapMessage *msg, const gchar *email, GSList *folder_ids)
+ews_append_folder_ids_to_msg (ESoapMessage *msg,
+ const gchar *email,
+ GSList *folder_ids)
{
GSList *l;
-
+
for (l = folder_ids; l != NULL; l = g_slist_next (l)) {
EwsFolderId *fid = (EwsFolderId *) l->data;
@@ -2307,18 +2358,18 @@ ews_append_folder_ids_to_msg (ESoapMessage *msg, const gchar *email, GSList *fol
* @user_data: user data passed to callback
**/
void
-e_ews_connection_find_folder_items_start (EEwsConnection *cnc,
- gint pri,
- EwsFolderId *fid,
- const gchar *default_props,
- EwsAdditionalProps *add_props,
- EwsSortOrder *sort_order,
- const gchar *query,
- EwsFolderType type,
- EwsConvertQueryCallback convert_query_cb,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_find_folder_items_start (EEwsConnection *cnc,
+ gint pri,
+ EwsFolderId *fid,
+ const gchar *default_props,
+ EwsAdditionalProps *add_props,
+ EwsSortOrder *sort_order,
+ const gchar *query,
+ EwsFolderType type,
+ EwsConvertQueryCallback convert_query_cb,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2351,10 +2402,10 @@ e_ews_connection_find_folder_items_start (EEwsConnection *cnc,
/* Complete the footer and print the request */
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_find_folder_items_start);
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
+ user_data,
+ e_ews_connection_find_folder_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2365,11 +2416,11 @@ e_ews_connection_find_folder_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_find_folder_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- gboolean *includes_last_item,
- GSList **items,
- GError **error)
+e_ews_connection_find_folder_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ gboolean *includes_last_item,
+ GSList **items,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -2392,19 +2443,19 @@ e_ews_connection_find_folder_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_find_folder_items (EEwsConnection *cnc,
- gint pri,
- EwsFolderId *fid,
- const gchar *default_props,
- EwsAdditionalProps *add_props,
- EwsSortOrder *sort_order,
- const gchar *query,
- EwsFolderType type,
- gboolean *includes_last_item,
- GSList **items,
- EwsConvertQueryCallback convert_query_cb,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_find_folder_items (EEwsConnection *cnc,
+ gint pri,
+ EwsFolderId *fid,
+ const gchar *default_props,
+ EwsAdditionalProps *add_props,
+ EwsSortOrder *sort_order,
+ const gchar *query,
+ EwsFolderType type,
+ gboolean *includes_last_item,
+ GSList **items,
+ EwsConvertQueryCallback convert_query_cb,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2432,14 +2483,13 @@ e_ews_connection_find_folder_items (EEwsConnection *cnc,
return result;
}
-
void
-e_ews_connection_sync_folder_hierarchy_start (EEwsConnection *cnc,
- gint pri,
- const gchar *sync_state,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_sync_folder_hierarchy_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *sync_state,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2455,10 +2505,10 @@ e_ews_connection_sync_folder_hierarchy_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_sync_folder_hierarchy_start);
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
+ user_data,
+ e_ews_connection_sync_folder_hierarchy_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2468,16 +2518,15 @@ e_ews_connection_sync_folder_hierarchy_start (EEwsConnection *cnc,
cancellable, simple, cb == ews_sync_reply_cb);
}
-
gboolean
-e_ews_connection_sync_folder_hierarchy_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- gchar **sync_state,
- gboolean *includes_last_folder,
- GSList **folders_created,
- GSList **folders_updated,
- GSList **folders_deleted,
- GError **error)
+e_ews_connection_sync_folder_hierarchy_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ gchar **sync_state,
+ gboolean *includes_last_folder,
+ GSList **folders_created,
+ GSList **folders_updated,
+ GSList **folders_deleted,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -2503,15 +2552,15 @@ e_ews_connection_sync_folder_hierarchy_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_sync_folder_hierarchy (EEwsConnection *cnc,
- gint pri,
- gchar **sync_state,
- gboolean *includes_last_folder,
- GSList **folders_created,
- GSList **folders_updated,
- GSList **folders_deleted,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_sync_folder_hierarchy (EEwsConnection *cnc,
+ gint pri,
+ gchar **sync_state,
+ gboolean *includes_last_folder,
+ GSList **folders_created,
+ GSList **folders_updated,
+ GSList **folders_deleted,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2541,18 +2590,18 @@ e_ews_connection_sync_folder_hierarchy (EEwsConnection *cnc,
}
void
-e_ews_connection_get_items_start (EEwsConnection *cnc,
- gint pri,
- const GSList *ids,
- const gchar *default_props,
- const gchar *additional_props,
- gboolean include_mime,
- const gchar *mime_directory,
- GAsyncReadyCallback cb,
- ESoapProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_get_items_start (EEwsConnection *cnc,
+ gint pri,
+ const GSList *ids,
+ const gchar *default_props,
+ const gchar *additional_props,
+ gboolean include_mime,
+ const gchar *mime_directory,
+ GAsyncReadyCallback cb,
+ ESoapProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2606,9 +2655,9 @@ e_ews_connection_get_items_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_get_items_start);
+ cb,
+ user_data,
+ e_ews_connection_get_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2619,10 +2668,10 @@ e_ews_connection_get_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_get_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **items,
- GError **error)
+e_ews_connection_get_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **items,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -2644,18 +2693,18 @@ e_ews_connection_get_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_get_items (EEwsConnection *cnc,
- gint pri,
- const GSList *ids,
- const gchar *default_props,
- const gchar *additional_props,
- gboolean include_mime,
- const gchar *mime_directory,
- GSList **items,
- ESoapProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_get_items (EEwsConnection *cnc,
+ gint pri,
+ const GSList *ids,
+ const gchar *default_props,
+ const gchar *additional_props,
+ gboolean include_mime,
+ const gchar *mime_directory,
+ GSList **items,
+ ESoapProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2684,7 +2733,7 @@ e_ews_connection_get_items (EEwsConnection *cnc,
return result;
}
-static const char *
+static const gchar *
ews_delete_type_to_str (EwsDeleteType delete_type)
{
switch (delete_type) {
@@ -2698,7 +2747,7 @@ ews_delete_type_to_str (EwsDeleteType delete_type)
return NULL;
}
-static const char *
+static const gchar *
ews_send_cancels_to_str (EwsSendMeetingCancellationsType send_cancels)
{
switch (send_cancels) {
@@ -2712,7 +2761,7 @@ ews_send_cancels_to_str (EwsSendMeetingCancellationsType send_cancels)
return NULL;
}
-static const char *
+static const gchar *
ews_affected_tasks_to_str (EwsAffectedTaskOccurrencesType affected_tasks)
{
switch (affected_tasks) {
@@ -2725,15 +2774,15 @@ ews_affected_tasks_to_str (EwsAffectedTaskOccurrencesType affected_tasks)
}
void
-e_ews_connection_delete_items_start (EEwsConnection *cnc,
- gint pri,
- GSList *ids,
- EwsDeleteType delete_type,
- EwsSendMeetingCancellationsType send_cancels,
- EwsAffectedTaskOccurrencesType affected_tasks,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_delete_items_start (EEwsConnection *cnc,
+ gint pri,
+ GSList *ids,
+ EwsDeleteType delete_type,
+ EwsSendMeetingCancellationsType send_cancels,
+ EwsAffectedTaskOccurrencesType affected_tasks,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2761,9 +2810,9 @@ e_ews_connection_delete_items_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_delete_items_start);
+ cb,
+ user_data,
+ e_ews_connection_delete_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2774,16 +2823,16 @@ e_ews_connection_delete_items_start (EEwsConnection *cnc,
}
void
-e_ews_connection_delete_item_start (EEwsConnection *cnc,
- gint pri,
- EwsId *item_id,
- guint index,
- EwsDeleteType delete_type,
- EwsSendMeetingCancellationsType send_cancels,
- EwsAffectedTaskOccurrencesType affected_tasks,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_delete_item_start (EEwsConnection *cnc,
+ gint pri,
+ EwsId *item_id,
+ guint index,
+ EwsDeleteType delete_type,
+ EwsSendMeetingCancellationsType send_cancels,
+ EwsAffectedTaskOccurrencesType affected_tasks,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2824,9 +2873,9 @@ e_ews_connection_delete_item_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_delete_items_start);
+ cb,
+ user_data,
+ e_ews_connection_delete_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2837,9 +2886,9 @@ e_ews_connection_delete_item_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_delete_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+e_ews_connection_delete_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -2857,14 +2906,14 @@ e_ews_connection_delete_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_delete_items (EEwsConnection *cnc,
- gint pri,
- GSList *ids,
- EwsDeleteType delete_type,
- EwsSendMeetingCancellationsType send_cancels,
- EwsAffectedTaskOccurrencesType affected_tasks,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_delete_items (EEwsConnection *cnc,
+ gint pri,
+ GSList *ids,
+ EwsDeleteType delete_type,
+ EwsSendMeetingCancellationsType send_cancels,
+ EwsAffectedTaskOccurrencesType affected_tasks,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2890,15 +2939,15 @@ e_ews_connection_delete_items (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_delete_item (EEwsConnection *cnc,
- gint pri,
- EwsId *id,
- guint index,
- EwsDeleteType delete_type,
- EwsSendMeetingCancellationsType send_cancels,
- EwsAffectedTaskOccurrencesType affected_tasks,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_delete_item (EEwsConnection *cnc,
+ gint pri,
+ EwsId *id,
+ guint index,
+ EwsDeleteType delete_type,
+ EwsSendMeetingCancellationsType send_cancels,
+ EwsAffectedTaskOccurrencesType affected_tasks,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -2924,17 +2973,17 @@ e_ews_connection_delete_item (EEwsConnection *cnc,
}
void
-e_ews_connection_update_items_start (EEwsConnection *cnc,
- gint pri,
- const gchar *conflict_res,
- const gchar *msg_disposition,
- const gchar *send_invites,
- const gchar *folder_id,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_update_items_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *conflict_res,
+ const gchar *msg_disposition,
+ const gchar *send_invites,
+ const gchar *folder_id,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -2969,9 +3018,9 @@ e_ews_connection_update_items_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_update_items_start);
+ cb,
+ user_data,
+ e_ews_connection_update_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -2982,10 +3031,10 @@ e_ews_connection_update_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_update_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **ids,
- GError **error)
+e_ews_connection_update_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **ids,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3013,17 +3062,17 @@ e_ews_connection_update_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_update_items (EEwsConnection *cnc,
- gint pri,
- const gchar *conflict_res,
- const gchar *msg_disposition,
- const gchar *send_invites,
- const gchar *folder_id,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GSList **ids,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_update_items (EEwsConnection *cnc,
+ gint pri,
+ const gchar *conflict_res,
+ const gchar *msg_disposition,
+ const gchar *send_invites,
+ const gchar *folder_id,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GSList **ids,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3051,16 +3100,16 @@ e_ews_connection_update_items (EEwsConnection *cnc,
}
void
-e_ews_connection_create_items_start (EEwsConnection *cnc,
- gint pri,
- const gchar *msg_disposition,
- const gchar *send_invites,
- const gchar *folder_id,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_create_items_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *msg_disposition,
+ const gchar *send_invites,
+ const gchar *folder_id,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3092,9 +3141,9 @@ e_ews_connection_create_items_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg); /* CreateItem */
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_create_items_start);
+ cb,
+ user_data,
+ e_ews_connection_create_items_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3105,10 +3154,10 @@ e_ews_connection_create_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_create_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **ids,
- GError **error)
+e_ews_connection_create_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **ids,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3129,16 +3178,16 @@ e_ews_connection_create_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_create_items (EEwsConnection *cnc,
- gint pri,
- const gchar *msg_disposition,
- const gchar *send_invites,
- const gchar *folder_id,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GSList **ids,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_create_items (EEwsConnection *cnc,
+ gint pri,
+ const gchar *msg_disposition,
+ const gchar *send_invites,
+ const gchar *folder_id,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GSList **ids,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3183,17 +3232,16 @@ get_search_scope_str (EwsContactsSearchScope scope)
}
}
-
void
-e_ews_connection_resolve_names_start (EEwsConnection *cnc,
- gint pri,
- const gchar *resolve_name,
- EwsContactsSearchScope scope,
- GSList *parent_folder_ids,
- gboolean fetch_contact_data,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_resolve_names_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *resolve_name,
+ EwsContactsSearchScope scope,
+ GSList *parent_folder_ids,
+ gboolean fetch_contact_data,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3219,9 +3267,9 @@ e_ews_connection_resolve_names_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_resolve_names_start);
+ cb,
+ user_data,
+ e_ews_connection_resolve_names_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3232,12 +3280,12 @@ e_ews_connection_resolve_names_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_resolve_names_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **mailboxes,
- GSList **contact_items,
- gboolean *includes_last_item,
- GError **error)
+e_ews_connection_resolve_names_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **mailboxes,
+ GSList **contact_items,
+ gboolean *includes_last_item,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3265,17 +3313,17 @@ e_ews_connection_resolve_names_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_resolve_names (EEwsConnection *cnc,
- gint pri,
- const gchar *resolve_name,
- EwsContactsSearchScope scope,
- GSList *parent_folder_ids,
- gboolean fetch_contact_data,
- GSList **mailboxes,
- GSList **contact_items,
- gboolean *includes_last_item,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_resolve_names (EEwsConnection *cnc,
+ gint pri,
+ const gchar *resolve_name,
+ EwsContactsSearchScope scope,
+ GSList *parent_folder_ids,
+ gboolean fetch_contact_data,
+ GSList **mailboxes,
+ GSList **contact_items,
+ gboolean *includes_last_item,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3302,13 +3350,13 @@ e_ews_connection_resolve_names (EEwsConnection *cnc,
return result;
}
-void
-e_ews_connection_expand_dl_start (EEwsConnection *cnc,
- gint pri,
- const EwsMailbox *mb,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+void
+e_ews_connection_expand_dl_start (EEwsConnection *cnc,
+ gint pri,
+ const EwsMailbox *mb,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3320,23 +3368,23 @@ e_ews_connection_expand_dl_start (EEwsConnection *cnc,
if (mb->item_id) {
e_soap_message_start_element (msg, "ItemId", NULL, NULL);
-
+
e_soap_message_add_attribute (msg, "Id", mb->item_id->id, NULL, NULL);
e_soap_message_add_attribute (msg, "ChangeKey", mb->item_id->change_key, NULL, NULL);
-
+
e_soap_message_end_element (msg); /* Mailbox */
-
+
} else if (mb->email)
e_ews_message_write_string_parameter (msg, "EmailAddress", NULL, mb->email);
-
+
e_soap_message_end_element (msg); /* Mailbox */
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_expand_dl_start);
+ cb,
+ user_data,
+ e_ews_connection_expand_dl_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3347,13 +3395,13 @@ e_ews_connection_expand_dl_start (EEwsConnection *cnc,
}
/* includes_last_item does not make sense as expand_dl does not support recursive
- fetch, wierd */
-gboolean
-e_ews_connection_expand_dl_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **mailboxes,
- gboolean *includes_last_item,
- GError **error)
+ * fetch, wierd */
+gboolean
+e_ews_connection_expand_dl_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **mailboxes,
+ gboolean *includes_last_item,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3376,14 +3424,14 @@ e_ews_connection_expand_dl_finish (EEwsConnection *cnc,
}
-gboolean
-e_ews_connection_expand_dl (EEwsConnection *cnc,
- gint pri,
- const EwsMailbox *mb,
- GSList **mailboxes,
- gboolean *includes_last_item,
- GCancellable *cancellable,
- GError **error)
+gboolean
+e_ews_connection_expand_dl (EEwsConnection *cnc,
+ gint pri,
+ const EwsMailbox *mb,
+ GSList **mailboxes,
+ gboolean *includes_last_item,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3408,13 +3456,13 @@ e_ews_connection_expand_dl (EEwsConnection *cnc,
}
void
-e_ews_connection_update_folder_start (EEwsConnection *cnc,
- gint pri,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_update_folder_start (EEwsConnection *cnc,
+ gint pri,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3432,9 +3480,9 @@ e_ews_connection_update_folder_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_update_folder_start);
+ cb,
+ user_data,
+ e_ews_connection_update_folder_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3445,9 +3493,9 @@ e_ews_connection_update_folder_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_update_folder_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+e_ews_connection_update_folder_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -3465,12 +3513,12 @@ e_ews_connection_update_folder_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_update_folder (EEwsConnection *cnc,
- gint pri,
- EEwsRequestCreationCallback create_cb,
- gpointer create_user_data,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_update_folder (EEwsConnection *cnc,
+ gint pri,
+ EEwsRequestCreationCallback create_cb,
+ gpointer create_user_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3496,13 +3544,13 @@ e_ews_connection_update_folder (EEwsConnection *cnc,
}
void
-e_ews_connection_move_folder_start (EEwsConnection *cnc,
- gint pri,
- const gchar *to_folder,
- const gchar *folder,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_move_folder_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *to_folder,
+ const gchar *folder,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3529,9 +3577,9 @@ e_ews_connection_move_folder_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_move_folder_start);
+ cb,
+ user_data,
+ e_ews_connection_move_folder_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3542,9 +3590,9 @@ e_ews_connection_move_folder_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_move_folder_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+e_ews_connection_move_folder_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -3562,12 +3610,12 @@ e_ews_connection_move_folder_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_move_folder (EEwsConnection *cnc,
- gint pri,
- const gchar *to_folder,
- const gchar *folder,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_move_folder (EEwsConnection *cnc,
+ gint pri,
+ const gchar *to_folder,
+ const gchar *folder,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3591,16 +3639,15 @@ e_ews_connection_move_folder (EEwsConnection *cnc,
return result;
}
-
void
-e_ews_connection_get_folder_start (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_shape,
- EwsAdditionalProps *add_props,
- GSList *folder_ids,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_get_folder_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_shape,
+ EwsAdditionalProps *add_props,
+ GSList *folder_ids,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3624,9 +3671,9 @@ e_ews_connection_get_folder_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
- user_data,
- e_ews_connection_get_folder_start);
+ cb,
+ user_data,
+ e_ews_connection_get_folder_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3637,11 +3684,11 @@ e_ews_connection_get_folder_start (EEwsConnection *cnc,
}
-gboolean
-e_ews_connection_get_folder_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **folders,
- GError **error)
+gboolean
+e_ews_connection_get_folder_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **folders,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3662,15 +3709,15 @@ e_ews_connection_get_folder_finish (EEwsConnection *cnc,
return TRUE;
}
-gboolean
-e_ews_connection_get_folder (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_shape,
- EwsAdditionalProps *add_props,
- GSList *folder_ids,
- GSList **folders,
- GCancellable *cancellable,
- GError **error)
+gboolean
+e_ews_connection_get_folder (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_shape,
+ EwsAdditionalProps *add_props,
+ GSList *folder_ids,
+ GSList **folders,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3696,14 +3743,14 @@ e_ews_connection_get_folder (EEwsConnection *cnc,
}
void
-e_ews_connection_create_folder_start (EEwsConnection *cnc,
- gint pri,
- const gchar *parent_folder_id,
- gboolean is_distinguished_id,
- const gchar *folder_name,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_create_folder_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *parent_folder_id,
+ gboolean is_distinguished_id,
+ const gchar *folder_name,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3734,10 +3781,10 @@ e_ews_connection_create_folder_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
user_data,
- e_ews_connection_create_folder_start);
+ e_ews_connection_create_folder_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3747,10 +3794,10 @@ e_ews_connection_create_folder_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_create_folder_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- EwsFolderId **fid,
- GError **error)
+e_ews_connection_create_folder_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ EwsFolderId **fid,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3772,16 +3819,15 @@ e_ews_connection_create_folder_finish (EEwsConnection *cnc,
return TRUE;
}
-
gboolean
-e_ews_connection_create_folder (EEwsConnection *cnc,
- gint pri,
- const gchar *parent_folder_id,
- gboolean is_distinguished_id,
- const gchar *folder_name,
- EwsFolderId **folder_id,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_create_folder (EEwsConnection *cnc,
+ gint pri,
+ const gchar *parent_folder_id,
+ gboolean is_distinguished_id,
+ const gchar *folder_name,
+ EwsFolderId **folder_id,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3811,14 +3857,14 @@ e_ews_connection_create_folder (EEwsConnection *cnc,
}
void
-e_ews_connection_move_items_start (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_id,
- gboolean docopy,
- GSList *ids,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_move_items_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_id,
+ gboolean docopy,
+ GSList *ids,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3859,10 +3905,10 @@ e_ews_connection_move_items_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_move_items_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **items,
- GError **error)
+e_ews_connection_move_items_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **items,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -3884,14 +3930,14 @@ e_ews_connection_move_items_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_move_items (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_id,
- gboolean docopy,
- GSList *ids,
- GSList **items,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_move_items (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_id,
+ gboolean docopy,
+ GSList *ids,
+ GSList **items,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -3927,14 +3973,14 @@ void
* @cancellable:
* @user_data:
**/
-e_ews_connection_delete_folder_start (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_id,
- gboolean is_distinguished_id,
- const gchar *delete_type,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_delete_folder_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_id,
+ gboolean is_distinguished_id,
+ const gchar *delete_type,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -3957,10 +4003,10 @@ e_ews_connection_delete_folder_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
user_data,
- e_ews_connection_delete_folder_start);
+ e_ews_connection_delete_folder_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -3969,11 +4015,10 @@ e_ews_connection_delete_folder_start (EEwsConnection *cnc,
ews_connection_queue_request (cnc, msg, NULL, pri, cancellable, simple, cb == ews_sync_reply_cb);
}
-
gboolean
-e_ews_connection_delete_folder_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+e_ews_connection_delete_folder_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
@@ -3990,7 +4035,6 @@ e_ews_connection_delete_folder_finish (EEwsConnection *cnc,
return TRUE;
}
-gboolean
/**
* e_ews_connection_delete_folder
* @cnc:
@@ -4001,13 +4045,14 @@ gboolean
* @cancellable:
* @error:
**/
-e_ews_connection_delete_folder (EEwsConnection *cnc,
- gint pri,
- const gchar *folder_id,
- gboolean is_distinguished_id,
- const gchar *delete_type,
- GCancellable *cancellable,
- GError **error)
+gboolean
+e_ews_connection_delete_folder (EEwsConnection *cnc,
+ gint pri,
+ const gchar *folder_id,
+ gboolean is_distinguished_id,
+ const gchar *delete_type,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -4037,7 +4082,7 @@ e_ews_connection_delete_folder (EEwsConnection *cnc,
static void
create_attachments_response_cb (ESoapParameter *param,
- EwsNode *enode)
+ EwsNode *enode)
{
/* http://msdn.microsoft.com/en-us/library/aa565877%28v=EXCHG.80%29.aspx */
ESoapParameter *subparam, *attspara, *last_relevant = NULL, *attparam;
@@ -4063,14 +4108,14 @@ create_attachments_response_cb (ESoapParameter *param,
static void
e_ews_connection_attach_file (ESoapMessage *msg,
- const char *uri)
+ const gchar *uri)
{
/* TODO - handle a situation where the file isnt accessible/other problem with it */
/* TODO - This is a naive implementation that just uploads the whole content into memory, ie very inefficient */
struct stat st;
- char *buffer, *filepath;
- const char *filename;
- int fd;
+ gchar *buffer, *filepath;
+ const gchar *filename;
+ gint fd;
/* convert uri to actual file path */
filepath = g_filename_from_uri (uri, NULL, NULL);
@@ -4114,12 +4159,12 @@ e_ews_connection_attach_file (ESoapMessage *msg,
void
e_ews_connection_create_attachments_start (EEwsConnection *cnc,
- gint pri,
- const EwsId *parent,
- const GSList *files,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+ gint pri,
+ const EwsId *parent,
+ const GSList *files,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4132,7 +4177,7 @@ e_ews_connection_create_attachments_start (EEwsConnection *cnc,
e_soap_message_add_attribute (msg, "Id", parent->id, NULL, NULL);
if (parent->change_key)
e_soap_message_add_attribute (msg, "ChangeKey", parent->change_key, NULL, NULL);
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
/* start interation over all items to get the attachemnts */
e_soap_message_start_element (msg, "Attachments", "messages", NULL);
@@ -4159,9 +4204,9 @@ e_ews_connection_create_attachments_start (EEwsConnection *cnc,
GSList *
e_ews_connection_create_attachments_finish (EEwsConnection *cnc,
- gchar **change_key,
- GAsyncResult *result,
- GError **error)
+ gchar **change_key,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4186,12 +4231,12 @@ e_ews_connection_create_attachments_finish (EEwsConnection *cnc,
GSList *
e_ews_connection_create_attachments (EEwsConnection *cnc,
- gint pri,
- const EwsId *parent,
- const GSList *files,
- gchar **change_key,
- GCancellable *cancellable,
- GError **error)
+ gint pri,
+ const EwsId *parent,
+ const GSList *files,
+ gchar **change_key,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
GSList *ids;
@@ -4220,7 +4265,8 @@ e_ews_connection_create_attachments (EEwsConnection *cnc,
/* Delete attachemnts */
static void
-delete_attachments_response_cb (ESoapParameter *subparam, EwsNode *enode)
+delete_attachments_response_cb (ESoapParameter *subparam,
+ EwsNode *enode)
{
/* http://msdn.microsoft.com/en-us/library/aa580782%28v=EXCHG.80%29.aspx */
ESoapParameter *attspara;
@@ -4237,11 +4283,11 @@ delete_attachments_response_cb (ESoapParameter *subparam, EwsNode *enode)
void
e_ews_connection_delete_attachments_start (EEwsConnection *cnc,
- gint pri,
- const GSList *ids,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+ gint pri,
+ const GSList *ids,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4276,8 +4322,8 @@ e_ews_connection_delete_attachments_start (EEwsConnection *cnc,
GSList *
e_ews_connection_delete_attachments_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4301,10 +4347,10 @@ e_ews_connection_delete_attachments_finish (EEwsConnection *cnc,
GSList *
e_ews_connection_delete_attachments (EEwsConnection *cnc,
- gint pri,
- const GSList *ids,
- GCancellable *cancellable,
- GError **error)
+ gint pri,
+ const GSList *ids,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
GSList *parents;
@@ -4333,17 +4379,17 @@ e_ews_connection_delete_attachments (EEwsConnection *cnc,
static void get_attachments_response_cb (ESoapParameter *subparam, EwsNode *enode);
void
-e_ews_connection_get_attachments_start (EEwsConnection *cnc,
- gint pri,
- const gchar *uid,
- const GSList *ids,
- const gchar *cache,
- gboolean include_mime,
- GAsyncReadyCallback cb,
- ESoapProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_get_attachments_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *uid,
+ const GSList *ids,
+ const gchar *cache,
+ gboolean include_mime,
+ GAsyncReadyCallback cb,
+ ESoapProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4362,7 +4408,7 @@ e_ews_connection_get_attachments_start (EEwsConnection *cnc,
/* wrtie empty attachments shape, need to discover maybe usefull in some cases*/
e_soap_message_start_element (msg, "AttachmentShape", "messages", NULL);
e_ews_message_write_string_parameter (msg, "IncludeMimeContent", NULL, "true");
- e_soap_message_end_element(msg);
+ e_soap_message_end_element (msg);
/* start interation over all items to get the attachemnts */
e_soap_message_start_element (msg, "AttachmentIds", "messages", NULL);
@@ -4381,7 +4427,7 @@ e_ews_connection_get_attachments_start (EEwsConnection *cnc,
async_data = g_new0 (EwsAsyncData, 1);
async_data->directory = cache;
- async_data->sync_state = (gchar *)uid;
+ async_data->sync_state = (gchar *) uid;
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
@@ -4390,10 +4436,10 @@ e_ews_connection_get_attachments_start (EEwsConnection *cnc,
}
GSList *
-e_ews_connection_get_attachments_finish(EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **items,
- GError **error)
+e_ews_connection_get_attachments_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GSList **items,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4415,17 +4461,17 @@ e_ews_connection_get_attachments_finish(EEwsConnection *cnc,
}
GSList *
-e_ews_connection_get_attachments(EEwsConnection *cnc,
- gint pri,
- const gchar *uid,
- GSList *ids,
- const gchar *cache,
- gboolean include_mime,
- GSList **items,
- ESoapProgressFn progress_fn,
- gpointer progress_data,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_get_attachments (EEwsConnection *cnc,
+ gint pri,
+ const gchar *uid,
+ GSList *ids,
+ const gchar *cache,
+ gboolean include_mime,
+ GSList **items,
+ ESoapProgressFn progress_fn,
+ gpointer progress_data,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
GSList *attachments_ids;
@@ -4441,7 +4487,7 @@ e_ews_connection_get_attachments(EEwsConnection *cnc,
e_flag_wait (sync_data->eflag);
- attachments_ids = e_ews_connection_get_attachments_finish(cnc,
+ attachments_ids = e_ews_connection_get_attachments_finish (cnc,
sync_data->res,
items,
error);
@@ -4454,7 +4500,8 @@ e_ews_connection_get_attachments(EEwsConnection *cnc,
}
static void
-get_attachments_response_cb (ESoapParameter *param, EwsNode *enode)
+get_attachments_response_cb (ESoapParameter *param,
+ EwsNode *enode)
{
ESoapParameter *subparam, *attspara;
EwsAsyncData *async_data;
@@ -4467,16 +4514,16 @@ get_attachments_response_cb (ESoapParameter *param, EwsNode *enode)
attspara = e_soap_parameter_get_first_child_by_name (param, "Attachments");
for (subparam = e_soap_parameter_get_first_child (attspara); subparam != NULL; subparam = e_soap_parameter_get_next_child (subparam)) {
- name = e_soap_parameter_get_name(subparam);
+ name = e_soap_parameter_get_name (subparam);
if (!g_ascii_strcasecmp (name, "ItemAttachment")) {
- item = e_ews_item_new_from_soap_parameter(subparam);
+ item = e_ews_item_new_from_soap_parameter (subparam);
attach_id = g_strdup (e_ews_item_get_attachment_id (item)->id);
- uri = e_ews_item_dump_mime_content(item, async_data->directory);
+ uri = e_ews_item_dump_mime_content (item, async_data->directory);
}
else if (!g_ascii_strcasecmp (name, "FileAttachment")) {
- uri = e_ews_dump_file_attachment_from_soap_parameter(subparam, async_data->directory, async_data->sync_state, &attach_id);
+ uri = e_ews_dump_file_attachment_from_soap_parameter (subparam, async_data->directory, async_data->sync_state, &attach_id);
}
if (uri && attach_id) {
async_data->items = g_slist_append (async_data->items, uri);
@@ -4488,10 +4535,11 @@ get_attachments_response_cb (ESoapParameter *param, EwsNode *enode)
}
static void
-get_free_busy_response_cb (ESoapParameter *param, EwsNode *enode)
+get_free_busy_response_cb (ESoapParameter *param,
+ EwsNode *enode)
{
/*parse the response to create a free_busy data
- http://msdn.microsoft.com/en-us/library/aa564001%28v=EXCHG.140%29.aspx*/
+ http://msdn.microsoft.com / en - us / library / aa564001 % 28v = EXCHG.140 % 29.aspx */
icalcomponent *vfb;
icalproperty *icalprop = NULL;
struct icalperiodtype ipt;
@@ -4537,7 +4585,7 @@ get_free_busy_response_cb (ESoapParameter *param, EwsNode *enode)
g_free (value);
}
}
- if (icalprop != NULL) icalcomponent_add_property(vfb, icalprop);
+ if (icalprop != NULL) icalcomponent_add_property (vfb, icalprop);
}
async_data->items = g_slist_append (async_data->items, vfb);
@@ -4545,12 +4593,12 @@ get_free_busy_response_cb (ESoapParameter *param, EwsNode *enode)
void
e_ews_connection_get_free_busy_start (EEwsConnection *cnc,
- gint pri,
- EEwsRequestCreationCallback free_busy_cb,
- gpointer free_busy_user_data,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+ gint pri,
+ EEwsRequestCreationCallback free_busy_cb,
+ gpointer free_busy_user_data,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4578,9 +4626,9 @@ e_ews_connection_get_free_busy_start (EEwsConnection *cnc,
gboolean
e_ews_connection_get_free_busy_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GSList **free_busy,
- GError **error)
+ GAsyncResult *result,
+ GSList **free_busy,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4602,12 +4650,12 @@ e_ews_connection_get_free_busy_finish (EEwsConnection *cnc,
gboolean
e_ews_connection_get_free_busy (EEwsConnection *cnc,
- gint pri,
- EEwsRequestCreationCallback free_busy_cb,
- gpointer free_busy_user_data,
- GSList **free_busy,
- GCancellable *cancellable,
- GError **error)
+ gint pri,
+ EEwsRequestCreationCallback free_busy_cb,
+ gpointer free_busy_user_data,
+ GSList **free_busy,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -4632,9 +4680,10 @@ e_ews_connection_get_free_busy (EEwsConnection *cnc,
return result;
}
-static EwsPermissionLevel get_permission_from_string(gchar *permission)
+static EwsPermissionLevel
+get_permission_from_string (gchar *permission)
{
- g_return_val_if_fail(permission != NULL, NONE);
+ g_return_val_if_fail (permission != NULL, NONE);
if (!g_ascii_strcasecmp (permission, "Editor"))
return EWS_PERM_EDITOR;
@@ -4650,7 +4699,8 @@ static EwsPermissionLevel get_permission_from_string(gchar *permission)
}
static void
-get_delegate_response_cb (ESoapParameter *param, EwsNode *enode)
+get_delegate_response_cb (ESoapParameter *param,
+ EwsNode *enode)
{
ESoapParameter *subparam, *node, *child;
EwsAsyncData *async_data;
@@ -4661,52 +4711,52 @@ get_delegate_response_cb (ESoapParameter *param, EwsNode *enode)
node = e_soap_parameter_get_first_child_by_name (param, "DelegateUser");
- data = g_new(EwsDelegateInfo, 1);
- data->user_id = g_new0(EwsUserId, 1);
+ data = g_new (EwsDelegateInfo, 1);
+ data->user_id = g_new0 (EwsUserId, 1);
subparam = e_soap_parameter_get_first_child_by_name(node, "UserId");
/*Parse User Id*/
-
+
child = e_soap_parameter_get_first_child_by_name(subparam, "SID");
- data->user_id->sid = e_soap_parameter_get_string_value(child);
+ data->user_id->sid = e_soap_parameter_get_string_value (child);
child = e_soap_parameter_get_first_child_by_name(subparam, "PrimarySmtpAddress");
- data->user_id->primary_smtp_add = e_soap_parameter_get_string_value(child);
+ data->user_id->primary_smtp_add = e_soap_parameter_get_string_value (child);
child = e_soap_parameter_get_first_child_by_name(subparam, "DisplayName");
- data->user_id->display_name = e_soap_parameter_get_string_value(child);
+ data->user_id->display_name = e_soap_parameter_get_string_value (child);
subparam = e_soap_parameter_get_first_child_by_name(node, "DelegatePermissions");
/*Parse Delegate Permissions*/
child = e_soap_parameter_get_first_child_by_name(subparam, "CalendarFolderPermissionLevel");
- data->calendar = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->calendar = get_permission_from_string (e_soap_parameter_get_string_value (child));
child = e_soap_parameter_get_first_child_by_name(subparam, "ContactsFolderPermissionLevel");
- data->contact = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->contact = get_permission_from_string (e_soap_parameter_get_string_value (child));
child = e_soap_parameter_get_first_child_by_name(subparam, "InboxFolderPermissionLevel");
- data->inbox = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->inbox = get_permission_from_string (e_soap_parameter_get_string_value (child));
child = e_soap_parameter_get_first_child_by_name(subparam, "TasksFolderPermissionLevel");
- data->tasks = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->tasks = get_permission_from_string (e_soap_parameter_get_string_value (child));
child = e_soap_parameter_get_first_child_by_name(subparam, "NotesFolderPermissionLevel");
- data->notes = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->notes = get_permission_from_string (e_soap_parameter_get_string_value (child));
child = e_soap_parameter_get_first_child_by_name(subparam, "JournalFolderPermissionLevel");
- data->journal = get_permission_from_string(e_soap_parameter_get_string_value(child));
+ data->journal = get_permission_from_string (e_soap_parameter_get_string_value (child));
subparam = e_soap_parameter_get_first_child_by_name(node, "ReceiveCopiesOfMeetingMessages");
- value = e_soap_parameter_get_string_value(subparam);
+ value = e_soap_parameter_get_string_value (subparam);
if(!g_ascii_strcasecmp(value, "true"))
data->meetingcopies = TRUE;
subparam = e_soap_parameter_get_first_child_by_name(node, "ViewPrivateItems");
- value = e_soap_parameter_get_string_value(subparam);
+ value = e_soap_parameter_get_string_value (subparam);
if(!g_ascii_strcasecmp(value, "true"))
data->view_priv_items = TRUE;
else
@@ -4718,7 +4768,6 @@ get_delegate_response_cb (ESoapParameter *param, EwsNode *enode)
return;
}
-
/**
* e_ews_connection_get_delegate_start
* @cnc:
@@ -4731,13 +4780,13 @@ get_delegate_response_cb (ESoapParameter *param, EwsNode *enode)
* @user_data:
**/
void
-e_ews_connection_get_delegate_start (EEwsConnection *cnc,
- gint pri,
- const gchar *mail_id,
- const gchar *include_permissions,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_get_delegate_start (EEwsConnection *cnc,
+ gint pri,
+ const gchar *mail_id,
+ const gchar *include_permissions,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4753,10 +4802,10 @@ e_ews_connection_get_delegate_start (EEwsConnection *cnc,
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
- cb,
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
+ cb,
user_data,
- e_ews_connection_get_delegate_start);
+ e_ews_connection_get_delegate_start);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
@@ -4765,12 +4814,11 @@ e_ews_connection_get_delegate_start (EEwsConnection *cnc,
ews_connection_queue_request (cnc, msg, get_delegate_response_cb, pri, cancellable, simple, cb == ews_sync_reply_cb);
}
-
gboolean
-e_ews_connection_get_delegate_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- EwsDelegateInfo **get_delegate,
- GError **error)
+e_ews_connection_get_delegate_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ EwsDelegateInfo **get_delegate,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4801,13 +4849,13 @@ e_ews_connection_get_delegate_finish (EEwsConnection *cnc,
* @error:
**/
gboolean
-e_ews_connection_get_delegate (EEwsConnection *cnc,
- gint pri,
- const gchar *mail_id,
- const gchar *include_permissions,
- EwsDelegateInfo **get_delegate,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_get_delegate (EEwsConnection *cnc,
+ gint pri,
+ const gchar *mail_id,
+ const gchar *include_permissions,
+ EwsDelegateInfo **get_delegate,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -4843,11 +4891,11 @@ e_ews_connection_get_delegate (EEwsConnection *cnc,
* @user_data: user data passed to callback
**/
void
-e_ews_connection_get_oof_settings_start (EEwsConnection *cnc,
- gint pri,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_get_oof_settings_start (EEwsConnection *cnc,
+ gint pri,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4862,7 +4910,7 @@ e_ews_connection_get_oof_settings_start (EEwsConnection *cnc,
/* Complete the footer and print the request */
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
cb, user_data,
e_ews_connection_get_oof_settings_start);
@@ -4875,10 +4923,10 @@ e_ews_connection_get_oof_settings_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_get_oof_settings_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- OOFSettings **oof_settings,
- GError **error)
+e_ews_connection_get_oof_settings_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ OOFSettings **oof_settings,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -4900,11 +4948,11 @@ e_ews_connection_get_oof_settings_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_get_oof_settings (EEwsConnection *cnc,
- gint pri,
- OOFSettings **oof_settings,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_get_oof_settings (EEwsConnection *cnc,
+ gint pri,
+ OOFSettings **oof_settings,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
@@ -4938,12 +4986,12 @@ e_ews_connection_get_oof_settings (EEwsConnection *cnc,
* @user_data: user data passed to callback
**/
void
-e_ews_connection_set_oof_settings_start (EEwsConnection *cnc,
- gint pri,
- OOFSettings *oof_settings,
- GAsyncReadyCallback cb,
- GCancellable *cancellable,
- gpointer user_data)
+e_ews_connection_set_oof_settings_start (EEwsConnection *cnc,
+ gint pri,
+ OOFSettings *oof_settings,
+ GAsyncReadyCallback cb,
+ GCancellable *cancellable,
+ gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
@@ -4988,7 +5036,7 @@ e_ews_connection_set_oof_settings_start (EEwsConnection *cnc,
/* Complete the footer and print the request */
e_ews_message_write_footer (msg);
- simple = g_simple_async_result_new (G_OBJECT (cnc),
+ simple = g_simple_async_result_new (G_OBJECT (cnc),
cb, user_data,
e_ews_connection_set_oof_settings_start);
@@ -5005,9 +5053,9 @@ e_ews_connection_set_oof_settings_start (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_set_oof_settings_finish (EEwsConnection *cnc,
- GAsyncResult *result,
- GError **error)
+e_ews_connection_set_oof_settings_finish (EEwsConnection *cnc,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
@@ -5027,11 +5075,11 @@ e_ews_connection_set_oof_settings_finish (EEwsConnection *cnc,
}
gboolean
-e_ews_connection_set_oof_settings (EEwsConnection *cnc,
- gint pri,
- OOFSettings *oof_settings,
- GCancellable *cancellable,
- GError **error)
+e_ews_connection_set_oof_settings (EEwsConnection *cnc,
+ gint pri,
+ OOFSettings *oof_settings,
+ GCancellable *cancellable,
+ GError **error)
{
EwsSyncData *sync_data;
gboolean result;
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 1f47ba8..b8aee28 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -150,7 +150,7 @@ typedef struct {
gchar *prop_tag;
gchar *prop_name;
gchar *prop_id;
- gchar *prop_type;
+ gchar *prop_type;
} EwsExtendedFieldURI;
typedef struct {
@@ -171,12 +171,12 @@ typedef struct {
} EwsSortOrder;
typedef struct {
- gchar *state; /*Out of office state*/
- gchar *ext_aud; /*external audience*/
- time_t start_tm; /*Start time*/
- time_t end_tm; /*End time*/
- gchar *int_reply; /*Internal Reply*/
- gchar *ext_reply; /*External Reply*/
+ gchar *state; /*Out of office state */
+ gchar *ext_aud; /*external audience */
+ time_t start_tm; /*Start time */
+ time_t end_tm; /*End time */
+ gchar *int_reply; /*Internal Reply */
+ gchar *ext_reply; /*External Reply */
} OOFSettings;
GType e_ews_connection_get_type (void);
@@ -222,7 +222,7 @@ void e_ews_connection_sync_folder_items_start
gboolean e_ews_connection_sync_folder_items_finish
(EEwsConnection *cnc,
GAsyncResult *result,
- gchar **sync_state,
+ gchar **sync_state,
gboolean *includes_last_item,
GSList **items_created,
GSList **items_updated,
@@ -283,7 +283,6 @@ gboolean e_ews_connection_find_folder_items
GCancellable *cancellable,
GError **error);
-
/* Get folder items */
void e_ews_connection_get_items_start
(EEwsConnection *cnc,
@@ -749,7 +748,7 @@ gboolean e_ews_connection_get_oal_detail_finish
GAsyncResult *result,
GSList **elements,
GError **error);
-gboolean e_ews_connection_get_oal_detail
+gboolean e_ews_connection_get_oal_detail
(EEwsConnection *cnc,
const gchar *oal_id,
const gchar *oal_element,
@@ -792,7 +791,7 @@ gboolean e_ews_connection_download_oal_file_finish
(EEwsConnection *cnc,
GAsyncResult *result,
GError **error);
-gboolean e_ews_connection_download_oal_file
+gboolean e_ews_connection_download_oal_file
(EEwsConnection *cnc,
const gchar *cache_filename,
EwsProgressFn progress_fn,
@@ -811,7 +810,7 @@ gboolean e_ews_connection_get_delegate_finish (EEwsConnection *cnc,
GAsyncResult *result,
EwsDelegateInfo **get_delegate,
GError **error);
-gboolean e_ews_connection_get_delegate
+gboolean e_ews_connection_get_delegate
(EEwsConnection *cnc,
gint pri,
const gchar *mail_id,
@@ -846,13 +845,13 @@ void e_ews_connection_set_oof_settings_start (EEwsConnection *cnc,
gboolean e_ews_connection_set_oof_settings_finish (EEwsConnection *cnc,
GAsyncResult *result,
- GError **error);
+ GError **error);
gboolean e_ews_connection_set_oof_settings (EEwsConnection *cnc,
- gint pri,
- OOFSettings *oof_settings,
- GCancellable *cancellable,
- GError **error);
+ gint pri,
+ OOFSettings *oof_settings,
+ GCancellable *cancellable,
+ GError **error);
void e_ews_connection_free_oof_settings (OOFSettings *oof_settings);
diff --git a/src/server/e-ews-folder.c b/src/server/e-ews-folder.c
index 366ca57..22adea4 100644
--- a/src/server/e-ews-folder.c
+++ b/src/server/e-ews-folder.c
@@ -113,7 +113,8 @@ e_ews_folder_init (EEwsFolder *folder)
/* FIXME pick it from folder_type and make it set folder_type */
static void
-e_ews_folder_set_folder_class (EEwsFolder *folder, const gchar *folder_class)
+e_ews_folder_set_folder_class (EEwsFolder *folder,
+ const gchar *folder_class)
{
EEwsFolderPrivate *priv;
@@ -127,9 +128,9 @@ e_ews_folder_set_folder_class (EEwsFolder *folder, const gchar *folder_class)
priv->folder_class = g_strdup (folder_class);
}
-
static gboolean
-e_ews_folder_set_from_soap_parameter (EEwsFolder *folder, ESoapParameter *param)
+e_ews_folder_set_from_soap_parameter (EEwsFolder *folder,
+ ESoapParameter *param)
{
EEwsFolderPrivate *priv = folder->priv;
gchar *value;
@@ -225,7 +226,8 @@ e_ews_folder_get_name (EEwsFolder *folder)
}
void
-e_ews_folder_set_name (EEwsFolder *folder, const gchar *new_name)
+e_ews_folder_set_name (EEwsFolder *folder,
+ const gchar *new_name)
{
EEwsFolderPrivate *priv;
@@ -239,7 +241,6 @@ e_ews_folder_set_name (EEwsFolder *folder, const gchar *new_name)
priv->name = g_strdup (new_name);
}
-
const EwsFolderId *
e_ews_folder_get_id (EEwsFolder *folder)
{
@@ -257,7 +258,8 @@ e_ews_folder_get_parent_id (EEwsFolder *folder)
}
void
-e_ews_folder_set_parent_id (EEwsFolder *folder, EwsFolderId *parent_fid)
+e_ews_folder_set_parent_id (EEwsFolder *folder,
+ EwsFolderId *parent_fid)
{
EEwsFolderPrivate *priv;
@@ -284,7 +286,8 @@ e_ews_folder_get_folder_type (EEwsFolder *folder)
}
void
-e_ews_folder_set_folder_type (EEwsFolder *folder, EwsFolderType folder_type)
+e_ews_folder_set_folder_type (EEwsFolder *folder,
+ EwsFolderType folder_type)
{
g_return_if_fail (E_IS_EWS_FOLDER (folder));
diff --git a/src/server/e-ews-folder.h b/src/server/e-ews-folder.h
index c6d2f17..6272971 100644
--- a/src/server/e-ews-folder.h
+++ b/src/server/e-ews-folder.h
@@ -74,7 +74,7 @@ guint32 e_ews_folder_get_child_count (EEwsFolder *folder);
gboolean e_ews_folder_get_is_writable (EEwsFolder *folder);
void e_ews_folder_set_is_writable (EEwsFolder *folder, gboolean writable);
EwsFolderType e_ews_folder_get_folder_type (EEwsFolder *folder);
-void e_ews_folder_set_folder_type (EEwsFolder *folder, EwsFolderType folder_type);
+void e_ews_folder_set_folder_type (EEwsFolder *folder, EwsFolderType folder_type);
void e_ews_folder_free_fid (EwsFolderId *fid);
diff --git a/src/server/e-ews-item-change.c b/src/server/e-ews-item-change.c
index ee9aecf..90bf32c 100644
--- a/src/server/e-ews-item-change.c
+++ b/src/server/e-ews-item-change.c
@@ -25,9 +25,11 @@
#include "e-ews-item-change.h"
void
-e_ews_message_start_item_change(ESoapMessage *msg, EEwsItemChangeType type,
- const gchar *itemid, const gchar *changekey,
- gint instance_index)
+e_ews_message_start_item_change (ESoapMessage *msg,
+ EEwsItemChangeType type,
+ const gchar *itemid,
+ const gchar *changekey,
+ gint instance_index)
{
gchar *instance;
@@ -57,7 +59,7 @@ e_ews_message_start_item_change(ESoapMessage *msg, EEwsItemChangeType type,
instance = g_strdup_printf("%d", instance_index);
e_soap_message_add_attribute (msg, "InstanceIndex", instance,
NULL, NULL);
- g_free(instance);
+ g_free (instance);
break;
case E_EWS_ITEMCHANGE_TYPE_RECURRINGMASTER:
@@ -84,7 +86,10 @@ e_ews_message_end_item_change (ESoapMessage *msg)
}
void
-e_ews_message_start_set_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const char *field_kind)
+e_ews_message_start_set_item_field (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *fielduri_prefix,
+ const gchar *field_kind)
{
gchar * fielduri = NULL;
fielduri = g_strconcat (fielduri_prefix, ":", name, NULL);
@@ -97,12 +102,17 @@ e_ews_message_start_set_item_field (ESoapMessage *msg, const gchar *name, const
}
void
-e_ews_message_start_set_indexed_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const char *field_kind, const char *field_index, gboolean delete_field)
+e_ews_message_start_set_indexed_item_field (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *fielduri_prefix,
+ const gchar *field_kind,
+ const gchar *field_index,
+ gboolean delete_field)
{
gchar * fielduri = NULL;
fielduri = g_strconcat (fielduri_prefix, ":", name, NULL);
- if(delete_field)
+ if (delete_field)
e_soap_message_start_element (msg, "DeleteItemField", NULL, NULL);
else
e_soap_message_start_element (msg, "SetItemField", NULL, NULL);
@@ -112,16 +122,17 @@ e_ews_message_start_set_indexed_item_field (ESoapMessage *msg, const gchar *name
e_soap_message_add_attribute (msg, "FieldIndex", field_index, NULL, NULL);
e_soap_message_end_element (msg);
- if(!delete_field)
+ if (!delete_field)
e_soap_message_start_element (msg, field_kind, NULL, NULL);
g_free (fielduri);
}
void
-e_ews_message_end_set_indexed_item_field (ESoapMessage *msg, gboolean delete_field)
+e_ews_message_end_set_indexed_item_field (ESoapMessage *msg,
+ gboolean delete_field)
{
- if(!delete_field)
+ if (!delete_field)
e_soap_message_end_element (msg); /* CalendarItem */
e_soap_message_end_element (msg); /* SetItemField */
}
diff --git a/src/server/e-ews-item-change.h b/src/server/e-ews-item-change.h
index 780cda8..57fb39f 100644
--- a/src/server/e-ews-item-change.h
+++ b/src/server/e-ews-item-change.h
@@ -34,14 +34,14 @@ typedef enum {
E_EWS_ITEMCHANGE_TYPE_RECURRINGMASTER,
} EEwsItemChangeType;
-void e_ews_message_start_item_change(ESoapMessage *msg, EEwsItemChangeType type,
+void e_ews_message_start_item_change (ESoapMessage *msg, EEwsItemChangeType type,
const gchar *itemid, const gchar *changekey,
gint instance_index);
void e_ews_message_end_item_change (ESoapMessage *msg);
-void e_ews_message_start_set_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const char *field_kind);
+void e_ews_message_start_set_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const gchar *field_kind);
-void e_ews_message_start_set_indexed_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const char *field_kind, const char *field_index, gboolean delete_field);
+void e_ews_message_start_set_indexed_item_field (ESoapMessage *msg, const gchar *name, const gchar * fielduri_prefix, const gchar *field_kind, const gchar *field_index, gboolean delete_field);
void e_ews_message_end_set_indexed_item_field (ESoapMessage *msg, gboolean delete_field);
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 508e549..8fe1b28 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -37,15 +37,16 @@
#ifdef G_OS_WIN32
static gchar *
-g_mkdtemp (gchar *tmpl, int mode)
+g_mkdtemp (gchar *tmpl,
+ gint mode)
{
static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static const int NLETTERS = sizeof (letters) - 1;
- static int counter = 0;
- char *XXXXXX;
+ static const gint NLETTERS = sizeof (letters) - 1;
+ static gint counter = 0;
+ gchar *XXXXXX;
GTimeVal tv;
glong value;
- int count;
+ gint count;
/* find the last occurrence of "XXXXXX" */
XXXXXX = g_strrstr (tmpl, "XXXXXX");
@@ -100,7 +101,7 @@ G_DEFINE_TYPE (EEwsItem, e_ews_item, G_TYPE_OBJECT)
struct _EEwsContactFields {
gchar *fileas;
EwsCompleteName *complete_name;
-
+
GHashTable *email_addresses;
GHashTable *physical_addresses;
GHashTable *phone_numbers;
@@ -112,12 +113,12 @@ struct _EEwsContactFields {
gchar *assistant_name;
gchar *manager;
gchar *office_location;
-
+
gchar *business_homepage;
-
+
time_t birthday;
time_t wedding_anniversary;
-
+
gchar *profession;
gchar *spouse_name;
gchar *culture;
@@ -145,12 +146,12 @@ struct _EEwsItemPrivate {
/* MAPI properties */
/* The Exchange server is so fundamentally misdesigned that it doesn't expose
- certain information in a coherent way; the \Answered, and \Deleted message
- flags don't even seem to work properly. It looks like the only way to work
- it out is from the PidTagIconIndex field. Quite what the hell an *icon*
- selector is doing in the database, I have absolutely no fucking idea; a
- database is supposed to represent the *data*, not do bizarre things that
- live in the client. But that's typical Exchange brain damage for you... */
+ * certain information in a coherent way; the \Answered, and \Deleted message
+ * flags don't even seem to work properly. It looks like the only way to work
+ * it out is from the PidTagIconIndex field. Quite what the hell an *icon*
+ * selector is doing in the database, I have absolutely no fucking idea; a
+ * database is supposed to represent the *data*, not do bizarre things that
+ * live in the client. But that's typical Exchange brain damage for you... */
guint32 mapi_icon_index; /* http://msdn.microsoft.com/en-us/library/cc815472.aspx */
guint32 mapi_last_verb_executed; /* http://msdn.microsoft.com/en-us/library/cc841968.aspx */
guint32 mapi_message_status; /* http://msdn.microsoft.com/en-us/library/cc839915.aspx */
@@ -365,7 +366,7 @@ ews_free_contact_fields (struct _EEwsContactFields *con_fields)
if (con_fields) {
if (con_fields->complete_name) {
EwsCompleteName *cn = con_fields->complete_name;
-
+
g_free (cn->title);
g_free (cn->first_name);
g_free (cn->middle_name);
@@ -380,16 +381,16 @@ ews_free_contact_fields (struct _EEwsContactFields *con_fields)
if (con_fields->email_addresses)
g_hash_table_destroy (con_fields->email_addresses);
-
+
if (con_fields->physical_addresses)
g_hash_table_destroy (con_fields->physical_addresses);
-
+
if (con_fields->phone_numbers)
g_hash_table_destroy (con_fields->phone_numbers);
-
+
if (con_fields->im_addresses)
g_hash_table_destroy (con_fields->im_addresses);
-
+
g_free (con_fields->fileas);
g_free (con_fields->company_name);
g_free (con_fields->department);
@@ -403,7 +404,7 @@ ews_free_contact_fields (struct _EEwsContactFields *con_fields)
g_free (con_fields->culture);
g_free (con_fields->surname);
g_free (con_fields);
- }
+ }
}
static void
@@ -466,7 +467,9 @@ ews_item_parse_date (const gchar *dtstring)
return t;
}
-static void parse_extended_property (EEwsItemPrivate *priv, ESoapParameter *param)
+static void
+parse_extended_property (EEwsItemPrivate *priv,
+ ESoapParameter *param)
{
ESoapParameter *subparam;
gchar *str;
@@ -528,7 +531,9 @@ static void parse_extended_property (EEwsItemPrivate *priv, ESoapParameter *para
}
}
-static void parse_categories (EEwsItemPrivate *priv, ESoapParameter *param)
+static void
+parse_categories (EEwsItemPrivate *priv,
+ ESoapParameter *param)
{
gchar *value;
ESoapParameter *subparam;
@@ -541,12 +546,12 @@ static void parse_categories (EEwsItemPrivate *priv, ESoapParameter *param)
}
/* categories are an array of <string> */
- for (subparam = e_soap_parameter_get_first_child(param);
+ for (subparam = e_soap_parameter_get_first_child (param);
subparam != NULL;
- subparam = e_soap_parameter_get_next_child(subparam)) {
+ subparam = e_soap_parameter_get_next_child (subparam)) {
value = e_soap_parameter_get_string_value (subparam);
- priv->categories = g_slist_append(priv->categories, value);
+ priv->categories = g_slist_append (priv->categories, value);
}
}
@@ -568,22 +573,27 @@ parse_importance (ESoapParameter *param)
return importance;
}
-static void process_modified_occurrences(EEwsItemPrivate *priv, ESoapParameter *param) {
+static void
+process_modified_occurrences (EEwsItemPrivate *priv,
+ ESoapParameter *param)
+{
ESoapParameter *subparam, *subparam1;
gchar *modified_occurrence_id;
- for (subparam = e_soap_parameter_get_first_child(param); subparam != NULL; subparam = e_soap_parameter_get_next_child(subparam)) {
+ for (subparam = e_soap_parameter_get_first_child (param); subparam != NULL; subparam = e_soap_parameter_get_next_child (subparam)) {
subparam1 = e_soap_parameter_get_first_child_by_name(subparam, "ItemId");
modified_occurrence_id = e_soap_parameter_get_property(subparam1, "Id");
- priv->modified_occurrences = g_slist_append(priv->modified_occurrences, modified_occurrence_id);
+ priv->modified_occurrences = g_slist_append (priv->modified_occurrences, modified_occurrence_id);
}
return;
}
-static void process_attachments_list(EEwsItemPrivate *priv, ESoapParameter *param) {
-
+static void
+process_attachments_list (EEwsItemPrivate *priv,
+ ESoapParameter *param)
+{
ESoapParameter *subparam, *subparam1;
GSList *list = NULL;
@@ -599,17 +609,21 @@ static void process_attachments_list(EEwsItemPrivate *priv, ESoapParameter *para
return;
}
-static void process_attendees(EEwsItemPrivate *priv, ESoapParameter *param, const gchar *type) {
+static void
+process_attendees (EEwsItemPrivate *priv,
+ ESoapParameter *param,
+ const gchar *type)
+{
ESoapParameter *subparam, *subparam1;
EwsAttendee *attendee;
- for (subparam = e_soap_parameter_get_first_child(param); subparam != NULL; subparam = e_soap_parameter_get_next_child(subparam)) {
+ for (subparam = e_soap_parameter_get_first_child (param); subparam != NULL; subparam = e_soap_parameter_get_next_child (subparam)) {
EwsMailbox *mailbox = NULL;
subparam1 = e_soap_parameter_get_first_child_by_name (subparam, "Mailbox");
mailbox = e_ews_item_mailbox_from_soap_param (subparam1);
/* Ignore attendee if mailbox is not valid,
- for instance, ppl that does not exists any more */
+ * for instance, ppl that does not exists any more */
if (!mailbox)
continue;
@@ -620,7 +634,7 @@ static void process_attendees(EEwsItemPrivate *priv, ESoapParameter *param, cons
subparam1 = e_soap_parameter_get_first_child_by_name (subparam, "ResponseType");
attendee->responsetype = e_soap_parameter_get_string_value (subparam1);
- attendee->attendeetype = (gchar *)type;
+ attendee->attendeetype = (gchar *) type;
priv->attendees = g_slist_append (priv->attendees, attendee);
}
@@ -629,7 +643,8 @@ static void process_attendees(EEwsItemPrivate *priv, ESoapParameter *param, cons
}
static void
-parse_complete_name (struct _EEwsContactFields *con_fields, ESoapParameter *param)
+parse_complete_name (struct _EEwsContactFields *con_fields,
+ ESoapParameter *param)
{
ESoapParameter *subparam;
EwsCompleteName *cn;
@@ -637,34 +652,34 @@ parse_complete_name (struct _EEwsContactFields *con_fields, ESoapParameter *para
cn = g_new0 (EwsCompleteName, 1);
subparam = e_soap_parameter_get_first_child_by_name (param, "Title");
- if (subparam)
+ if (subparam)
cn->title = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "FirstName");
- if (subparam)
+ if (subparam)
cn->first_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "MiddleName");
- if (subparam)
+ if (subparam)
cn->middle_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "LastName");
- if (subparam)
+ if (subparam)
cn->last_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "Suffix");
- if (subparam)
+ if (subparam)
cn->suffix = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "Initials");
- if (subparam)
+ if (subparam)
cn->initials = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "FullName");
- if (subparam)
+ if (subparam)
cn->full_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "Nickname");
- if (subparam)
+ if (subparam)
cn->nick_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "YomiFirstName");
- if (subparam)
+ if (subparam)
cn->yomi_first_name = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "YomiLastName");
- if (subparam)
+ if (subparam)
cn->yomi_last_name = e_soap_parameter_get_string_value (subparam);
con_fields->complete_name = cn;
@@ -679,30 +694,32 @@ ews_get_physical_address (ESoapParameter *param)
address = g_new0 (EwsAddress, 1);
subparam = e_soap_parameter_get_first_child_by_name (param, "Street");
- if (subparam)
+ if (subparam)
address->street = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "City");
- if (subparam)
+ if (subparam)
address->city = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "State");
- if (subparam)
+ if (subparam)
address->state = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "Country");
- if (subparam)
+ if (subparam)
address->country = e_soap_parameter_get_string_value (subparam);
subparam = e_soap_parameter_get_first_child_by_name (param, "PostalCode");
- if (subparam)
+ if (subparam)
address->postal_code = e_soap_parameter_get_string_value (subparam);
return address;
}
static void
-parse_entries (GHashTable *hash_table, ESoapParameter *param, EwsGetValFunc get_val_func)
+parse_entries (GHashTable *hash_table,
+ ESoapParameter *param,
+ EwsGetValFunc get_val_func)
{
ESoapParameter *subparam;
@@ -711,10 +728,10 @@ parse_entries (GHashTable *hash_table, ESoapParameter *param, EwsGetValFunc get_
subparam = e_soap_parameter_get_next_child_by_name (subparam, "Entry")) {
gchar *key;
gpointer value;
-
+
key = e_soap_parameter_get_property (subparam, "Key");
value = get_val_func (subparam);
-
+
if (value)
g_hash_table_insert (hash_table, key, value);
else
@@ -738,11 +755,13 @@ ews_free_physical_address (gpointer value)
}
static void
-parse_contact_field (EEwsItem *item, const gchar *name, ESoapParameter *subparam)
+parse_contact_field (EEwsItem *item,
+ const gchar *name,
+ ESoapParameter *subparam)
{
EEwsItemPrivate *priv = item->priv;
gchar *value = NULL;
-
+
if (!g_ascii_strcasecmp (name, "Culture")) {
priv->contact_fields->culture = e_soap_parameter_get_string_value (subparam);
} else if (!g_ascii_strcasecmp (name, "FileAs")) {
@@ -813,7 +832,9 @@ strip_html_tags (const gchar *html_text)
}
static void
-parse_task_field (EEwsItem *item, const gchar *name, ESoapParameter *subparam)
+parse_task_field (EEwsItem *item,
+ const gchar *name,
+ ESoapParameter *subparam)
{
EEwsItemPrivate *priv = item->priv;
gchar *value = NULL;
@@ -859,10 +880,11 @@ parse_task_field (EEwsItem *item, const gchar *name, ESoapParameter *subparam)
}
static gboolean
-e_ews_item_set_from_soap_parameter (EEwsItem *item, ESoapParameter *param)
+e_ews_item_set_from_soap_parameter (EEwsItem *item,
+ ESoapParameter *param)
{
EEwsItemPrivate *priv = item->priv;
- ESoapParameter *subparam, *node=NULL;
+ ESoapParameter *subparam, *node = NULL;
gboolean contact = FALSE, task = FALSE;
const gchar *name;
@@ -873,18 +895,18 @@ e_ews_item_set_from_soap_parameter (EEwsItem *item, ESoapParameter *param)
/*We get two types of response for items from server like below from two apis
* Syncfolderitems and Finditem
* <m:Changes> <t:Items>
- <t:Create> <t:Contact>
- <t:Contact> <t:ItemId Id="AS4AUn=" ChangeKey="fsVU4==" />
- <t:ItemId Id="AAA=" ChangeKey="NAgws"/> </t:Contact>
- </t:Contact> <t:Contact>
- </t:Create> <t:ItemId Id="AS4BS=" ChangeKey="fjidU4==" />
- <t:Contact> </t:Contact>
- <t:ItemId Id="ABB=" ChangeKey="GCDab"/> ...
- </t:Contact> </t:Items>
- </t:Create>
- ...
- </m:Changes>
- So check param is the node we want to use, by comparing name or is it child of the param */
+ * <t:Create> <t:Contact>
+ * <t:Contact> <t:ItemId Id="AS4AUn=" ChangeKey="fsVU4==" />
+ * <t:ItemId Id="AAA=" ChangeKey="NAgws"/> </t:Contact>
+ * </t:Contact> <t:Contact>
+ * </t:Create> <t:ItemId Id="AS4BS=" ChangeKey="fjidU4==" />
+ * <t:Contact> </t:Contact>
+ * <t:ItemId Id="ABB=" ChangeKey="GCDab"/> ...
+ * </t:Contact> </t:Items>
+ * </t:Create>
+ * ...
+ * </m:Changes>
+ * So check param is the node we want to use, by comparing name or is it child of the param */
if (!g_ascii_strcasecmp (name, "Message") || (node = e_soap_parameter_get_first_child_by_name (param, "Message")))
priv->item_type = E_EWS_ITEM_TYPE_MESSAGE;
@@ -893,7 +915,7 @@ e_ews_item_set_from_soap_parameter (EEwsItem *item, ESoapParameter *param)
else if (!g_ascii_strcasecmp (name, "CalendarItem") || (node = e_soap_parameter_get_first_child_by_name (param, "CalendarItem")))
priv->item_type = E_EWS_ITEM_TYPE_CALENDAR_ITEM;
else if (!g_ascii_strcasecmp (name, "Contact") || (node = e_soap_parameter_get_first_child_by_name (param, "Contact"))) {
- contact = TRUE;
+ contact = TRUE;
priv->item_type = E_EWS_ITEM_TYPE_CONTACT;
priv->contact_fields = g_new0 (struct _EEwsContactFields, 1);
} else if (!g_ascii_strcasecmp (name, "DistributionList") || (node = e_soap_parameter_get_first_child_by_name (param, "DistributionList")))
@@ -988,7 +1010,7 @@ e_ews_item_set_from_soap_parameter (EEwsItem *item, ESoapParameter *param)
priv->has_attachments = (!g_ascii_strcasecmp (value, "true"));
g_free (value);
} else if (!g_ascii_strcasecmp (name, "Attachments")) {
- process_attachments_list(priv, subparam);
+ process_attachments_list (priv, subparam);
} else if (contact)
parse_contact_field (item, name, subparam);
/* fields below are not relevant for contacts, so skip them */
@@ -1043,7 +1065,7 @@ e_ews_item_set_from_soap_parameter (EEwsItem *item, ESoapParameter *param)
} else if (!g_ascii_strcasecmp (name, "ExtendedProperty")) {
parse_extended_property (priv, subparam);
} else if (!g_ascii_strcasecmp (name, "ModifiedOccurrences")) {
- process_modified_occurrences(priv, subparam);
+ process_modified_occurrences (priv, subparam);
} else if (!g_ascii_strcasecmp (name, "RequiredAttendees")) {
process_attendees (priv, subparam, "Required");
} else if (!g_ascii_strcasecmp (name, "OptionalAttendees")) {
@@ -1085,7 +1107,8 @@ e_ews_item_get_item_type (EEwsItem *item)
}
void
-e_ews_item_set_item_type (EEwsItem *item, EEwsItemType new_type)
+e_ews_item_set_item_type (EEwsItem *item,
+ EEwsItemType new_type)
{
g_return_if_fail (E_IS_EWS_ITEM (item));
@@ -1101,7 +1124,8 @@ e_ews_item_get_subject (EEwsItem *item)
}
void
-e_ews_item_set_subject (EEwsItem *item, const gchar *new_subject)
+e_ews_item_set_subject (EEwsItem *item,
+ const gchar *new_subject)
{
g_return_if_fail (E_IS_EWS_ITEM (item));
@@ -1119,7 +1143,8 @@ e_ews_item_get_mime_content (EEwsItem *item)
}
void
-e_ews_item_set_mime_content (EEwsItem *item, const gchar *new_mime_content)
+e_ews_item_set_mime_content (EEwsItem *item,
+ const gchar *new_mime_content)
{
g_return_if_fail (E_IS_EWS_ITEM (item));
@@ -1129,7 +1154,7 @@ e_ews_item_set_mime_content (EEwsItem *item, const gchar *new_mime_content)
}
const EwsId *
-e_ews_item_get_id (EEwsItem *item)
+e_ews_item_get_id (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1137,7 +1162,7 @@ e_ews_item_get_id (EEwsItem *item)
}
const EwsId *
-e_ews_item_get_attachment_id (EEwsItem *item)
+e_ews_item_get_attachment_id (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1145,7 +1170,7 @@ e_ews_item_get_attachment_id (EEwsItem *item)
}
gsize
-e_ews_item_get_size (EEwsItem *item)
+e_ews_item_get_size (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
@@ -1153,7 +1178,7 @@ e_ews_item_get_size (EEwsItem *item)
}
const gchar *
-e_ews_item_get_msg_id (EEwsItem *item)
+e_ews_item_get_msg_id (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1161,7 +1186,7 @@ e_ews_item_get_msg_id (EEwsItem *item)
}
const gchar *
-e_ews_item_get_uid (EEwsItem *item)
+e_ews_item_get_uid (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1184,7 +1209,7 @@ e_ews_item_get_references (EEwsItem *item)
}
time_t
-e_ews_item_get_date_received (EEwsItem *item)
+e_ews_item_get_date_received (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
@@ -1192,7 +1217,7 @@ e_ews_item_get_date_received (EEwsItem *item)
}
time_t
-e_ews_item_get_date_sent (EEwsItem *item)
+e_ews_item_get_date_sent (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
@@ -1200,7 +1225,7 @@ e_ews_item_get_date_sent (EEwsItem *item)
}
time_t
-e_ews_item_get_date_created (EEwsItem *item)
+e_ews_item_get_date_created (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
@@ -1208,7 +1233,8 @@ e_ews_item_get_date_created (EEwsItem *item)
}
gboolean
-e_ews_item_has_attachments (EEwsItem *item, gboolean *has_attachments)
+e_ews_item_has_attachments (EEwsItem *item,
+ gboolean *has_attachments)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
@@ -1218,7 +1244,8 @@ e_ews_item_has_attachments (EEwsItem *item, gboolean *has_attachments)
}
gboolean
-e_ews_item_is_read (EEwsItem *item, gboolean *read)
+e_ews_item_is_read (EEwsItem *item,
+ gboolean *read)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
@@ -1228,7 +1255,8 @@ e_ews_item_is_read (EEwsItem *item, gboolean *read)
}
gboolean
-e_ews_item_is_forwarded (EEwsItem *item, gboolean *forwarded)
+e_ews_item_is_forwarded (EEwsItem *item,
+ gboolean *forwarded)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
@@ -1238,7 +1266,8 @@ e_ews_item_is_forwarded (EEwsItem *item, gboolean *forwarded)
}
gboolean
-e_ews_item_is_answered (EEwsItem *item, gboolean *answered)
+e_ews_item_is_answered (EEwsItem *item,
+ gboolean *answered)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
@@ -1247,9 +1276,8 @@ e_ews_item_is_answered (EEwsItem *item, gboolean *answered)
return TRUE;
}
-
const GSList *
-e_ews_item_get_to_recipients (EEwsItem *item)
+e_ews_item_get_to_recipients (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1257,7 +1285,7 @@ e_ews_item_get_to_recipients (EEwsItem *item)
}
const GSList *
-e_ews_item_get_cc_recipients (EEwsItem *item)
+e_ews_item_get_cc_recipients (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1265,7 +1293,7 @@ e_ews_item_get_cc_recipients (EEwsItem *item)
}
const GSList *
-e_ews_item_get_bcc_recipients (EEwsItem *item)
+e_ews_item_get_bcc_recipients (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1273,7 +1301,7 @@ e_ews_item_get_bcc_recipients (EEwsItem *item)
}
const EwsMailbox *
-e_ews_item_get_sender (EEwsItem *item)
+e_ews_item_get_sender (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1281,7 +1309,7 @@ e_ews_item_get_sender (EEwsItem *item)
}
const EwsMailbox *
-e_ews_item_get_from (EEwsItem *item)
+e_ews_item_get_from (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1289,7 +1317,7 @@ e_ews_item_get_from (EEwsItem *item)
}
const GSList *
-e_ews_item_get_categories (EEwsItem *item)
+e_ews_item_get_categories (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
@@ -1297,7 +1325,7 @@ e_ews_item_get_categories (EEwsItem *item)
}
EwsImportance
-e_ews_item_get_importance (EEwsItem *item)
+e_ews_item_get_importance (EEwsItem *item)
{
g_return_val_if_fail (E_IS_EWS_ITEM (item), EWS_ITEM_LOW);
@@ -1311,7 +1339,7 @@ e_ews_item_mailbox_from_soap_param (ESoapParameter *param)
ESoapParameter *subparam;
/* Return NULL if RoutingType of Mailbox is not SMTP
- For instance, people who don't exist any more */
+ * For instance, people who don't exist any more */
subparam = e_soap_parameter_get_first_child_by_name (param, "RoutingType");
if (subparam) {
gchar *routingtype;
@@ -1337,23 +1365,24 @@ e_ews_item_mailbox_from_soap_param (ESoapParameter *param)
}
const GSList *
-e_ews_item_get_modified_occurrences(EEwsItem *item)
+e_ews_item_get_modified_occurrences (EEwsItem *item)
{
- g_return_val_if_fail(E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
return item->priv->modified_occurrences;
}
GSList *
-e_ews_item_get_attachments_ids(EEwsItem *item)
+e_ews_item_get_attachments_ids (EEwsItem *item)
{
- g_return_val_if_fail(E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
return item->priv->attachments_list;
}
gchar *
-e_ews_embed_attachment_id_in_uri (const gchar *olduri, const char *attach_id)
+e_ews_embed_attachment_id_in_uri (const gchar *olduri,
+ const gchar *attach_id)
{
gchar *tmpdir, *tmpfilename, filename[350], dirname[350], *name;
@@ -1372,13 +1401,16 @@ e_ews_embed_attachment_id_in_uri (const gchar *olduri, const char *attach_id)
g_warning("Failed to move attachment cache file [%s -> %s]: %s\n", tmpfilename, filename, strerror (errno));
}
- g_free(tmpdir);
+ g_free (tmpdir);
- return g_filename_to_uri(filename, NULL, NULL);
+ return g_filename_to_uri (filename, NULL, NULL);
}
gchar *
-e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gchar *cache, const gchar *comp_uid, gchar **attach_id)
+e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param,
+ const gchar *cache,
+ const gchar *comp_uid,
+ gchar **attach_id)
{
ESoapParameter *subparam;
const gchar *param_name;
@@ -1391,11 +1423,11 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gch
/* Parse element, look for filename and content */
*attach_id = NULL;
- for (subparam = e_soap_parameter_get_first_child(param); subparam != NULL; subparam = e_soap_parameter_get_next_child(subparam)) {
- param_name = e_soap_parameter_get_name(subparam);
+ for (subparam = e_soap_parameter_get_first_child (param); subparam != NULL; subparam = e_soap_parameter_get_next_child (subparam)) {
+ param_name = e_soap_parameter_get_name (subparam);
if (g_ascii_strcasecmp(param_name, "Name") == 0) {
- value = e_soap_parameter_get_string_value(subparam);
+ value = e_soap_parameter_get_string_value (subparam);
name = g_uri_escape_string(value, "", TRUE);
g_free (value);
} else if (g_ascii_strcasecmp(param_name, "Content") == 0) {
@@ -1409,9 +1441,9 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gch
/* Make sure we have needed data */
if (!content || !name || !*attach_id) {
- g_free(name);
- g_free(content);
- g_free(*attach_id);
+ g_free (name);
+ g_free (content);
+ g_free (*attach_id);
return NULL;
}
@@ -1429,18 +1461,20 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gch
}
g_free (dirname);
- g_free(tmpdir);
- g_free(name);
- g_free(content);
+ g_free (tmpdir);
+ g_free (name);
+ g_free (content);
/* Return URI to saved file */
- name = g_filename_to_uri(filename, NULL, NULL);
+ name = g_filename_to_uri (filename, NULL, NULL);
g_free (filename);
return name;
}
gchar *
-e_ews_item_dump_mime_content(EEwsItem *item, const gchar *cache) {
+e_ews_item_dump_mime_content (EEwsItem *item,
+ const gchar *cache)
+{
gchar *filename, *surename, *dirname;
gchar *tmpdir, *tmpfilename;
@@ -1450,30 +1484,30 @@ e_ews_item_dump_mime_content(EEwsItem *item, const gchar *cache) {
tmpdir = g_strndup(tmpfilename, g_strrstr (tmpfilename, "/") - tmpfilename);
dirname = g_build_filename (tmpdir, "XXXXXX", NULL);
- if (!mkdtemp(dirname))
+ if (!mkdtemp (dirname))
g_warning ("Failed to create directory for attachment cache");
surename = g_uri_escape_string(item->priv->subject, "", TRUE);
filename = g_build_filename (dirname, surename, NULL);
- if (g_rename ((const gchar *)item->priv->mime_content, filename) != 0) {
+ if (g_rename ((const gchar *) item->priv->mime_content, filename) != 0) {
g_warning("Failed to move attachment cache file");
}
g_free (filename);
g_free (dirname);
- g_free(tmpdir);
- g_free(tmpfilename);
- g_free(surename);
+ g_free (tmpdir);
+ g_free (tmpfilename);
+ g_free (surename);
/* Return URI to saved file */
- return g_filename_to_uri(filename, NULL, NULL);
+ return g_filename_to_uri (filename, NULL, NULL);
}
const GSList *
e_ews_item_get_attendees (EEwsItem *item)
{
- g_return_val_if_fail(E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
return item->priv->attendees;
}
@@ -1481,24 +1515,24 @@ e_ews_item_get_attendees (EEwsItem *item)
const EwsId *
e_ews_item_get_calendar_item_accept_id (EEwsItem *item)
{
- g_return_val_if_fail(E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
- return (const EwsId*) item->priv->calendar_item_accept_id;
+ return (const EwsId *) item->priv->calendar_item_accept_id;
}
const gchar *
e_ews_item_get_fileas (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->fileas;
+ return (const gchar *) item->priv->contact_fields->fileas;
}
const EwsCompleteName *
e_ews_item_get_complete_name (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
return (const EwsCompleteName *) item->priv->contact_fields->complete_name;
@@ -1513,11 +1547,12 @@ e_ews_item_get_complete_name (EEwsItem *item)
* Returns:
**/
const gchar *
-e_ews_item_get_email_address (EEwsItem *item, const gchar *field)
+e_ews_item_get_email_address (EEwsItem *item,
+ const gchar *field)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
-
+
if (item->priv->contact_fields->email_addresses)
return g_hash_table_lookup (item->priv->contact_fields->email_addresses, field);
@@ -1533,11 +1568,12 @@ e_ews_item_get_email_address (EEwsItem *item, const gchar *field)
* Returns:
**/
const EwsAddress *
-e_ews_item_get_physical_address (EEwsItem *item, const gchar *field)
+e_ews_item_get_physical_address (EEwsItem *item,
+ const gchar *field)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
-
+
if (item->priv->contact_fields->physical_addresses)
return g_hash_table_lookup (item->priv->contact_fields->physical_addresses, field);
@@ -1555,11 +1591,12 @@ e_ews_item_get_physical_address (EEwsItem *item, const gchar *field)
* Returns:
**/
const gchar *
-e_ews_item_get_phone_number (EEwsItem *item, const gchar *field)
+e_ews_item_get_phone_number (EEwsItem *item,
+ const gchar *field)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
-
+
if (item->priv->contact_fields->phone_numbers)
return g_hash_table_lookup (item->priv->contact_fields->phone_numbers, field);
@@ -1575,11 +1612,12 @@ e_ews_item_get_phone_number (EEwsItem *item, const gchar *field)
* Returns:
**/
const gchar *
-e_ews_item_get_im_address (EEwsItem *item, const gchar *field)
+e_ews_item_get_im_address (EEwsItem *item,
+ const gchar *field)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
-
+
if (item->priv->contact_fields->im_addresses)
return g_hash_table_lookup (item->priv->contact_fields->im_addresses, field);
@@ -1589,97 +1627,97 @@ e_ews_item_get_im_address (EEwsItem *item, const gchar *field)
const gchar *
e_ews_item_get_company_name (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->company_name;
+ return (const gchar *) item->priv->contact_fields->company_name;
}
const gchar *
e_ews_item_get_department (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->department;
+ return (const gchar *) item->priv->contact_fields->department;
}
const gchar *
e_ews_item_get_job_title (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->job_title;
+ return (const gchar *) item->priv->contact_fields->job_title;
}
const gchar *
e_ews_item_get_assistant_name (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->assistant_name;
+ return (const gchar *) item->priv->contact_fields->assistant_name;
}
const gchar *
e_ews_item_get_manager (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->manager;
+ return (const gchar *) item->priv->contact_fields->manager;
}
const gchar *
e_ews_item_get_office_location (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->office_location;
+ return (const gchar *) item->priv->contact_fields->office_location;
}
const gchar *
e_ews_item_get_business_homepage (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->business_homepage;
+ return (const gchar *) item->priv->contact_fields->business_homepage;
}
const gchar *
e_ews_item_get_profession (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->profession;
+ return (const gchar *) item->priv->contact_fields->profession;
}
const gchar *
e_ews_item_get_spouse_name (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->spouse_name;
+ return (const gchar *) item->priv->contact_fields->spouse_name;
}
const gchar *
e_ews_item_get_surname (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
- return (const gchar*) item->priv->contact_fields->surname;
+ return (const gchar *) item->priv->contact_fields->surname;
}
-
+
time_t
e_ews_item_get_birthday (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), -1);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
g_return_val_if_fail (item->priv->contact_fields != NULL, -1);
return item->priv->contact_fields->birthday;
@@ -1688,7 +1726,7 @@ e_ews_item_get_birthday (EEwsItem *item)
time_t
e_ews_item_get_wedding_anniversary (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), -1);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
g_return_val_if_fail (item->priv->contact_fields != NULL, -1);
return item->priv->contact_fields->wedding_anniversary;
@@ -1697,7 +1735,7 @@ e_ews_item_get_wedding_anniversary (EEwsItem *item)
const gchar *
e_ews_item_get_status (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->status;
@@ -1705,7 +1743,7 @@ e_ews_item_get_status (EEwsItem *item)
const gchar * e_ews_item_get_percent_complete (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->percent_complete;
@@ -1714,7 +1752,7 @@ const gchar * e_ews_item_get_percent_complete (EEwsItem *item)
time_t
e_ews_item_get_due_date (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), -1);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
g_return_val_if_fail (item->priv->task_fields != NULL, -1);
return item->priv->task_fields->due_date;
@@ -1723,7 +1761,7 @@ e_ews_item_get_due_date (EEwsItem *item)
time_t
e_ews_item_get_start_date (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), -1);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
g_return_val_if_fail (item->priv->task_fields != NULL, -1);
return item->priv->task_fields->start_date;
@@ -1732,7 +1770,7 @@ e_ews_item_get_start_date (EEwsItem *item)
time_t
e_ews_item_get_complete_date (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), -1);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), -1);
g_return_val_if_fail (item->priv->task_fields != NULL, -1);
return item->priv->task_fields->complete_date;
@@ -1741,7 +1779,7 @@ e_ews_item_get_complete_date (EEwsItem *item)
const gchar *
e_ews_item_get_sensitivity (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->sensitivity;
@@ -1750,7 +1788,7 @@ e_ews_item_get_sensitivity (EEwsItem *item)
const gchar *
e_ews_item_get_body (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->body;
@@ -1759,7 +1797,7 @@ e_ews_item_get_body (EEwsItem *item)
const gchar *
e_ews_item_get_owner (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->owner;
@@ -1768,16 +1806,17 @@ e_ews_item_get_owner (EEwsItem *item)
const gchar *
e_ews_item_get_delegator (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->task_fields != NULL, NULL);
return item->priv->task_fields->delegator;
}
gboolean
-e_ews_item_task_has_start_date (EEwsItem *item, gboolean *has_date)
+e_ews_item_task_has_start_date (EEwsItem *item,
+ gboolean *has_date)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), FALSE);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
g_return_val_if_fail (item->priv->task_fields != NULL, FALSE);
*has_date = item->priv->task_fields->has_start_date;
@@ -1786,9 +1825,10 @@ e_ews_item_task_has_start_date (EEwsItem *item, gboolean *has_date)
}
gboolean
-e_ews_item_task_has_due_date (EEwsItem *item, gboolean *has_date)
+e_ews_item_task_has_due_date (EEwsItem *item,
+ gboolean *has_date)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), FALSE);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
g_return_val_if_fail (item->priv->task_fields != NULL, FALSE);
*has_date = item->priv->task_fields->has_due_date;
@@ -1797,9 +1837,10 @@ e_ews_item_task_has_due_date (EEwsItem *item, gboolean *has_date)
}
gboolean
-e_ews_item_task_has_complete_date (EEwsItem *item, gboolean *has_date)
+e_ews_item_task_has_complete_date (EEwsItem *item,
+ gboolean *has_date)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), FALSE);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), FALSE);
g_return_val_if_fail (item->priv->task_fields != NULL, FALSE);
*has_date = item->priv->task_fields->has_complete_date;
@@ -1810,7 +1851,7 @@ e_ews_item_task_has_complete_date (EEwsItem *item, gboolean *has_date)
const gchar *
e_ews_item_get_tzid (EEwsItem *item)
{
- g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+ g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
g_return_val_if_fail (item->priv->timezone != NULL, NULL);
return item->priv->timezone;
diff --git a/src/server/e-ews-item.h b/src/server/e-ews-item.h
index 9d4bc64..054aa3b 100644
--- a/src/server/e-ews-item.h
+++ b/src/server/e-ews-item.h
@@ -111,11 +111,11 @@ typedef struct {
gchar *postal_code;
} EwsAddress;
-GType e_ews_item_get_type (void);
+GType e_ews_item_get_type (void);
EEwsItem * e_ews_item_new_from_soap_parameter
(ESoapParameter *param);
-EEwsItemType e_ews_item_get_item_type (EEwsItem *item);
+EEwsItemType e_ews_item_get_item_type (EEwsItem *item);
void e_ews_item_set_item_type (EEwsItem *item,
EEwsItemType new_type);
const gchar * e_ews_item_get_subject (EEwsItem *item);
@@ -125,7 +125,7 @@ const gchar * e_ews_item_get_mime_content (EEwsItem *item);
void e_ews_item_set_mime_content (EEwsItem *item,
const gchar *new_mime_content);
const EwsId * e_ews_item_get_id (EEwsItem *item);
-const EwsId * e_ews_item_get_attachment_id (EEwsItem *item);
+const EwsId * e_ews_item_get_attachment_id (EEwsItem *item);
gsize e_ews_item_get_size (EEwsItem *item);
const gchar * e_ews_item_get_msg_id (EEwsItem *item);
const gchar * e_ews_item_get_uid (EEwsItem *item);
@@ -162,17 +162,17 @@ void e_ews_free_resolve_contact (/*EwsResolveContact * */ gpointer rc);
const GSList * e_ews_item_get_modified_occurrences
(EEwsItem *item);
-gchar * e_ews_embed_attachment_id_in_uri (const gchar *olduri, const char *attach_id);
+gchar * e_ews_embed_attachment_id_in_uri (const gchar *olduri, const gchar *attach_id);
GSList * e_ews_item_get_attachments_ids
(EEwsItem *item);
gchar *
e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gchar *cache, const gchar *comp_uid, gchar **attach_id);
gchar *
-e_ews_item_ical_dump(EEwsItem *item);
+e_ews_item_ical_dump (EEwsItem *item);
gchar *
-e_ews_item_dump_mime_content(EEwsItem *item, const gchar *cache);
+e_ews_item_dump_mime_content (EEwsItem *item, const gchar *cache);
const GSList * e_ews_item_get_attendees (EEwsItem *item);
@@ -181,10 +181,10 @@ const EwsId * e_ews_item_get_calendar_item_accept_id
/* Contact fields */
const gchar * e_ews_item_get_fileas (EEwsItem *item);
-const EwsCompleteName *
+const EwsCompleteName *
e_ews_item_get_complete_name (EEwsItem *item);
const gchar * e_ews_item_get_email_address (EEwsItem *item, const gchar *type);
-const EwsAddress *
+const EwsAddress *
e_ews_item_get_physical_address (EEwsItem *item, const gchar *type);
const gchar * e_ews_item_get_phone_number (EEwsItem *item, const gchar *type);
const gchar * e_ews_item_get_im_address (EEwsItem *item, const gchar *type);
@@ -220,8 +220,8 @@ gboolean e_ews_item_task_has_start_date (EEwsItem *item,
gboolean e_ews_item_task_has_due_date (EEwsItem *item,
gboolean *has_date);
gboolean e_ews_item_task_has_complete_date
- (EEwsItem* item,
- gboolean* has_date);
+ (EEwsItem * item,
+ gboolean * has_date);
const gchar * e_ews_item_get_tzid (EEwsItem *item);
G_END_DECLS
diff --git a/src/server/e-ews-message.c b/src/server/e-ews-message.c
index 4d12e09..1c7e954 100644
--- a/src/server/e-ews-message.c
+++ b/src/server/e-ews-message.c
@@ -28,10 +28,10 @@
ESoapMessage *
e_ews_message_new_with_header (const gchar *uri,
- const gchar *method_name,
- const gchar *attribute_name,
- const gchar *attribute_value,
- EwsServerVersion server_info)
+ const gchar *method_name,
+ const gchar *attribute_name,
+ const gchar *attribute_value,
+ EwsServerVersion server_info)
{
ESoapMessage *msg;
const gchar *server_ver;
@@ -64,11 +64,11 @@ e_ews_message_new_with_header (const gchar *uri,
e_soap_message_end_header (msg);
- e_soap_message_start_body(msg);
+ e_soap_message_start_body (msg);
e_soap_message_add_namespace(msg, "messages",
"http://schemas.microsoft.com/exchange/services/2006/messages");
e_soap_message_start_element(msg, method_name, "messages", NULL);
- e_soap_message_set_default_namespace(msg,
+ e_soap_message_set_default_namespace (msg,
"http://schemas.microsoft.com/exchange/services/2006/types");
if (attribute_name)
e_soap_message_add_attribute (msg, attribute_name, attribute_value, NULL, NULL);
@@ -76,7 +76,10 @@ e_ews_message_new_with_header (const gchar *uri,
}
void
-e_ews_message_write_string_parameter (ESoapMessage *msg, const gchar *name, const gchar *prefix, const gchar *value)
+e_ews_message_write_string_parameter (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *prefix,
+ const gchar *value)
{
e_soap_message_start_element (msg, name, prefix, NULL);
e_soap_message_write_string (msg, value);
@@ -85,11 +88,11 @@ e_ews_message_write_string_parameter (ESoapMessage *msg, const gchar *name, cons
void
e_ews_message_write_string_parameter_with_attribute (ESoapMessage *msg,
- const gchar *name,
- const gchar *prefix,
- const gchar *value,
- const gchar *attribute_name,
- const gchar *attribute_value)
+ const gchar *name,
+ const gchar *prefix,
+ const gchar *value,
+ const gchar *attribute_name,
+ const gchar *attribute_value)
{
e_soap_message_start_element (msg, name, prefix, NULL);
e_soap_message_add_attribute (msg, attribute_name, attribute_value, NULL, NULL);
@@ -98,7 +101,10 @@ e_ews_message_write_string_parameter_with_attribute (ESoapMessage *msg,
}
void
-e_ews_message_write_base64_parameter (ESoapMessage *msg, const gchar *name, const gchar *prefix, const gchar *value)
+e_ews_message_write_base64_parameter (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *prefix,
+ const gchar *value)
{
e_soap_message_start_element (msg, name, prefix, NULL);
e_soap_message_write_base64 (msg, value, strlen (value));
@@ -106,7 +112,10 @@ e_ews_message_write_base64_parameter (ESoapMessage *msg, const gchar *name, cons
}
void
-e_ews_message_write_int_parameter (ESoapMessage *msg, const gchar *name, const gchar *prefix, glong value)
+e_ews_message_write_int_parameter (ESoapMessage *msg,
+ const gchar *name,
+ const gchar *prefix,
+ glong value)
{
e_soap_message_start_element (msg, name, prefix, NULL);
e_soap_message_write_int (msg, value);
diff --git a/src/server/e-ews-message.h b/src/server/e-ews-message.h
index 49b0d0c..a5067de 100644
--- a/src/server/e-ews-message.h
+++ b/src/server/e-ews-message.h
@@ -53,7 +53,7 @@ void e_ews_message_write_base64_parameter
const gchar *name,
const gchar *prefix,
const gchar *value);
-void e_ews_message_write_int_parameter
+void e_ews_message_write_int_parameter
(ESoapMessage *msg,
const gchar *name,
const gchar *prefix,
diff --git a/src/server/e-soap-message.c b/src/server/e-soap-message.c
index 107b170..d293d4c 100644
--- a/src/server/e-soap-message.c
+++ b/src/server/e-soap-message.c
@@ -34,7 +34,7 @@ typedef struct {
gint steal_b64_state;
guint steal_b64_save;
- int steal_fd;
+ gint steal_fd;
/* Progress callbacks */
gsize response_size;
@@ -60,9 +60,9 @@ finalize (GObject *object)
if (priv->action)
g_free (priv->action);
if (priv->env_uri)
- xmlFree (priv->env_uri);
+ xmlFree (priv->env_uri);
if (priv->env_prefix)
- xmlFree (priv->env_prefix);
+ xmlFree (priv->env_prefix);
g_free (priv->steal_node);
g_free (priv->steal_dir);
@@ -94,35 +94,41 @@ e_soap_message_init (ESoapMessage *msg)
}
static xmlNsPtr
-fetch_ns (ESoapMessage *msg, const gchar *prefix, const gchar *ns_uri)
+fetch_ns (ESoapMessage *msg,
+ const gchar *prefix,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- xmlNsPtr ns = NULL;
+ xmlNsPtr ns = NULL;
- if (prefix && ns_uri)
- 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);
- if (!ns)
+ if (prefix && ns_uri)
+ 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);
+ if (!ns)
ns = xmlNewNs (priv->last_node, (const xmlChar *)"", (const xmlChar *)prefix);
- }
+ }
- return ns;
+ return ns;
}
-static void soap_got_headers (SoupMessage *msg, gpointer data)
+static void
+soap_got_headers (SoupMessage *msg,
+ gpointer data)
{
ESoapMessagePrivate *priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- const char *size;
+ const gchar *size;
size = soup_message_headers_get_one (msg->response_headers,
"Content-Length");
if (size)
- priv->response_size = strtol(size, NULL, 10);
+ priv->response_size = strtol (size, NULL, 10);
}
-static void soap_restarted (SoupMessage *msg, gpointer data)
+static void
+soap_restarted (SoupMessage *msg,
+ gpointer data)
{
ESoapMessagePrivate *priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
@@ -138,15 +144,16 @@ static void soap_restarted (SoupMessage *msg, gpointer data)
}
}
-static void soap_sax_startElementNs (void * _ctxt,
- const xmlChar *localname,
- const xmlChar *prefix,
- const xmlChar *uri,
- int nb_namespaces,
- const xmlChar **namespaces,
- int nb_attributes,
- int nb_defaulted,
- const xmlChar **attributes)
+static void
+soap_sax_startElementNs (gpointer _ctxt,
+ const xmlChar *localname,
+ const xmlChar *prefix,
+ const xmlChar *uri,
+ gint nb_namespaces,
+ const xmlChar **namespaces,
+ gint nb_attributes,
+ gint nb_defaulted,
+ const xmlChar **attributes)
{
xmlParserCtxt *ctxt = _ctxt;
ESoapMessagePrivate *priv = ctxt->_private;
@@ -163,7 +170,7 @@ static void soap_sax_startElementNs (void * _ctxt,
gboolean isnode = FALSE;
while (prop[i]) {
- if (strcmp ((const char *)localname, prop [i]) == 0) {
+ if (strcmp ((const gchar *) localname, prop[i]) == 0) {
isnode = TRUE;
break;
}
@@ -179,19 +186,20 @@ static void soap_sax_startElementNs (void * _ctxt,
priv->steal_fd = g_mkstemp (fname);
if (priv->steal_fd != -1) {
if (priv->steal_base64) {
- gchar *enc = g_base64_encode ((guchar *)fname, strlen(fname));
- xmlSAX2Characters (ctxt, (xmlChar *)enc, strlen (enc));
+ gchar *enc = g_base64_encode ((guchar *) fname, strlen (fname));
+ xmlSAX2Characters (ctxt, (xmlChar *) enc, strlen (enc));
g_free (enc);
} else
- xmlSAX2Characters (ctxt, (xmlChar *)fname, strlen (fname));
+ xmlSAX2Characters (ctxt, (xmlChar *) fname, strlen (fname));
}
g_free (fname);
}
-static void soap_sax_endElementNs (void *_ctxt,
- const xmlChar *localname,
- const xmlChar *prefix,
- const xmlChar *uri)
+static void
+soap_sax_endElementNs (gpointer _ctxt,
+ const xmlChar *localname,
+ const xmlChar *prefix,
+ const xmlChar *uri)
{
xmlParserCtxt *ctxt = _ctxt;
ESoapMessagePrivate *priv = ctxt->_private;
@@ -207,7 +215,10 @@ static void soap_sax_endElementNs (void *_ctxt,
xmlSAX2EndElementNs (ctxt, localname, prefix, uri);
}
-static void soap_sax_characters (void *_ctxt, const xmlChar *ch, int len)
+static void
+soap_sax_characters (gpointer _ctxt,
+ const xmlChar *ch,
+ gint len)
{
xmlParserCtxt *ctxt = _ctxt;
ESoapMessagePrivate *priv = ctxt->_private;
@@ -215,7 +226,7 @@ static void soap_sax_characters (void *_ctxt, const xmlChar *ch, int len)
if (priv->steal_fd == -1)
xmlSAX2Characters (ctxt, ch, len);
else if (!priv->steal_base64) {
- if (write (priv->steal_fd, (const gchar*)ch, len) != len) {
+ if (write (priv->steal_fd, (const gchar *) ch, len) != len) {
write_err:
/* Handle error better */
g_warning ("Failed to write streaming data to file");
@@ -224,17 +235,21 @@ static void soap_sax_characters (void *_ctxt, const xmlChar *ch, int len)
guchar *bdata = g_malloc (len);
gsize blen;
- blen = g_base64_decode_step ((const gchar *)ch, len,
+ blen = g_base64_decode_step ((const gchar *) ch, len,
bdata, &priv->steal_b64_state,
&priv->steal_b64_save);
- if (write (priv->steal_fd, (const gchar*)bdata, blen) != blen) {
+ if (write (priv->steal_fd, (const gchar *) bdata, blen) != blen) {
g_free (bdata);
goto write_err;
}
g_free (bdata);
}
}
-static void soap_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer data)
+
+static void
+soap_got_chunk (SoupMessage *msg,
+ SoupBuffer *chunk,
+ gpointer data)
{
ESoapMessagePrivate *priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
@@ -244,7 +259,7 @@ static void soap_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer data)
priv->response_received += chunk->length;
if (priv->response_size && priv->progress_fn) {
- int pc = priv->response_received * 100 / priv->response_size;
+ gint pc = priv->response_received * 100 / priv->response_size;
priv->progress_fn (priv->progress_data, pc);
}
@@ -277,9 +292,12 @@ static void soap_got_chunk (SoupMessage *msg, SoupBuffer *chunk, gpointer data)
* Since: 2.92
*/
ESoapMessage *
-e_soap_message_new (const gchar *method, const gchar *uri_string,
- gboolean standalone, const gchar *xml_encoding,
- const gchar *env_prefix, const gchar *env_uri)
+e_soap_message_new (const gchar *method,
+ const gchar *uri_string,
+ gboolean standalone,
+ const gchar *xml_encoding,
+ const gchar *env_prefix,
+ const gchar *env_uri)
{
ESoapMessage *msg;
SoupURI *uri;
@@ -294,7 +312,7 @@ e_soap_message_new (const gchar *method, const gchar *uri_string,
soup_uri_free (uri);
/* Don't accumulate body data into a huge buffer.
- Instead, parse it as it arrives. */
+ * Instead, parse it as it arrives. */
soup_message_body_set_accumulate (SOUP_MESSAGE (msg)->response_body,
FALSE);
g_signal_connect (msg, "got-headers", G_CALLBACK (soap_got_headers), NULL);
@@ -320,9 +338,12 @@ e_soap_message_new (const gchar *method, const gchar *uri_string,
* Since: 2.92
*/
ESoapMessage *
-e_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
- gboolean standalone, const gchar *xml_encoding,
- const gchar *env_prefix, const gchar *env_uri)
+e_soap_message_new_from_uri (const gchar *method,
+ SoupURI *uri,
+ gboolean standalone,
+ const gchar *xml_encoding,
+ const gchar *env_prefix,
+ const gchar *env_uri)
{
ESoapMessage *msg;
ESoapMessagePrivate *priv;
@@ -337,7 +358,7 @@ e_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
priv->doc->standalone = standalone;
if (xml_encoding) {
- xmlFree ((xmlChar *)priv->doc->encoding);
+ xmlFree ((xmlChar *) priv->doc->encoding);
priv->doc->encoding = xmlCharStrdup (xml_encoding);
}
@@ -365,9 +386,9 @@ e_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
void
e_soap_message_store_node_data (ESoapMessage *msg,
- const gchar *nodename,
- const gchar *directory,
- gboolean base64)
+ const gchar *nodename,
+ const gchar *directory,
+ gboolean base64)
{
ESoapMessagePrivate *priv;
@@ -389,9 +410,10 @@ e_soap_message_store_node_data (ESoapMessage *msg,
*
* Since: xxx
*/
-void e_soap_message_set_progress_fn (ESoapMessage *msg,
- ESoapProgressFn fn,
- gpointer object)
+void
+e_soap_message_set_progress_fn (ESoapMessage *msg,
+ ESoapProgressFn fn,
+ gpointer object)
{
ESoapMessagePrivate *priv;
@@ -529,16 +551,16 @@ e_soap_message_end_body (ESoapMessage *msg)
*/
void
e_soap_message_start_element (ESoapMessage *msg,
- const gchar *name,
- const gchar *prefix,
- const gchar *ns_uri)
+ const gchar *name,
+ const gchar *prefix,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv;
g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- priv->last_node = xmlNewChild (priv->last_node, NULL, (const xmlChar *)name, NULL);
+ priv->last_node = xmlNewChild (priv->last_node, NULL, (const xmlChar *) name, NULL);
xmlSetNs (priv->last_node, fetch_ns (msg, prefix, ns_uri));
@@ -584,9 +606,9 @@ e_soap_message_end_element (ESoapMessage *msg)
*/
void
e_soap_message_start_fault (ESoapMessage *msg,
- const gchar *faultcode,
- const gchar *faultstring,
- const gchar *faultfactor)
+ const gchar *faultcode,
+ const gchar *faultstring,
+ const gchar *faultfactor)
{
ESoapMessagePrivate *priv;
@@ -618,7 +640,7 @@ e_soap_message_start_fault (ESoapMessage *msg,
void
e_soap_message_end_fault (ESoapMessage *msg)
{
- e_soap_message_end_element (msg);
+ e_soap_message_end_element (msg);
}
/**
@@ -636,10 +658,10 @@ e_soap_message_start_fault_detail (ESoapMessage *msg)
{
ESoapMessagePrivate *priv;
- g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
+ g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- priv->last_node = xmlNewChild (priv->last_node,
+ priv->last_node = xmlNewChild (priv->last_node,
priv->soap_ns,
(const xmlChar *)"detail",
NULL);
@@ -715,11 +737,11 @@ e_soap_message_end_header (ESoapMessage *msg)
*/
void
e_soap_message_start_header_element (ESoapMessage *msg,
- const gchar *name,
- gboolean must_understand,
- const gchar *actor_uri,
- const gchar *prefix,
- const gchar *ns_uri)
+ const gchar *name,
+ gboolean must_understand,
+ const gchar *actor_uri,
+ const gchar *prefix,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv;
@@ -757,7 +779,8 @@ e_soap_message_end_header_element (ESoapMessage *msg)
* Since: 2.92
*/
void
-e_soap_message_write_int (ESoapMessage *msg, glong i)
+e_soap_message_write_int (ESoapMessage *msg,
+ glong i)
{
gchar *str = g_strdup_printf ("%ld", i);
e_soap_message_write_string (msg, str);
@@ -774,7 +797,8 @@ e_soap_message_write_int (ESoapMessage *msg, glong i)
* Since: 2.92
*/
void
-e_soap_message_write_double (ESoapMessage *msg, gdouble d)
+e_soap_message_write_double (ESoapMessage *msg,
+ gdouble d)
{
gchar *str = g_strdup_printf ("%f", d);
e_soap_message_write_string (msg, str);
@@ -793,11 +817,13 @@ e_soap_message_write_double (ESoapMessage *msg, gdouble d)
* Since: 2.92
**/
void
-e_soap_message_write_base64 (ESoapMessage *msg, const gchar *string, gint len)
+e_soap_message_write_base64 (ESoapMessage *msg,
+ const gchar *string,
+ gint len)
{
- gchar *str = g_base64_encode ((const guchar *)string, len);
- e_soap_message_write_string (msg, str);
- g_free (str);
+ gchar *str = g_base64_encode ((const guchar *) string, len);
+ e_soap_message_write_string (msg, str);
+ g_free (str);
}
/**
@@ -811,10 +837,11 @@ e_soap_message_write_base64 (ESoapMessage *msg, const gchar *string, gint len)
* Since: 2.92
**/
void
-e_soap_message_write_time (ESoapMessage *msg, const time_t *timeval)
+e_soap_message_write_time (ESoapMessage *msg,
+ const time_t *timeval)
{
- gchar *str = g_strchomp (ctime (timeval));
- e_soap_message_write_string (msg, str);
+ gchar *str = g_strchomp (ctime (timeval));
+ e_soap_message_write_string (msg, str);
}
/**
@@ -827,14 +854,15 @@ e_soap_message_write_time (ESoapMessage *msg, const time_t *timeval)
* Since: 2.92
*/
void
-e_soap_message_write_string (ESoapMessage *msg, const gchar *string)
+e_soap_message_write_string (ESoapMessage *msg,
+ const gchar *string)
{
ESoapMessagePrivate *priv;
g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- xmlNodeAddContent (priv->last_node, (const xmlChar *)string);
+ xmlNodeAddContent (priv->last_node, (const xmlChar *) string);
}
/**
@@ -849,14 +877,16 @@ e_soap_message_write_string (ESoapMessage *msg, const gchar *string)
* Since: 2.92
*/
void
-e_soap_message_write_buffer (ESoapMessage *msg, const gchar *buffer, gint len)
+e_soap_message_write_buffer (ESoapMessage *msg,
+ const gchar *buffer,
+ gint len)
{
ESoapMessagePrivate *priv;
g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
- xmlNodeAddContentLen (priv->last_node, (const xmlChar *)buffer, len);
+ xmlNodeAddContentLen (priv->last_node, (const xmlChar *) buffer, len);
}
/**
@@ -870,7 +900,8 @@ e_soap_message_write_buffer (ESoapMessage *msg, const gchar *buffer, gint len)
* Since: 2.92
*/
void
-e_soap_message_set_element_type (ESoapMessage *msg, const gchar *xsi_type)
+e_soap_message_set_element_type (ESoapMessage *msg,
+ const gchar *xsi_type)
{
ESoapMessagePrivate *priv;
@@ -913,10 +944,10 @@ e_soap_message_set_null (ESoapMessage *msg)
*/
void
e_soap_message_add_attribute (ESoapMessage *msg,
- const gchar *name,
- const gchar *value,
- const gchar *prefix,
- const gchar *ns_uri)
+ const gchar *name,
+ const gchar *value,
+ const gchar *prefix,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv;
@@ -925,7 +956,7 @@ e_soap_message_add_attribute (ESoapMessage *msg,
xmlNewNsProp (priv->last_node,
fetch_ns (msg, prefix, ns_uri),
- (const xmlChar *)name, (const xmlChar *)value);
+ (const xmlChar *) name, (const xmlChar *) value);
}
/**
@@ -939,7 +970,9 @@ e_soap_message_add_attribute (ESoapMessage *msg,
* Since: 2.92
*/
void
-e_soap_message_add_namespace (ESoapMessage *msg, const gchar *prefix, const gchar *ns_uri)
+e_soap_message_add_namespace (ESoapMessage *msg,
+ const gchar *prefix,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv;
@@ -961,7 +994,8 @@ e_soap_message_add_namespace (ESoapMessage *msg, const gchar *prefix, const gcha
* Since: 2.92
*/
void
-e_soap_message_set_default_namespace (ESoapMessage *msg, const gchar *ns_uri)
+e_soap_message_set_default_namespace (ESoapMessage *msg,
+ const gchar *ns_uri)
{
g_return_if_fail (E_IS_SOAP_MESSAGE (msg));
@@ -979,7 +1013,8 @@ e_soap_message_set_default_namespace (ESoapMessage *msg, const gchar *ns_uri)
* Since: 2.92
*/
void
-e_soap_message_set_encoding_style (ESoapMessage *msg, const gchar *enc_style)
+e_soap_message_set_encoding_style (ESoapMessage *msg,
+ const gchar *enc_style)
{
ESoapMessagePrivate *priv;
@@ -1044,7 +1079,7 @@ e_soap_message_persist (ESoapMessage *msg)
/* serialize to SoupMessage class */
soup_message_set_request (SOUP_MESSAGE (msg), "text/xml",
- SOUP_MEMORY_TAKE, (gchar *)body, len);
+ SOUP_MEMORY_TAKE, (gchar *) body, len);
}
/**
@@ -1061,7 +1096,8 @@ e_soap_message_persist (ESoapMessage *msg)
* Since: 2.92
*/
const gchar *
-e_soap_message_get_namespace_prefix (ESoapMessage *msg, const gchar *ns_uri)
+e_soap_message_get_namespace_prefix (ESoapMessage *msg,
+ const gchar *ns_uri)
{
ESoapMessagePrivate *priv;
xmlNsPtr ns = NULL;
@@ -1070,10 +1106,10 @@ e_soap_message_get_namespace_prefix (ESoapMessage *msg, const gchar *ns_uri)
priv = E_SOAP_MESSAGE_GET_PRIVATE (msg);
g_return_val_if_fail (ns_uri != NULL, NULL);
- ns = xmlSearchNsByHref (priv->doc, priv->last_node, (const xmlChar *)ns_uri);
+ ns = xmlSearchNsByHref (priv->doc, priv->last_node, (const xmlChar *) ns_uri);
if (ns) {
if (ns->prefix)
- return (const gchar *)ns->prefix;
+ return (const gchar *) ns->prefix;
else
return "";
}
diff --git a/src/server/e-soap-response.c b/src/server/e-soap-response.c
index e937df3..026cea8 100644
--- a/src/server/e-soap-response.c
+++ b/src/server/e-soap-response.c
@@ -134,7 +134,8 @@ e_soap_response_new_from_xmldoc (xmlDoc *xmldoc)
}
static void
-parse_parameters (ESoapResponsePrivate *priv, xmlNodePtr xml_method)
+parse_parameters (ESoapResponsePrivate *priv,
+ xmlNodePtr xml_method)
{
xmlNodePtr tmp;
@@ -164,7 +165,8 @@ parse_parameters (ESoapResponsePrivate *priv, xmlNodePtr xml_method)
* Since: 2.92
*/
gboolean
-e_soap_response_from_string (ESoapResponse *response, const gchar *xmlstr)
+e_soap_response_from_string (ESoapResponse *response,
+ const gchar *xmlstr)
{
xmlDocPtr xmldoc;
@@ -179,7 +181,6 @@ e_soap_response_from_string (ESoapResponse *response, const gchar *xmlstr)
return e_soap_response_from_xmldoc (response, xmldoc);
}
-
/**
* e_soap_response_from_xmldoc:
* @response: the #ESoapResponse object.
@@ -191,7 +192,9 @@ e_soap_response_from_string (ESoapResponse *response, const gchar *xmlstr)
*
* Since: xxx
*/
-gboolean e_soap_response_from_xmldoc (ESoapResponse *response, xmlDoc *xmldoc)
+gboolean
+e_soap_response_from_xmldoc (ESoapResponse *response,
+ xmlDoc *xmldoc)
{
ESoapResponsePrivate *priv;
xmlNodePtr xml_root, xml_body, xml_method = NULL;
@@ -269,7 +272,8 @@ e_soap_response_get_method_name (ESoapResponse *response)
* Since: 2.92
*/
void
-e_soap_response_set_method_name (ESoapResponse *response, const gchar *method_name)
+e_soap_response_set_method_name (ESoapResponse *response,
+ const gchar *method_name)
{
ESoapResponsePrivate *priv;
@@ -278,7 +282,7 @@ e_soap_response_set_method_name (ESoapResponse *response, const gchar *method_na
g_return_if_fail (priv->xml_method != NULL);
g_return_if_fail (method_name != NULL);
- xmlNodeSetName (priv->xml_method, (const xmlChar *)method_name);
+ xmlNodeSetName (priv->xml_method, (const xmlChar *) method_name);
}
/**
@@ -318,7 +322,7 @@ e_soap_parameter_get_int_value (ESoapParameter *param)
s = xmlNodeGetContent (param);
if (s) {
- i = atoi ((gchar *)s);
+ i = atoi ((gchar *) s);
xmlFree (s);
return i;
@@ -346,7 +350,7 @@ e_soap_parameter_get_string_value (ESoapParameter *param)
g_return_val_if_fail (param != NULL, NULL);
xml_s = xmlNodeGetContent (param);
- s = g_strdup ((gchar *)xml_s);
+ s = g_strdup ((gchar *) xml_s);
xmlFree (xml_s);
return s;
@@ -386,7 +390,8 @@ e_soap_parameter_get_first_child (ESoapParameter *param)
* Since: 2.92
*/
ESoapParameter *
-e_soap_parameter_get_first_child_by_name (ESoapParameter *param, const gchar *name)
+e_soap_parameter_get_first_child_by_name (ESoapParameter *param,
+ const gchar *name)
{
ESoapParameter *tmp;
@@ -396,7 +401,7 @@ e_soap_parameter_get_first_child_by_name (ESoapParameter *param, const gchar *na
for (tmp = e_soap_parameter_get_first_child (param);
tmp != NULL;
tmp = e_soap_parameter_get_next_child (tmp)) {
- if (!strcmp (name, (const gchar *)tmp->name))
+ if (!strcmp (name, (const gchar *) tmp->name))
return tmp;
}
@@ -442,7 +447,7 @@ e_soap_parameter_get_next_child (ESoapParameter *param)
*/
ESoapParameter *
e_soap_parameter_get_next_child_by_name (ESoapParameter *param,
- const gchar *name)
+ const gchar *name)
{
ESoapParameter *tmp;
@@ -452,7 +457,7 @@ e_soap_parameter_get_next_child_by_name (ESoapParameter *param,
for (tmp = e_soap_parameter_get_next_child (param);
tmp != NULL;
tmp = e_soap_parameter_get_next_child (tmp)) {
- if (!strcmp (name, (const gchar *)tmp->name))
+ if (!strcmp (name, (const gchar *) tmp->name))
return tmp;
}
@@ -471,7 +476,8 @@ e_soap_parameter_get_next_child_by_name (ESoapParameter *param,
* Since: 2.92
*/
gchar *
-e_soap_parameter_get_property (ESoapParameter *param, const gchar *prop_name)
+e_soap_parameter_get_property (ESoapParameter *param,
+ const gchar *prop_name)
{
xmlChar *xml_s;
gchar *s;
@@ -479,8 +485,8 @@ e_soap_parameter_get_property (ESoapParameter *param, const gchar *prop_name)
g_return_val_if_fail (param != NULL, NULL);
g_return_val_if_fail (prop_name != NULL, NULL);
- xml_s = xmlGetProp (param, (const xmlChar *)prop_name);
- s = g_strdup ((gchar *)xml_s);
+ xml_s = xmlGetProp (param, (const xmlChar *) prop_name);
+ s = g_strdup ((gchar *) xml_s);
xmlFree (xml_s);
return s;
@@ -544,7 +550,7 @@ e_soap_response_get_first_parameter (ESoapResponse *response)
*/
ESoapParameter *
e_soap_response_get_first_parameter_by_name (ESoapResponse *response,
- const gchar *name)
+ const gchar *name)
{
ESoapResponsePrivate *priv;
GList *l;
@@ -556,7 +562,7 @@ e_soap_response_get_first_parameter_by_name (ESoapResponse *response,
for (l = priv->parameters; l != NULL; l = l->next) {
ESoapParameter *param = (ESoapParameter *) l->data;
- if (!strcmp (name, (const gchar *)param->name))
+ if (!strcmp (name, (const gchar *) param->name))
return param;
}
@@ -577,7 +583,7 @@ e_soap_response_get_first_parameter_by_name (ESoapResponse *response,
*/
ESoapParameter *
e_soap_response_get_next_parameter (ESoapResponse *response,
- ESoapParameter *from)
+ ESoapParameter *from)
{
ESoapResponsePrivate *priv;
GList *l;
@@ -608,8 +614,8 @@ e_soap_response_get_next_parameter (ESoapResponse *response,
*/
ESoapParameter *
e_soap_response_get_next_parameter_by_name (ESoapResponse *response,
- ESoapParameter *from,
- const gchar *name)
+ ESoapParameter *from,
+ const gchar *name)
{
ESoapParameter *param;
@@ -647,7 +653,8 @@ soup_xml_real_node (xmlNode *node)
* Since: 2.92
**/
gint
-e_soap_response_dump_response (ESoapResponse *response, FILE *buffer)
+e_soap_response_dump_response (ESoapResponse *response,
+ FILE *buffer)
{
xmlChar *xmlbuff;
gint buffersize, ret;
diff --git a/src/server/ews-errors.c b/src/server/ews-errors.c
index ad394dd..119453b 100644
--- a/src/server/ews-errors.c
+++ b/src/server/ews-errors.c
@@ -4,7 +4,7 @@ static GHashTable *ews_error_hash = NULL;
static GOnce setup_error_once = G_ONCE_INIT;
static struct EwsErrorMap
-ews_conn_errors [] =
+ews_conn_errors[] =
{
{"ErrorAccessDenied", EWS_CONNECTION_ERROR_ACCESSDENIED},
{"ErrorAccountDisabled", EWS_CONNECTION_ERROR_ACCOUNTDISABLED},
@@ -300,7 +300,7 @@ setup_error_map (gpointer data)
gint i;
ews_error_hash = g_hash_table_new (g_str_hash, g_str_equal);
- for (i = 0; i < G_N_ELEMENTS(ews_conn_errors); i++)
+ for (i = 0; i < G_N_ELEMENTS (ews_conn_errors); i++)
g_hash_table_insert (ews_error_hash, (gpointer) ews_conn_errors[i].error_id,
GINT_TO_POINTER (ews_conn_errors[i].error_code));
return NULL;
diff --git a/src/server/tests/test-autocompletion.c b/src/server/tests/test-autocompletion.c
index 25c0e72..de93cf1 100644
--- a/src/server/tests/test-autocompletion.c
+++ b/src/server/tests/test-autocompletion.c
@@ -34,7 +34,9 @@ void autocompletion_tests_run ();
static GMainLoop *main_loop;
static void
-resolve_names_cb (GObject *object, GAsyncResult *res, gpointer data)
+resolve_names_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GSList *mailboxes = NULL, *contact_items = NULL, *l;
@@ -67,7 +69,7 @@ resolve_names_cb (GObject *object, GAsyncResult *res, gpointer data)
/* FIXME once we fetch contact items free them as well */
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
diff --git a/src/server/tests/test-connection.c b/src/server/tests/test-connection.c
index c60cfa7..dc9a646 100644
--- a/src/server/tests/test-connection.c
+++ b/src/server/tests/test-connection.c
@@ -29,7 +29,6 @@
#include "utils.h"
#include <e-ews-connection.h>
-
static void con_test_create_new_connection ();
void connection_tests_run ();
void autodiscovery_tests_run ();
@@ -69,7 +68,9 @@ struct _cb_data {
};
static void
-autodiscover_cb (EwsUrls *urls, gpointer user_data, GError *error)
+autodiscover_cb (EwsUrls *urls,
+ gpointer user_data,
+ GError *error)
{
struct _cb_data *data = (struct _cb_data *) user_data;
gboolean quit = data->quit;
@@ -80,10 +81,10 @@ autodiscover_cb (EwsUrls *urls, gpointer user_data, GError *error)
g_assert (urls != NULL);
} else
g_assert (urls == NULL);
-
+
if (error)
g_print ("Error code:%d desc: %s \n", error->code, error->message);
-
+
g_clear_error (&error);
g_free (data->test_case);
g_free (data);
@@ -99,7 +100,7 @@ autodiscover_cb (EwsUrls *urls, gpointer user_data, GError *error)
}
static void
-con_test_autodiscover()
+con_test_autodiscover ()
{
const gchar *username;
const gchar *password;
@@ -160,8 +161,8 @@ idle_cb (gpointer data)
con_test_create_new_connection ();
g_printf ("Testing Autodiscovery.... \n");
- con_test_autodiscover();
-
+ con_test_autodiscover ();
+
return FALSE;
}
diff --git a/src/server/tests/test-createfolder.c b/src/server/tests/test-createfolder.c
index 8852a09..13dd411 100644
--- a/src/server/tests/test-createfolder.c
+++ b/src/server/tests/test-createfolder.c
@@ -38,7 +38,9 @@ static GMainLoop *main_loop;
EwsFolderId *folder_id;
static void
-create_folder_cb (GObject *object, GAsyncResult *res, gpointer data)
+create_folder_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -62,7 +64,7 @@ create_folder_cb (GObject *object, GAsyncResult *res, gpointer data)
e_ews_folder_free_fid (fid);
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
diff --git a/src/server/tests/test-cuditem.c b/src/server/tests/test-cuditem.c
index 98a4985..d817bd2 100644
--- a/src/server/tests/test-cuditem.c
+++ b/src/server/tests/test-cuditem.c
@@ -31,14 +31,15 @@
#include <e-ews-item.h>
#include <e-ews-message.h>
-
static void op_test_create_item ();
void cuditem_tests_run ();
static GMainLoop *main_loop;
static void
-create_item_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+create_item_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -53,21 +54,22 @@ create_item_ready_callback (GObject *object, GAsyncResult *res, gpointer user_da
for (l = ids; l != NULL; l = g_slist_next (l)) {
EEwsItem *item = l->data;
- const EwsId *itemid = e_ews_item_get_id(item);
+ const EwsId *itemid = e_ews_item_get_id (item);
g_print ("CreateItem: Id is %s \n", itemid->id);
break;
}
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
-op_test_create_item_get_soap_msg(ESoapMessage *msg, gpointer user_data)
+op_test_create_item_get_soap_msg (ESoapMessage *msg,
+ gpointer user_data)
{
xmlDocPtr doc;
xmlChar *xmlbuff;
- int size;
+ gint size;
//creating XML node for create item
e_soap_message_start_element (msg, "CalendarItem", NULL, NULL);
@@ -81,14 +83,14 @@ op_test_create_item_get_soap_msg(ESoapMessage *msg, gpointer user_data)
e_soap_message_end_element (msg);
g_printf("\nSOAP Request message:\n");
- doc = e_soap_message_get_xml_doc(msg);
- xmlDocDumpFormatMemory(doc, &xmlbuff,&size,1);
+ doc = e_soap_message_get_xml_doc (msg);
+ xmlDocDumpFormatMemory (doc, &xmlbuff,&size,1);
g_printf("%s\n", (gchar *)xmlbuff);
- xmlFree(xmlbuff);
+ xmlFree (xmlbuff);
}
static void
-op_test_create_item()
+op_test_create_item ()
{
const gchar *username;
const gchar *password;
diff --git a/src/server/tests/test-deletefolder.c b/src/server/tests/test-deletefolder.c
index 1555901..a91e78f 100644
--- a/src/server/tests/test-deletefolder.c
+++ b/src/server/tests/test-deletefolder.c
@@ -36,7 +36,9 @@ static GMainLoop *main_loop;
void deletefolder_tests_run (gconstpointer data);
static void
-delete_folder_cb (GObject *object, GAsyncResult *res, gpointer data)
+delete_folder_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -52,7 +54,7 @@ delete_folder_cb (GObject *object, GAsyncResult *res, gpointer data)
g_print ("Folder is successfully Deleted. \n");
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
diff --git a/src/server/tests/test-get-oof-settings.c b/src/server/tests/test-get-oof-settings.c
index f422600..c8f4be0 100644
--- a/src/server/tests/test-get-oof-settings.c
+++ b/src/server/tests/test-get-oof-settings.c
@@ -34,7 +34,9 @@ void get_oof_settings_test_run ();
static GMainLoop *main_loop;
static void
-get_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer data)
+get_oof_settings_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
OOFSettings *oof_settings;
@@ -51,7 +53,7 @@ get_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer data)
g_print ("Success : Fetched out of office settings successfully \n");
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
diff --git a/src/server/tests/test-getattachment.c b/src/server/tests/test-getattachment.c
index 13cda1a..a763267 100644
--- a/src/server/tests/test-getattachment.c
+++ b/src/server/tests/test-getattachment.c
@@ -31,14 +31,15 @@
#include <e-ews-item.h>
#include <e-ews-message.h>
-
static void op_test_get_attachments ();
void get_attachments_tests_run ();
static GMainLoop *main_loop;
static void
-get_attachments_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+get_attachments_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -57,11 +58,11 @@ get_attachments_ready_callback (GObject *object, GAsyncResult *res, gpointer use
}
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
-op_test_get_attachments()
+op_test_get_attachments ()
{
const gchar *username;
const gchar *password;
@@ -82,9 +83,9 @@ op_test_get_attachments()
g_assert (cnc != NULL);
attachmentid = "AAASAG1hbmR5Lnd1QGludGVsLmNvbQBGAAAAAACdSXexmsgJTpd3WpdX6ulXBwAm9E+BClHfQqEnvCoGvhheAAAAjpb6AACIeDU1D80fTrC3245yXdhOADUAPRB8AAABEgAQAIlh9YZzdzdMtvWW9ZI7+vM=";
- ids = g_slist_append (ids, (gpointer *)attachmentid);
+ ids = g_slist_append (ids, (gpointer *) attachmentid);
attachmentid = "AAASAG1hbmR5Lnd1QGludGVsLmNvbQBGAAAAAACdSXexmsgJTpd3WpdX6ulXBwAm9E+BClHfQqEnvCoGvhheAAAAjpb6AACIeDU1D80fTrC3245yXdhOADUAPRB8AAABEgAQADgh/XHkRSZEoCsn9BHi5Fc=";
- ids = g_slist_append (ids, (gpointer *)attachmentid);
+ ids = g_slist_append (ids, (gpointer *) attachmentid);
tmpdir = g_build_filename ("/home/xwu1/evo-cache", NULL); //a test directory that exists already
@@ -93,7 +94,7 @@ op_test_get_attachments()
get_attachments_ready_callback,
NULL, NULL,
cancellable, NULL);
- g_free(tmpdir);
+ g_free (tmpdir);
}
static gboolean
diff --git a/src/server/tests/test-getdelegate.c b/src/server/tests/test-getdelegate.c
index b7d5419..35ff33a 100644
--- a/src/server/tests/test-getdelegate.c
+++ b/src/server/tests/test-getdelegate.c
@@ -38,7 +38,9 @@ static GMainLoop *main_loop;
EwsFolderId *folder_id;
static void
-get_delegate_cb (GObject *object, GAsyncResult *res, gpointer data)
+get_delegate_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -52,17 +54,16 @@ get_delegate_cb (GObject *object, GAsyncResult *res, gpointer data)
g_clear_error (&error);
goto quit;
}
- if(get_delegate !=NULL && get_delegate->user_id != NULL)
+ if (get_delegate !=NULL && get_delegate->user_id != NULL)
g_print ("Delegate is %s", get_delegate->user_id->display_name);
-
quit:
- if(get_delegate)
+ if (get_delegate)
{
- ews_user_id_free(get_delegate->user_id);
- g_free(get_delegate);
+ ews_user_id_free (get_delegate->user_id);
+ g_free (get_delegate);
}
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
@@ -93,7 +94,7 @@ op_test_get_delegate ()
static gboolean
idle_cb (gpointer data)
{
- op_test_get_delegate();
+ op_test_get_delegate ();
return FALSE;
}
diff --git a/src/server/tests/test-libews.c b/src/server/tests/test-libews.c
index 235d67c..b9bdf8f 100644
--- a/src/server/tests/test-libews.c
+++ b/src/server/tests/test-libews.c
@@ -27,7 +27,7 @@ finalize_test_data ()
}
}
-int main (int argc, char *argv[])
+gint main (gint argc, gchar *argv[])
{
gint ret;
diff --git a/src/server/tests/test-set-oof-settings.c b/src/server/tests/test-set-oof-settings.c
index 23512ca..b9fbda4 100644
--- a/src/server/tests/test-set-oof-settings.c
+++ b/src/server/tests/test-set-oof-settings.c
@@ -35,20 +35,24 @@ static GMainLoop *main_loop;
OOFSettings *oof_settings = NULL;
static void
-set_arbit_values () {
+set_arbit_values (void)
+{
time_t tm;
+
oof_settings = g_new0 (OOFSettings, 1);
oof_settings->state = g_strdup ("Enabled");
oof_settings->ext_aud = g_strdup ("All");
tm = time (NULL);
- oof_settings->start_tm = tm - (24*60*60);
- oof_settings->end_tm = tm + (24*60*60);
+ oof_settings->start_tm = tm - (24 * 60 * 60);
+ oof_settings->end_tm = tm + (24 * 60 * 60);
oof_settings->int_reply = g_strdup ("My Internal Reply");
oof_settings->ext_reply = g_strdup ("My External Reply");
}
static void
-set_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer data)
+set_oof_settings_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -64,7 +68,7 @@ set_oof_settings_cb (GObject *object, GAsyncResult *res, gpointer data)
g_print ("Success : Set out office successfully \n");
quit:
- g_main_loop_quit(main_loop);
+ g_main_loop_quit (main_loop);
}
static void
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index e2dbf59..885a410 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -39,7 +39,9 @@ EwsFolderId *folder_id;
GMainLoop *main_loop;
static void
-folder_items_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+folder_items_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GSList *items_created = NULL, *items_updated = NULL;
@@ -61,7 +63,7 @@ folder_items_ready_callback (GObject *object, GAsyncResult *res, gpointer user_d
g_print ("Sync state for folder is\n %s \n", sync_state);
g_print ("Items created \n");
- for (l = items_created; l != NULL;l = g_slist_next (l)) {
+ for (l = items_created; l != NULL; l = g_slist_next (l)) {
EEwsItem *item = l->data;
const EwsId *item_id = e_ews_item_get_id (item);
@@ -107,7 +109,9 @@ op_test_sync_folder_items ()
}
static void
-folder_hierarchy_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+folder_hierarchy_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
GSList *folders_created = NULL, *folders_updated = NULL;
GSList *folders_deleted = NULL, *l;
@@ -128,7 +132,7 @@ folder_hierarchy_ready_callback (GObject *object, GAsyncResult *res, gpointer us
g_print ("Sync state \n %s \n", sync_state);
g_print ("Folders created \n");
- for (l = folders_created; l != NULL;l = g_slist_next (l)) {
+ for (l = folders_created; l != NULL; l = g_slist_next (l)) {
EEwsFolder *folder = l->data;
const EwsFolderId *fid = e_ews_folder_get_id (folder);
@@ -176,7 +180,9 @@ op_test_sync_folder_hierarchy ()
}
static void
-get_item_ready_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+get_item_ready_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
diff --git a/src/server/tests/utils.c b/src/server/tests/utils.c
index fa9f761..88cd92b 100644
--- a/src/server/tests/utils.c
+++ b/src/server/tests/utils.c
@@ -34,7 +34,9 @@ util_get_email_from_env (const gchar **email)
}
void
-util_get_login_info_from_env (const gchar **username, const gchar **password, const gchar **uri)
+util_get_login_info_from_env (const gchar **username,
+ const gchar **password,
+ const gchar **uri)
{
*username = g_getenv ("EWS_TEST_USERNAME");
*password = g_getenv ("EWS_TEST_PASSWORD");
diff --git a/src/utils/e-ews-query-to-restriction.c b/src/utils/e-ews-query-to-restriction.c
index b7d3f06..f932198 100644
--- a/src/utils/e-ews-query-to-restriction.c
+++ b/src/utils/e-ews-query-to-restriction.c
@@ -56,7 +56,7 @@
e_soap_message_start_element (msg, "Exists", NULL, NULL); \
e_ews_message_write_string_parameter_with_attribute (msg, "FieldURI", NULL, NULL, "FieldURI", uri);\
e_soap_message_end_element (msg);
-
+
#define WRITE_GREATER_THAN_OR_EQUAL_TO_MESSAGE(msg, uri, val) \
e_soap_message_start_element (msg, "IsGreaterThanOrEqualTo", NULL, NULL); \
e_ews_message_write_string_parameter_with_attribute (msg, "FieldURI", NULL, NULL, "FieldURI", uri); \
@@ -97,7 +97,6 @@
e_soap_message_end_element (msg); \
e_soap_message_end_element (msg);
-
typedef enum {
MATCH_CONTAINS,
MATCH_IS,
@@ -204,10 +203,11 @@ struct EmailIndex {
};
static ESExpResult *
-e_ews_implement_contact_contains ( ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data, match_type type)
+e_ews_implement_contact_contains (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer data,
+ match_type type)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -219,7 +219,7 @@ e_ews_implement_contact_contains ( ESExp *f,
field = argv[0]->value.string;
if (argv[1]->type == ESEXP_RES_STRING && argv[1]->value.string != NULL) {
- gchar *mode=NULL;
+ gchar *mode = NULL;
if (type == MATCH_CONTAINS || type == MATCH_ENDS_WITH)
mode = g_strdup ("Substring");
@@ -289,12 +289,12 @@ e_ews_implement_contact_contains ( ESExp *f,
return r;
}
-
static ESExpResult *
e_ews_func_and_or_not (ESExp *f,
- gint argc,
- ESExpTerm **argv,
- gpointer data, match_type type)
+ gint argc,
+ ESExpTerm **argv,
+ gpointer data,
+ match_type type)
{
ESExpResult *r, *r1;
ESoapMessage *msg;
@@ -314,7 +314,7 @@ e_ews_func_and_or_not (ESExp *f,
} else if (type == MATCH_OR) {
if (argc >= 2)
e_soap_message_start_element (msg, "Or", NULL, NULL);
-
+
} else if (type == MATCH_NOT)
e_soap_message_start_element (msg, "Not", NULL, NULL);
@@ -334,9 +334,9 @@ result:
static ESExpResult *
calendar_func_contains (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -418,9 +418,9 @@ calendar_func_contains (ESExp *f,
static ESExpResult *
calendar_func_has_categories (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -441,15 +441,15 @@ calendar_func_has_categories (ESExp *f,
static ESExpResult *
calendar_func_has_attachment (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
msg = (ESoapMessage *) data;
-
+
if (argc == 0) {
WRITE_EXISTS_MESSAGE (msg, "item:HasAttachments");
}
@@ -461,9 +461,9 @@ calendar_func_has_attachment (ESExp *f,
static ESExpResult *
calendar_func_has_recurrence (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -492,9 +492,9 @@ e_ews_make_timestamp (time_t when)
static ESExpResult *
calendar_func_occur_in_time_range (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -529,9 +529,9 @@ calendar_func_occur_in_time_range (ESExp *f,
static ESExpResult *
calendar_func_occurrences_count (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -543,9 +543,9 @@ calendar_func_occurrences_count (ESExp *f,
static ESExpResult *
message_func_body_contains (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -567,9 +567,10 @@ message_func_body_contains (ESExp *f,
static ESExpResult *
common_message_func_header_contains (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data, match_type type)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data,
+ match_type type)
{
ESExpResult *r;
@@ -590,7 +591,7 @@ common_message_func_header_contains (ESExp *f,
if (argv[0]->type == ESEXP_RES_STRING) {
gchar *headername;
headername = argv[0]->value.string;
-
+
if (argv[1]->type == ESEXP_RES_STRING) {
gchar *value;
value = argv[1]->value.string;
@@ -616,9 +617,9 @@ common_message_func_header_contains (ESExp *f,
static ESExpResult *
message_func_header_exists (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -628,7 +629,7 @@ message_func_header_exists (ESExp *f,
if (argv[0]->type == ESEXP_RES_STRING) {
gchar *headername;
headername = argv[0]->value.string;
-
+
if (!g_ascii_strcasecmp(headername, "subject")) {
WRITE_EXISTS_MESSAGE (msg, "item:Subject");
} else if (!g_ascii_strcasecmp(headername, "from")) {
@@ -649,9 +650,9 @@ message_func_header_exists (ESExp *f,
static ESExpResult *
message_func_system_flag (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -678,9 +679,9 @@ message_func_system_flag (ESExp *f,
static ESExpResult *
message_func_sent_date (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -692,9 +693,9 @@ message_func_sent_date (ESExp *f,
static ESExpResult *
message_func_received_date (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -706,9 +707,9 @@ message_func_received_date (ESExp *f,
static ESExpResult *
message_func_current_date (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -719,13 +720,12 @@ message_func_current_date (ESExp *f,
static ESExpResult *
message_func_relative_months (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
-
if (argc != 1 || argv[0]->type != ESEXP_RES_INT) {
r = e_sexp_result_new (f, ESEXP_RES_BOOL);
r->value.boolean = FALSE;
@@ -739,10 +739,10 @@ message_func_relative_months (ESExp *f,
}
static ESExpResult *
-message_func_get_size (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+message_func_get_size (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -754,9 +754,9 @@ message_func_get_size (ESExp *f,
static ESExpResult *
func_eq (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -795,9 +795,9 @@ func_eq (ESExp *f,
static ESExpResult *
func_gt (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -853,9 +853,9 @@ func_gt (ESExp *f,
static ESExpResult *
func_lt (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
ESoapMessage *msg;
@@ -911,9 +911,9 @@ func_lt (ESExp *f,
static ESExpResult *
message_func_match_all (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
ESExpResult *r;
@@ -924,99 +924,99 @@ message_func_match_all (ESExp *f,
static ESExpResult *
message_func_header_contains (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return common_message_func_header_contains (f, argc, argv, data, MATCH_CONTAINS);
}
static ESExpResult *
-message_func_header_matches (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+message_func_header_matches (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return common_message_func_header_contains (f, argc, argv, data, MATCH_IS);
}
static ESExpResult *
-message_func_header_starts_with (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+message_func_header_starts_with (ESExp *f,
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return common_message_func_header_contains (f, argc, argv, data, MATCH_BEGINS_WITH);
}
-static ESExpResult *
+static ESExpResult *
message_func_header_ends_with (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return common_message_func_header_contains (f, argc, argv, data, MATCH_ENDS_WITH);
}
static ESExpResult *
contact_func_contains (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return e_ews_implement_contact_contains (f, argc, argv, data, MATCH_CONTAINS);
}
static ESExpResult *
contact_func_is (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return e_ews_implement_contact_contains (f, argc, argv, data, MATCH_IS);
}
static ESExpResult *
contact_func_beginswith (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return e_ews_implement_contact_contains (f, argc, argv, data, MATCH_BEGINS_WITH);
}
static ESExpResult *
contact_func_endswith (ESExp *f,
- gint argc,
- ESExpResult **argv,
- gpointer data)
+ gint argc,
+ ESExpResult **argv,
+ gpointer data)
{
return e_ews_implement_contact_contains (f, argc, argv, data, MATCH_ENDS_WITH);
}
static ESExpResult *
func_or (ESExp *f,
- gint argc,
- ESExpTerm **argv,
- gpointer data)
+ gint argc,
+ ESExpTerm **argv,
+ gpointer data)
{
return e_ews_func_and_or_not (f, argc, argv, data, MATCH_OR);
}
static ESExpResult *
func_and (ESExp *f,
- gint argc,
- ESExpTerm **argv,
- gpointer data)
+ gint argc,
+ ESExpTerm **argv,
+ gpointer data)
{
return e_ews_func_and_or_not (f, argc, argv, data, MATCH_AND);
}
static ESExpResult *
func_not (ESExp *f,
- gint argc,
- ESExpTerm **argv,
- gpointer data)
+ gint argc,
+ ESExpTerm **argv,
+ gpointer data)
{
return e_ews_func_and_or_not (f, argc, argv, data, MATCH_NOT);
}
@@ -1034,7 +1034,7 @@ static struct {
{ "is", contact_func_is, 0 },
{ "beginswith", contact_func_beginswith, 0 },
{ "endswith", contact_func_endswith, 0 },
-};
+};
static struct {
const gchar *name;
@@ -1086,7 +1086,9 @@ static struct {
};
static void
-e_ews_convert_sexp_to_restriction (ESoapMessage *msg, const gchar *query, EwsFolderType type)
+e_ews_convert_sexp_to_restriction (ESoapMessage *msg,
+ const gchar *query,
+ EwsFolderType type)
{
ESExp *sexp;
ESExpResult *r;
@@ -1137,7 +1139,8 @@ e_ews_convert_sexp_to_restriction (ESoapMessage *msg, const gchar *query, EwsFol
}
static gboolean
-e_ews_check_is_query (const gchar *query, EwsFolderType type)
+e_ews_check_is_query (const gchar *query,
+ EwsFolderType type)
{
if (!query)
@@ -1146,9 +1149,9 @@ e_ews_check_is_query (const gchar *query, EwsFolderType type)
if (type == EWS_FOLDER_TYPE_CONTACTS) {
if (!g_strcmp0 (query, "(contains \"x-evolution-any-field\" \"\")"))
return FALSE;
- else
+ else
return TRUE;
-
+
} else if (type == EWS_FOLDER_TYPE_CALENDAR || type == EWS_FOLDER_TYPE_TASKS) {
if (!g_strcmp0 (query, "(contains? \"summary\" \"\")"))
return FALSE;
@@ -1161,7 +1164,9 @@ e_ews_check_is_query (const gchar *query, EwsFolderType type)
}
void
-e_ews_query_to_restriction (ESoapMessage *msg, const gchar *query, EwsFolderType type)
+e_ews_query_to_restriction (ESoapMessage *msg,
+ const gchar *query,
+ EwsFolderType type)
{
gboolean is_query;
diff --git a/src/utils/e-sqlite3-vfs.c b/src/utils/e-sqlite3-vfs.c
index 6d2868d..ea767d5 100644
--- a/src/utils/e-sqlite3-vfs.c
+++ b/src/utils/e-sqlite3-vfs.c
@@ -45,7 +45,8 @@ typedef struct {
} ESqlite3File;
static gint
-call_old_file_Sync (ESqlite3File *cFile, gint flags)
+call_old_file_Sync (ESqlite3File *cFile,
+ gint flags)
{
g_return_val_if_fail (old_vfs != NULL, SQLITE_ERROR);
g_return_val_if_fail (cFile != NULL, SQLITE_ERROR);
@@ -62,7 +63,8 @@ struct SyncRequestData
};
static void
-sync_request_thread_cb (gpointer task_data, gpointer null_data)
+sync_request_thread_cb (gpointer task_data,
+ gpointer null_data)
{
struct SyncRequestData *sync_data = task_data;
EFlag *sync_op;
@@ -80,7 +82,8 @@ sync_request_thread_cb (gpointer task_data, gpointer null_data)
}
static void
-sync_push_request (ESqlite3File *cFile, gboolean wait_for_finish)
+sync_push_request (ESqlite3File *cFile,
+ gboolean wait_for_finish)
{
struct SyncRequestData *data;
EFlag *sync_op = NULL;
@@ -163,7 +166,8 @@ def_subclassed (xDeviceCharacteristics, (sqlite3_file *pFile), (cFile->old_vfs_f
#undef def_subclassed
static gint
-e_sqlite3_file_xCheckReservedLock (sqlite3_file *pFile, gint *pResOut)
+e_sqlite3_file_xCheckReservedLock (sqlite3_file *pFile,
+ gint *pResOut)
{
ESqlite3File *cFile;
@@ -218,7 +222,8 @@ e_sqlite3_file_xClose (sqlite3_file *pFile)
}
static gint
-e_sqlite3_file_xSync (sqlite3_file *pFile, gint flags)
+e_sqlite3_file_xSync (sqlite3_file *pFile,
+ gint flags)
{
ESqlite3File *cFile;
@@ -247,7 +252,11 @@ e_sqlite3_file_xSync (sqlite3_file *pFile, gint flags)
}
static gint
-e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs, const gchar *zPath, sqlite3_file *pFile, gint flags, gint *pOutFlags)
+e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
+ const gchar *zPath,
+ sqlite3_file *pFile,
+ gint flags,
+ gint *pOutFlags)
{
static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT;
static sqlite3_io_methods io_methods = {0};
@@ -257,7 +266,7 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs, const gchar *zPath, sqlite3_file *pFile,
g_return_val_if_fail (old_vfs != NULL, -1);
g_return_val_if_fail (pFile != NULL, -1);
- cFile = (ESqlite3File *)pFile;
+ cFile = (ESqlite3File *) pFile;
cFile->old_vfs_file = g_malloc0 (old_vfs->szOsFile);
res = old_vfs->xOpen (old_vfs, zPath, cFile->old_vfs_file, flags, pOutFlags);
@@ -274,7 +283,7 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs, const gchar *zPath, sqlite3_file *pFile,
sync_pool = g_thread_pool_new (sync_request_thread_cb, NULL, 2, FALSE, NULL);
/* cFile->old_vfs_file->pMethods is NULL when open failed for some reason,
- thus do not initialize our structure when do not know the version */
+ * thus do not initialize our structure when do not know the version */
if (io_methods.xClose == NULL && cFile->old_vfs_file->pMethods) {
/* initialize our subclass function only once */
io_methods.iVersion = cFile->old_vfs_file->pMethods->iVersion;
diff --git a/src/utils/ews-camel-common.c b/src/utils/ews-camel-common.c
index 58c210e..3afca67 100644
--- a/src/utils/ews-camel-common.c
+++ b/src/utils/ews-camel-common.c
@@ -39,27 +39,28 @@ struct _create_mime_msg_data {
#define MAPI_MSGFLAG_UNSENT 0x08
static void
-create_mime_message_cb (ESoapMessage *msg, gpointer user_data)
+create_mime_message_cb (ESoapMessage *msg,
+ gpointer user_data)
{
struct _create_mime_msg_data *create_data = user_data;
CamelStream *mem, *filtered;
CamelMimeFilter *filter;
GByteArray *bytes;
gchar *base64;
- int msgflag;
+ gint msgflag;
e_soap_message_start_element (msg, "Message", NULL, NULL);
e_soap_message_start_element (msg, "MimeContent", NULL, NULL);
/* This is horrid. We really need to extend ESoapMessage to allow us
- to stream this directly rather than storing it in RAM. Which right
- now we are doing about four times: the GByteArray in the mem stream,
- then the base64 version, then the xmlDoc, then the soup request. */
+ * to stream this directly rather than storing it in RAM. Which right
+ * now we are doing about four times: the GByteArray in the mem stream,
+ * then the base64 version, then the xmlDoc, then the soup request. */
camel_mime_message_set_best_encoding (create_data->message,
CAMEL_BESTENC_GET_ENCODING,
CAMEL_BESTENC_8BIT);
- mem = camel_stream_mem_new();
+ mem = camel_stream_mem_new ();
filtered = camel_stream_filter_new (mem);
filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE,
@@ -107,11 +108,16 @@ create_mime_message_cb (ESoapMessage *msg, gpointer user_data)
}
gboolean
-camel_ews_utils_create_mime_message (EEwsConnection *cnc, const gchar *disposition,
- const gchar *save_folder, CamelMimeMessage *message,
- gint32 message_camel_flags, CamelAddress *from,
- gchar **itemid, gchar **changekey,
- GCancellable *cancellable, GError **error)
+camel_ews_utils_create_mime_message (EEwsConnection *cnc,
+ const gchar *disposition,
+ const gchar *save_folder,
+ CamelMimeMessage *message,
+ gint32 message_camel_flags,
+ CamelAddress *from,
+ gchar **itemid,
+ gchar **changekey,
+ GCancellable *cancellable,
+ GError **error)
{
struct _create_mime_msg_data *create_data;
GSList *ids;
@@ -158,9 +164,9 @@ camel_ews_utils_create_mime_message (EEwsConnection *cnc, const gchar *dispositi
if (!res || (!itemid && !changekey))
return res;
- item = (EEwsItem *)ids->data;
+ item = (EEwsItem *) ids->data;
if (!item || !(ewsid = e_ews_item_get_id (item))) {
- g_set_error(error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+ g_set_error (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("CreateItem call failed to return ID for new message"));
return FALSE;
}
diff --git a/src/utils/ews-camel-common.h b/src/utils/ews-camel-common.h
index 9e8b4df..89a9dec 100644
--- a/src/utils/ews-camel-common.h
+++ b/src/utils/ews-camel-common.h
@@ -34,7 +34,6 @@ camel_ews_utils_create_mime_message (EEwsConnection *cnc, const gchar *dispositi
G_END_DECLS
-
#ifdef __cplusplus
}
#endif
diff --git a/src/utils/ews-esource-utils.c b/src/utils/ews-esource-utils.c
index cfe7ebe..457c2f2 100644
--- a/src/utils/ews-esource-utils.c
+++ b/src/utils/ews-esource-utils.c
@@ -22,7 +22,9 @@
#include "ews-esource-utils.h"
ESource *
-ews_find_source_by_matched_prop (GSList *sources, const gchar *prop, const gchar *value)
+ews_find_source_by_matched_prop (GSList *sources,
+ const gchar *prop,
+ const gchar *value)
{
GSList *s;
@@ -44,7 +46,8 @@ ews_find_source_by_matched_prop (GSList *sources, const gchar *prop, const gchar
}
static ESourceGroup *
-ews_find_group (GSList *groups, const gchar *account_name)
+ews_find_group (GSList *groups,
+ const gchar *account_name)
{
GSList *p;
gint len;
@@ -65,7 +68,8 @@ ews_find_group (GSList *groups, const gchar *account_name)
}
ESourceGroup *
-ews_esource_utils_ensure_group (ESourceList *source_list, const gchar *account_name)
+ews_esource_utils_ensure_group (ESourceList *source_list,
+ const gchar *account_name)
{
ESourceGroup *group = NULL;
GSList *groups;
@@ -89,20 +93,20 @@ ews_esource_utils_ensure_group (ESourceList *source_list, const gchar *account_n
}
gboolean
-ews_esource_utils_add_esource (EEwsFolder *folder,
- const gchar *account_uri,
- const gchar *account_name,
- const gchar *username,
- const gchar *email_id,
- const gchar *hosturl,
- gint refresh_timeout)
+ews_esource_utils_add_esource (EEwsFolder *folder,
+ const gchar *account_uri,
+ const gchar *account_name,
+ const gchar *username,
+ const gchar *email_id,
+ const gchar *hosturl,
+ gint refresh_timeout)
{
ESourceList *source_list;
ESourceGroup *group;
ESource *source;
EwsFolderType ftype;
const EwsFolderId *fid;
- GConfClient* client;
+ GConfClient * client;
const gchar *conf_key, *selection_key = NULL;
const gchar *source_name;
gchar *source_uri;
@@ -116,7 +120,7 @@ ews_esource_utils_add_esource (EEwsFolder *folder,
if (ftype == EWS_FOLDER_TYPE_CALENDAR) {
conf_key = CALENDAR_SOURCES;
selection_key = SELECTED_CALENDARS;
- } else if (ftype == EWS_FOLDER_TYPE_TASKS){
+ } else if (ftype == EWS_FOLDER_TYPE_TASKS) {
conf_key = TASKS_SOURCES;
selection_key = SELECTED_TASKS;
} else if (ftype == EWS_FOLDER_TYPE_CONTACTS) {
@@ -135,10 +139,10 @@ ews_esource_utils_add_esource (EEwsFolder *folder,
}
/* We use the same URI for all calendars as for the mail, since
- there's no other way to set the key used for password storage
- in *either* calendar or mail code. Note the tricks we have to
- play in the calendar back end to make the cache directory
- unique again. */
+ * there's no other way to set the key used for password storage
+ * in *either* calendar or mail code. Note the tricks we have to
+ * play in the calendar back end to make the cache directory
+ * unique again. */
if (ftype == EWS_FOLDER_TYPE_CONTACTS)
source_uri = g_strdup_printf ("%s;folderid=%s", account_uri + strlen (EWS_BASE_URI), fid->id);
else
@@ -188,21 +192,21 @@ exit:
/* FIXME remove cache */
gboolean
-ews_esource_utils_remove_esource (const gchar *fid,
- const gchar *account_name,
- EwsFolderType ftype)
+ews_esource_utils_remove_esource (const gchar *fid,
+ const gchar *account_name,
+ EwsFolderType ftype)
{
ESourceList *source_list;
ESourceGroup *group;
ESource *source;
- GConfClient* client;
+ GConfClient * client;
const gchar *conf_key;
GSList *sources;
gboolean ret = TRUE;
if (ftype == EWS_FOLDER_TYPE_CALENDAR) {
conf_key = CALENDAR_SOURCES;
- } else if (ftype == EWS_FOLDER_TYPE_TASKS){
+ } else if (ftype == EWS_FOLDER_TYPE_TASKS) {
conf_key = TASKS_SOURCES;
} else if (ftype == EWS_FOLDER_TYPE_CONTACTS) {
conf_key = CONTACT_SOURCES;
@@ -231,18 +235,19 @@ exit:
}
gboolean
-ews_source_utils_remove_group (const gchar *account_name, EwsFolderType ftype)
+ews_source_utils_remove_group (const gchar *account_name,
+ EwsFolderType ftype)
{
ESourceList *source_list;
ESourceGroup *group;
GSList *groups;
- GConfClient* client;
+ GConfClient * client;
const gchar *conf_key;
gboolean ret = TRUE;
if (ftype == EWS_FOLDER_TYPE_CALENDAR) {
conf_key = CALENDAR_SOURCES;
- } else if (ftype == EWS_FOLDER_TYPE_TASKS){
+ } else if (ftype == EWS_FOLDER_TYPE_TASKS) {
conf_key = TASKS_SOURCES;
} else if (ftype == EWS_FOLDER_TYPE_CONTACTS) {
conf_key = CONTACT_SOURCES;
@@ -260,7 +265,6 @@ ews_source_utils_remove_group (const gchar *account_name, EwsFolderType ftype)
} else
ret = FALSE;
-
g_object_unref (source_list);
g_object_unref (client);
@@ -269,7 +273,7 @@ ews_source_utils_remove_group (const gchar *account_name, EwsFolderType ftype)
}
void
-ews_esource_utils_remove_groups (const gchar *account_name)
+ews_esource_utils_remove_groups (const gchar *account_name)
{
ews_source_utils_remove_group (account_name, EWS_FOLDER_TYPE_CALENDAR);
ews_source_utils_remove_group (account_name, EWS_FOLDER_TYPE_CONTACTS);
diff --git a/src/utils/ews-test-finditem-query.c b/src/utils/ews-test-finditem-query.c
index 3818870..2ca6486 100644
--- a/src/utils/ews-test-finditem-query.c
+++ b/src/utils/ews-test-finditem-query.c
@@ -41,7 +41,9 @@ GMainLoop *main_loop;
static gint iter = 0;
static void
-find_folder_item_callback (GObject *object, GAsyncResult *res, gpointer user_data)
+find_folder_item_callback (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
GError *error = NULL;
@@ -52,13 +54,13 @@ find_folder_item_callback (GObject *object, GAsyncResult *res, gpointer user_dat
if (error != NULL) {
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*/
if (iter == 3)
g_main_loop_quit (main_loop);
-
+
return;
}
@@ -82,7 +84,9 @@ find_folder_item_callback (GObject *object, GAsyncResult *res, gpointer user_dat
}
static void
-get_login_info_from_env (const gchar **username, const gchar **password, const gchar **uri)
+get_login_info_from_env (const gchar **username,
+ const gchar **password,
+ const gchar **uri)
{
*username = g_getenv ("EWS_TEST_USERNAME");
*password = g_getenv ("EWS_TEST_PASSWORD");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]