From 3fd1fe0a663ea89de54fc40fd157c5047d0c0d63 Mon Sep 17 00:00:00 2001 From: Sarfraaz Ahmed Date: Tue, 5 Jul 2005 09:19:10 +0000 Subject: Newly added. This adds the esources for all the folders only if the 2005-07-05 Sarfraaz Ahmed * exchange-config-listener.c (add_new_sources) : Newly added. This adds the esources for all the folders only if the esource doesnt already exist. (account_added) : Invoke add_new_sources after connect. svn path=/trunk/; revision=29638 --- plugins/exchange-operations/ChangeLog | 7 +++ .../exchange-operations/exchange-config-listener.c | 55 ++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'plugins/exchange-operations') diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 154d3d4595..18f31c6d33 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,10 @@ +2005-07-05 Sarfraaz Ahmed + + * exchange-config-listener.c (add_new_sources) : Newly added. This adds + the esources for all the folders only if the esource doesnt already + exist. + (account_added) : Invoke add_new_sources after connect. + 2005-07-01 Praveen Kumar * Makefile.am : Added new file entries for calendar , contacts diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c index 6808931624..7991a7d956 100644 --- a/plugins/exchange-operations/exchange-config-listener.c +++ b/plugins/exchange-operations/exchange-config-listener.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -493,6 +494,59 @@ add_folder_esource (ExchangeAccount *account, g_object_unref (client); } +static void +add_new_sources (ExchangeAccount *account) +{ + GPtrArray *exchange_folders; + + exchange_folders = exchange_account_get_folders (account); + if (exchange_folders && exchange_folders->len > 0) { + int i; + const char *folder_type; + const char *folder_name; + const char *folder_uri; + int type; + EFolder *folder; + ExchangeHierarchy *hier; + gboolean create_esource = FALSE; + + for (i = 0; i < exchange_folders->len; i++) { + + folder = exchange_folders->pdata[i]; + hier = e_folder_exchange_get_hierarchy (folder); + if (hier->type != EXCHANGE_HIERARCHY_PUBLIC) { + folder_name = e_folder_get_name (folder); + folder_uri = e_folder_get_physical_uri (folder); + folder_type = e_folder_get_type_string (folder); + + if (!(strcmp (folder_type, "calendar")) || + !(strcmp (folder_type, "calendar/public"))) { + type = EXCHANGE_CALENDAR_FOLDER; + create_esource = TRUE; + } + else if (!(strcmp (folder_type, "tasks")) || + !(strcmp (folder_type, "tasks/public"))) { + type = EXCHANGE_TASKS_FOLDER; + create_esource = TRUE; + } + else if (!(strcmp (folder_type, "contacts")) || + !(strcmp (folder_type, "contacts/public")) || + !(strcmp (folder_type, "contacts/ldap"))) { + type = EXCHANGE_CONTACTS_FOLDER; + create_esource = TRUE; + } + else { + create_esource = FALSE; + } + + if (create_esource) + add_folder_esource (account, type, + folder_name, folder_uri); + } /* End hierarchy type check */ + } /* End for loop */ + } /* End check for a list of folders */ +} + static void add_sources (ExchangeAccount *account) { @@ -819,6 +873,7 @@ account_added (EAccountList *account_list, EAccount *account) exchange_account); add_sources (exchange_account); exchange_account_connect (exchange_account); + add_new_sources (exchange_account); } struct account_update_data { -- cgit v1.2.3