[evolution-ews] I#78 - Verify also URL validity in account settings



commit e863340bc9410b5d75d5fa91c4b1592f8bf6a797
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 8 15:56:40 2020 +0100

    I#78 - Verify also URL validity in account settings
    
    Closes https://gitlab.gnome.org/GNOME/evolution-ews/issues/78

 src/configuration/e-mail-config-ews-backend.c | 33 +++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index 51f18c49..3db3fd45 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -552,7 +552,7 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
        CamelSettings *settings;
        CamelEwsSettings *ews_settings;
        CamelNetworkSettings *network_settings;
-       const gchar *hosturl;
+       const gchar *hosturl, *oaburl;
        const gchar *user;
        gboolean correct, complete = TRUE;
 
@@ -573,6 +573,7 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
 
        ews_settings = CAMEL_EWS_SETTINGS (settings);
        hosturl = camel_ews_settings_get_hosturl (ews_settings);
+       oaburl = camel_ews_settings_get_oaburl (ews_settings);
 
        network_settings = CAMEL_NETWORK_SETTINGS (settings);
        user = camel_network_settings_get_user (network_settings);
@@ -580,7 +581,35 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
        correct = hosturl != NULL && *hosturl != '\0';
        complete = complete && correct;
 
-       e_util_set_entry_issue_hint (priv->host_entry, correct ? NULL : _("Host URL cannot be empty"));
+       if (correct) {
+               SoupURI *suri;
+
+               suri = soup_uri_new (hosturl);
+               if (suri) {
+                       soup_uri_free (suri);
+                       e_util_set_entry_issue_hint (priv->host_entry, NULL);
+               } else {
+                       e_util_set_entry_issue_hint (priv->host_entry, _("Host URL is not valid"));
+                       complete = FALSE;
+               }
+       } else {
+               e_util_set_entry_issue_hint (priv->host_entry, _("Host URL cannot be empty"));
+       }
+
+       if (oaburl && *oaburl) {
+               SoupURI *suri;
+
+               suri = soup_uri_new (oaburl);
+               if (suri) {
+                       soup_uri_free (suri);
+                       e_util_set_entry_issue_hint (priv->oab_entry, NULL);
+               } else {
+                       e_util_set_entry_issue_hint (priv->oab_entry, _("OAB URL is not valid"));
+                       complete = FALSE;
+               }
+       } else {
+               e_util_set_entry_issue_hint (priv->oab_entry, NULL);
+       }
 
        correct = user != NULL && *user != '\0';
        complete = complete && correct;


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