evolution/bnc-160049-change-gw-passwd-no-auth-prompt.patch

130 lines
3.8 KiB
Diff

Index: calendar/common/authentication.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/common/authentication.c,v
retrieving revision 1.10
diff -u -p -r1.10 authentication.c
--- calendar/common/authentication.c 23 Feb 2005 18:56:56 -0000 1.10
+++ calendar/common/authentication.c 24 Mar 2006 15:33:25 -0000
@@ -29,6 +29,7 @@
#include <bonobo/bonobo-i18n.h>
#include <libedataserverui/e-passwords.h>
#include "authentication.h"
+#include <libedataserver/e-url.h>
static GHashTable *source_lists_hash = NULL;
@@ -52,6 +53,44 @@ auth_func_cb (ECal *ecal, const char *pr
NULL);
return password;
+}
+
+static char *
+build_pass_key (ECal *ecal)
+{
+ char *euri_str;
+ const char *uri;
+ EUri *euri;
+
+ uri = e_cal_get_uri (ecal);
+
+ euri = e_uri_new (uri);
+ euri_str = e_uri_to_string (euri, FALSE);
+
+ e_uri_free (euri);
+ return euri_str;
+}
+
+void
+auth_cal_forget_password (ECal *ecal)
+{
+ ESource *source = NULL;
+ const char *auth_domain = NULL, *component_name = NULL, *auth_type = NULL;
+ char *key = NULL;
+
+ source = e_cal_get_source (ecal);
+ auth_domain = e_source_get_property (source, "auth-domain");
+ component_name = auth_domain ? auth_domain : "Calendar";
+
+ auth_type = e_source_get_property (source, "auth-type");
+ if (auth_type)
+ key = build_pass_key (ecal);
+ else
+ key = e_source_get_uri (source);
+
+ e_passwords_forget_password (component_name, key);
+
+ g_free (key);
}
ECal *
Index: calendar/common/authentication.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/common/authentication.h,v
retrieving revision 1.2
diff -u -p -r1.2 authentication.h
--- calendar/common/authentication.h 4 Feb 2004 21:31:57 -0000 1.2
+++ calendar/common/authentication.h 24 Mar 2006 15:33:25 -0000
@@ -30,5 +30,6 @@
ECal *auth_new_cal_from_default (ECalSourceType type);
ECal *auth_new_cal_from_source (ESource *source, ECalSourceType type);
ECal *auth_new_cal_from_uri (const char *uri, ECalSourceType type);
+void auth_cal_forget_password (ECal *ecal);
#endif
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.398
diff -u -p -r1.398 gnome-cal.c
--- calendar/gui/gnome-cal.c 6 Mar 2006 07:20:00 -0000 1.398
+++ calendar/gui/gnome-cal.c 24 Mar 2006 15:33:26 -0000
@@ -2366,6 +2366,10 @@ client_cal_opened_cb (ECal *ecal, ECalen
default:
break;
}
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED && source_type == E_CAL_SOURCE_TYPE_EVENT)
+ auth_cal_forget_password (ecal);
+
switch (status) {
case E_CALENDAR_STATUS_OK:
break;
@@ -2459,6 +2463,9 @@ default_client_cal_opened_cb (ECal *ecal
break;
}
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED && source_type == E_CAL_SOURCE_TYPE_EVENT)
+ auth_cal_forget_password (ecal);
+
switch (status) {
case E_CALENDAR_STATUS_OK:
break;
Index: calendar/gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.130
diff -u -p -r1.130 e-tasks.c
--- calendar/gui/e-tasks.c 3 Mar 2006 13:24:39 -0000 1.130
+++ calendar/gui/e-tasks.c 24 Mar 2006 15:33:26 -0000
@@ -876,6 +876,9 @@ client_cal_opened_cb (ECal *ecal, ECalen
priv = tasks->priv;
source = e_cal_get_source (ecal);
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+ auth_cal_forget_password (ecal);
switch (status) {
case E_CALENDAR_STATUS_OK :
@@ -921,6 +924,9 @@ default_client_cal_opened_cb (ECal *ecal
priv = tasks->priv;
source = e_cal_get_source (ecal);
+
+ if (status == E_CALENDAR_STATUS_AUTHENTICATION_FAILED)
+ auth_cal_forget_password (ecal);
switch (status) {
case E_CALENDAR_STATUS_OK :