From 4dbbd163dd4a8866e9547ff40002b34ade4ff3b1 Mon Sep 17 00:00:00 2001 From: Sarfraaz Ahmed Date: Mon, 11 Jul 2005 07:16:42 +0000 Subject: Patch submitted by ArunPrakash Newly added, to report 2005-07-11 Sarfraaz Ahmed Patch submitted by ArunPrakash * exchange-operations.c (exchange_operations_report_error) : Newly added, to report errors using e_error_run. Also a list of error-ids is added. * exchange-config-listener.c (account_added) (account_removed) : Modified the usage of e_notice to e_error_run. Also the error from exchange_account_connect is reported using exchange_operations_report_error. * exchange-account-setup.c (btn_chpass_clicked) (org_gnome_exchange_settings) (print_error) (set_oof_info): Changed to use exchange_operations_report_error and e_error_run functions. * org-gnome-exchange-operations.error.xml : Newly added, defines the list of error messages used in the plugin. * Makefile.am : Modified for org-gnome-exchange-operations.error.xml svn path=/trunk/; revision=29707 --- plugins/exchange-operations/ChangeLog | 17 +++ plugins/exchange-operations/Makefile.am | 7 +- .../exchange-operations/exchange-account-setup.c | 96 +++++--------- .../exchange-operations/exchange-config-listener.c | 25 ++-- plugins/exchange-operations/exchange-operations.c | 48 +++++++ plugins/exchange-operations/exchange-operations.h | 3 + .../org-gnome-exchange-operations.error.xml | 142 +++++++++++++++++++++ 7 files changed, 254 insertions(+), 84 deletions(-) create mode 100644 plugins/exchange-operations/org-gnome-exchange-operations.error.xml diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 6eed7b9ba0..b6f1189740 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,20 @@ +2005-07-11 Sarfraaz Ahmed + + Patch submitted by ArunPrakash + * exchange-operations.c (exchange_operations_report_error) : Newly + added, to report errors using e_error_run. Also a list of error-ids is + added. + * exchange-config-listener.c (account_added) (account_removed) : + Modified the usage of e_notice to e_error_run. Also the error from + exchange_account_connect is reported using + exchange_operations_report_error. + * exchange-account-setup.c (btn_chpass_clicked) + (org_gnome_exchange_settings) (print_error) (set_oof_info): Changed to + use exchange_operations_report_error and e_error_run functions. + * org-gnome-exchange-operations.error.xml : Newly added, defines + the list of error messages used in the plugin. + * Makefile.am : Modified for org-gnome-exchange-operations.error.xml + 2005-07-11 Shakti Sen * Makefile.am: Included files exchange-folder-subscription.c, diff --git a/plugins/exchange-operations/Makefile.am b/plugins/exchange-operations/Makefile.am index 727560fc72..1d270478bb 100644 --- a/plugins/exchange-operations/Makefile.am +++ b/plugins/exchange-operations/Makefile.am @@ -55,9 +55,14 @@ glade_DATA = \ exchange-folder-tree.glade \ exchange-permissions-dialog.glade +error_DATA = org-gnome-exchange-operations.error +errordir = $(privdatadir)/errors + EXTRA_DIST = \ org-gnome-exchange-operations.eplug.in \ + org-gnome-exchange-operations.error.xml \ org-gnome-folder-permissions.xml \ org-gnome-folder-subscription.xml \ - $(glade_DATA) + $(glade_DATA) +BUILT_SOURCES = $(error_DATA) diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index aeb0e2ea5f..1d32b096c8 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -48,6 +48,7 @@ #include "mail/em-config.h" #include "exchange-delegates.h" +#define ERROR_DOMAIN "org-gnome-exchange-operations" GtkWidget* org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data); GtkWidget *org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data); @@ -116,6 +117,7 @@ btn_chpass_clicked (GtkButton *button, gpointer data) { ExchangeAccount *account; char *old_password, *new_password; + ExchangeAccountResult result; account = exchange_operations_get_exchange_account (); @@ -126,7 +128,8 @@ btn_chpass_clicked (GtkButton *button, gpointer data) } new_password = exchange_get_new_password (old_password, TRUE); g_print ("Current password is \"%s\"\n", old_password); - exchange_account_set_password (account, old_password, new_password); + result = exchange_account_set_password (account, old_password, new_password); + exchange_operations_report_error (account, result); g_free (old_password); g_free (new_password); @@ -226,8 +229,9 @@ org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data) /* See if oof info found already */ if (!exchange_oof_get (account, &oof_state, &message)) { - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not read out-of-office state")); */ + + e_error_run (NULL, ERROR_DOMAIN ":state-read-error", NULL); + return NULL; } @@ -365,90 +369,48 @@ print_error (const char *owa_url, E2kAutoconfigResult result) switch (result) { case E2K_AUTOCONFIG_CANT_CONNECT: - if (!strncmp (owa_url, "http:", 5)) { - old = "http"; - new = "https"; - } else { - old = "https"; - new = "http"; - } - - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not connect to the Exchange " - "server.\nMake sure the URL is correct " - "(try \"%s\" instead of \"%s\"?) " - "and try again."), new, old); - */ - break; + if (!strncmp (owa_url, "http:", 5)) { + old = "http"; + new = "https"; + } else { + old = "https"; + new = "http"; + } + + e_error_run (NULL, ERROR_DOMAIN ":account-connect-error", "", NULL); + + break; case E2K_AUTOCONFIG_CANT_RESOLVE: - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not locate Exchange server.\n" - "Make sure the server name is spelled correctly " - "and try again.")); - */ - break; + + e_error_run (NULL, ERROR_DOMAIN ":account-resolve-error", "", NULL); + break; case E2K_AUTOCONFIG_AUTH_ERROR: case E2K_AUTOCONFIG_AUTH_ERROR_TRY_NTLM: case E2K_AUTOCONFIG_AUTH_ERROR_TRY_BASIC: - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not authenticate to the Exchange " - "server.\nMake sure the username and " - "password are correct and try again.")); - */ + e_error_run (NULL, ERROR_DOMAIN ":password-incorrect", NULL); break; case E2K_AUTOCONFIG_AUTH_ERROR_TRY_DOMAIN: - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not authenticate to the Exchange " - "server.\nMake sure the username and " - "password are correct and try again.\n\n" - "You may need to specify the Windows " - "domain name as part of your username " - "(eg, \"MY-DOMAIN\\%s\")."), - ac->username); - */ + e_error_run (NULL, ERROR_DOMAIN ":account-domain-error", NULL); break; case E2K_AUTOCONFIG_NO_OWA: case E2K_AUTOCONFIG_NOT_EXCHANGE: - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not find OWA data at the indicated URL.\n" - "Make sure the URL is correct and try again.")); - */ + e_error_run (NULL, ERROR_DOMAIN ":account-wss-error", NULL); break; case E2K_AUTOCONFIG_CANT_BPROPFIND: - /* SURF : e_notice ( - NULL, GTK_MESSAGE_ERROR, - _("Ximian Connector requires access to certain " - "functionality on the Exchange Server that appears " - "to be disabled or blocked. (This is usually " - "unintentional.) Your Exchange Administrator will " - "need to enable this functionality in order for " - "you to be able to use Ximian Connector.\n\n" - "For information to provide to your Exchange " - "administrator, please follow the link below:\n" - "http://support.novell.com/cgi-bin/search/searchtid.cgi?/ximian/ximian328.html ")); - */ + e_error_run (NULL, ERROR_DOMAIN ":connect-exchange-error", NULL); break; case E2K_AUTOCONFIG_EXCHANGE_5_5: - /* SURF : e_notice ( - NULL, GTK_MESSAGE_ERROR, - _("The Exchange server URL you provided is for an " - "Exchange 5.5 Server. Ximian Connector supports " - "Microsoft Exchange 2000 and 2003 only.")); - */ + e_error_run (NULL, ERROR_DOMAIN ":account-version-error", NULL); break; default: - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not configure Exchange account because " - "an unknown error occurred. Check the URL, " - "username, and password, and try again.")); - */ + e_error_run (NULL, ERROR_DOMAIN ":configure-error", NULL); break; } @@ -732,8 +694,8 @@ set_oof_info () } if (!exchange_oof_set (account, oof_data->state, oof_data->message)) { - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("Could not update out-of-office state")); */ + + e_error_run (NULL, ERROR_DOMAIN ":state-update-error", NULL); } } diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c index 7991a7d956..bb85a07802 100644 --- a/plugins/exchange-operations/exchange-config-listener.c +++ b/plugins/exchange-operations/exchange-config-listener.c @@ -27,6 +27,7 @@ #endif #include "exchange-config-listener.h" +#include "exchange-operations.h" #include #include @@ -34,9 +35,8 @@ #include #include #include -// SURF : #include "mail-stub-listener.h" -// SURF : #include +#include #include #include @@ -833,6 +833,7 @@ account_added (EAccountList *account_list, EAccount *account) { ExchangeConfigListener *config_listener; ExchangeAccount *exchange_account; + ExchangeAccountResult result; if (!is_active_exchange_account (account)) return; @@ -840,9 +841,7 @@ account_added (EAccountList *account_list, EAccount *account) config_listener = EXCHANGE_CONFIG_LISTENER (account_list); if (config_listener->priv->configured_account) { /* Multiple accounts configured. */ - /* SURF : e_notice (NULL, GTK_MESSAGE_ERROR, - _("You may only configure a single Exchange account")); - */ + e_error_run (NULL, "org-gnome-exchange-operations:single-account-error", NULL); return; } @@ -872,7 +871,8 @@ account_added (EAccountList *account_list, EAccount *account) g_signal_emit (config_listener, signals[EXCHANGE_ACCOUNT_CREATED], 0, exchange_account); add_sources (exchange_account); - exchange_account_connect (exchange_account); + exchange_account_connect (exchange_account, NULL, &result); + exchange_operations_report_error (exchange_account, result); add_new_sources (exchange_account); } @@ -1036,10 +1036,7 @@ account_changed (EAccountList *account_list, EAccount *account) remove_account_esources (priv->exchange_account); /* Nope. Let the user know we're ignoring him. */ - /* SURF : e_notice (NULL, GTK_MESSAGE_WARNING, - _("Changes to Exchange account configuration will " - "take\nplace after you quit and restart Evolution.")); - */ + e_error_run (NULL, "org-gnome-exchange-operations:apply-restart", NULL); /* But note the new URI so if he changes something else, we * only warn again if he changes again. @@ -1083,15 +1080,11 @@ account_removed (EAccountList *account_list, EAccount *account) priv->configured_name = NULL; } else { if (account->enabled) { - /* SURF : e_notice (NULL, GTK_MESSAGE_INFO, - _("The Exchange account will be removed when you quit Evolution")); - */ + e_error_run (NULL, "org-gnome-exchange-operations:remove-quit", NULL); } else { /* The account is in use. We can't remove it. */ - /* SURF : e_notice (NULL, GTK_MESSAGE_INFO, - _("The Exchange account will be disabled when you quit Evolution")); - */ + e_error_run (NULL, "org-gnome-exchange-operations:disable-quit", NULL); } } } diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c index d5f479cebc..b37473ae50 100644 --- a/plugins/exchange-operations/exchange-operations.c +++ b/plugins/exchange-operations/exchange-operations.c @@ -22,9 +22,29 @@ #include #include "exchange-operations.h" +#include ExchangeConfigListener *exchange_global_config_listener=NULL; +static char *error_ids[] = { "config-error", + "password-weak-error", + "password-change-error", + "password-change-success", + "account-offline", + "password-incorrect", + "account-domain-error", + "account-mailbox-na", + "account-version-error", + "account-wss-error", + "account-no-mailbox", + "account-resolve-error", + "account-connect-error", + "password-expired", + "account-unknown-error", + "account-quota-error", + "account-quota-send-error", + "account-quota-warn" }; + static void free_exchange_listener (void) { @@ -166,3 +186,31 @@ exchange_operations_get_exchange_account (void) return account; } +void +exchange_operations_report_error (ExchangeAccount *account, ExchangeAccountResult result) +{ + gchar *error_string; + + g_return_if_fail (account != NULL); + + error_string = g_strconcat ("org-gnome-exchange-operations:", error_ids[result], NULL); + + switch (result) { + case EXCHANGE_ACCOUNT_MAILBOX_NA: + e_error_run (NULL, error_string, exchange_account_get_username (account), NULL); + break; + case EXCHANGE_ACCOUNT_NO_MAILBOX: + e_error_run (NULL, error_string, exchange_account_get_username (account), + account->exchange_server, NULL); + break; + case EXCHANGE_ACCOUNT_RESOLVE_ERROR: + case EXCHANGE_ACCOUNT_CONNECT_ERROR: + case EXCHANGE_ACCOUNT_UNKNOWN_ERROR: + e_error_run (NULL, error_string, account->exchange_server, NULL); + break; + default: + e_error_run (NULL, error_string, NULL); + } + g_free (error_string); +} + diff --git a/plugins/exchange-operations/exchange-operations.h b/plugins/exchange-operations/exchange-operations.h index 5b4fe3a577..bf41b3088f 100644 --- a/plugins/exchange-operations/exchange-operations.h +++ b/plugins/exchange-operations/exchange-operations.h @@ -26,6 +26,7 @@ #include "e-util/e-plugin.h" #include "exchange-config-listener.h" +#include #ifdef __cplusplus extern "C" { @@ -43,6 +44,8 @@ gboolean exchange_operations_tokenize_string (char **string, char *token, char d gboolean exchange_operations_cta_add_node_to_tree (GtkTreeStore *store, GtkTreeIter *parent, const char *nuri); void exchange_operations_cta_select_node_from_tree (GtkTreeStore *store, GtkTreeIter *parent, const char *nuri, const char *ruri, GtkTreeSelection *selection) ; +void exchange_operations_report_error (ExchangeAccount *account, ExchangeAccountResult result); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.error.xml b/plugins/exchange-operations/org-gnome-exchange-operations.error.xml new file mode 100644 index 0000000000..b89d106279 --- /dev/null +++ b/plugins/exchange-operations/org-gnome-exchange-operations.error.xml @@ -0,0 +1,142 @@ + + + + + <_primary>You may only configure a single Exchange account. + + + + <_primary>Please restart Evolution + <_secondary>Changes to Exchange account configuration will take place after you quit and restart Evolution. + + + + <_primary>The Exchange account will be removed when you quit Evolution + + + + <_primary>The Exchange account will be disabled when you quit Evolution + + + + <_primary>Could not read out-of-office state + + + + <_primary>Could not update out-of-office state + + + + <_primary>Cannot change password due to configuration problems. + + + + <_primary>Server rejected password because it is too weak. + <_secondary>Try again with a different password. + + + + <_primary>Could not change password. + + + + <_primary>Password successfully changed. + + + + <_primary>Exchange Account is offline. + <_secondary>Cannot display folders. + + + + <_primary>Could not authenticate to server. + <_secondary>Make sure the username and password are correct and try again. + + + + <_primary>Could not authenticate to server. + <_secondary xml:space="preserve">This probably means that your server requires +you to specify the Windows domain name +as part of your username (eg, "DOMAIN\user"). + +Or you might have just typed your password wrong. + + + + <_primary>Mailbox for {0} is not on this server. + + + + <_primary>The Exchange server is not compatible with Exchange Connector. + <_secondary xml:space="preserve">The server is runinng Exchange 5.5. Exchange Connector +supports Microsoft Exchange 2000 and 2003 only. + + + + <_primary>Could not find Exchange Web Storage System. + <_secondary>If OWA is running on a different path, you must specify that in the account configuration dialog. + + + + <_primary>No mailbox for user {0} on {1}. + + + + <_primary>Could not locate server {0}. + <_secondary>Make sure the server name is spelled correctly and try again. + + + + <_primary>Could not connect to server {0}. + <_secondary>Make sure the URL is correct and try again. + + + + <_primary>Your password has expired. + + + + <_primary>Could not connect to server {0}. + <_secondary>Unknown error. + + + + <_primary>You have exceeded your quota for storing mails on this server. + <_secondary>You will not be able to either send or recieve mails now. + + + + <_primary>You are nearing your quota available for storing mails on this server. + <_secondary>You will not be able to send mails till you clear up some space by deleting some mails. + + + + <_primary>You are nearing your quota available for storing mails on this server. + <_secondary>Try to clear up some space by deleting some mails. + + + + <_primary>Exchange Connector access error. + <_secondary xml:space="preserve">Exchange Connector requires access to certain +functionality on the Exchange Server that appears +to be disabled or blocked. (This is usually +unintentional.) Your Exchange Administrator will +need to enable this functionality in order for +you to be able to use Ximian Connector. + +For information to provide to your Exchange +administrator, please follow the link below: + +http://support.novell.com/cgi-bin/search/searchtid.cgi?/ximian/ximian328.html + + + + + <_secondary xml:space="preserve">Could not configure Exchange account because +an unknown error occurred. Check the URL, +username, and password, and try again. + + + + + -- cgit v1.2.3