[evolution-ews] Allow enter distinguished folder names when subscribing to other user's folder



commit 373e3dbbc2842204d80feeff58a7bfe46ad5cc83
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 17 10:08:35 2020 +0100

    Allow enter distinguished folder names when subscribing to other user's folder
    
    As the folder ID is relatively long base64-encoded string, it can
    be expected that folder names shorter than some value are distinguished
    folder names, thus let them work like that.
    
    The list of known distinguished folder names can be found here:
    https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/distinguishedfolderid

 src/configuration/e-ews-subscribe-foreign-folder.c | 5 +++--
 src/server/e-ews-folder.c                          | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/configuration/e-ews-subscribe-foreign-folder.c 
b/src/configuration/e-ews-subscribe-foreign-folder.c
index 44abd807..a692c578 100644
--- a/src/configuration/e-ews-subscribe-foreign-folder.c
+++ b/src/configuration/e-ews-subscribe-foreign-folder.c
@@ -393,11 +393,12 @@ check_foreign_folder_thread (GObject *with_object,
        } else {
                fid.id = (gchar *) (cffd->use_foldername ? cffd->use_foldername : cffd->orig_foldername);
                fid.change_key = NULL;
-               fid.is_distinguished_id = cffd->use_foldername != NULL;
+               fid.is_distinguished_id = cffd->use_foldername != NULL || (cffd->orig_foldername && strlen 
(cffd->orig_foldername) < 40);
 
                if (!e_ews_connection_get_folder_info_sync (conn, G_PRIORITY_DEFAULT,
                        cffd->email, &fid, &folder, cancellable, &local_error)) {
-                       if (g_error_matches (local_error, EWS_CONNECTION_ERROR, 
EWS_CONNECTION_ERROR_ITEMNOTFOUND) ||
+                       if (!local_error ||
+                           g_error_matches (local_error, EWS_CONNECTION_ERROR, 
EWS_CONNECTION_ERROR_ITEMNOTFOUND) ||
                            g_error_matches (local_error, EWS_CONNECTION_ERROR, 
EWS_CONNECTION_ERROR_FOLDERNOTFOUND)) {
                                g_clear_error (&local_error);
                                local_error = g_error_new (
diff --git a/src/server/e-ews-folder.c b/src/server/e-ews-folder.c
index 5148487f..65830fc7 100644
--- a/src/server/e-ews-folder.c
+++ b/src/server/e-ews-folder.c
@@ -121,7 +121,8 @@ e_ews_folder_set_from_soap_parameter (EEwsFolder *folder,
 
        g_return_val_if_fail (param != NULL, FALSE);
 
-       if (g_strcmp0 (e_soap_parameter_get_name (param), "Folder") == 0) {
+       if (g_strcmp0 (e_soap_parameter_get_name (param), "Folder") == 0 ||
+           g_strcmp0 (e_soap_parameter_get_name (param), "SearchFolder") == 0 ) {
                node = param;
                priv->folder_type = E_EWS_FOLDER_TYPE_MAILBOX;
        } else if (g_strcmp0 (e_soap_parameter_get_name (param), "CalendarFolder") == 0) {
@@ -133,7 +134,8 @@ e_ews_folder_set_from_soap_parameter (EEwsFolder *folder,
        } else if (g_strcmp0 (e_soap_parameter_get_name (param), "TasksFolder") == 0) {
                node = param;
                priv->folder_type = E_EWS_FOLDER_TYPE_TASKS;
-       } else if ((node = e_soap_parameter_get_first_child_by_name (param, "Folder")))
+       } else if ((node = e_soap_parameter_get_first_child_by_name (param, "Folder")) ||
+                  (node = e_soap_parameter_get_first_child_by_name (param, "SearchFolder")))
                priv->folder_type = E_EWS_FOLDER_TYPE_MAILBOX;
        else if ((node = e_soap_parameter_get_first_child_by_name (param, "CalendarFolder")))
                priv->folder_type = E_EWS_FOLDER_TYPE_CALENDAR;


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