From db57306c760e424b2baceadb236c452289acbbd7 Mon Sep 17 00:00:00 2001 From: Sankar P Date: Fri, 15 Jul 2005 09:37:38 +0000 Subject: Put permissions on the store instead of the global structure as it gets 2005-07-15 Sankar P * proxy-login.c: Put permissions on the store instead of the global structure as it gets unref before store_add. svn path=/trunk/; revision=29776 --- plugins/proxy-login/ChangeLog | 5 +++++ plugins/proxy-login/proxy-login.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/proxy-login/ChangeLog b/plugins/proxy-login/ChangeLog index 4ac0d14abd..400caadc7e 100644 --- a/plugins/proxy-login/ChangeLog +++ b/plugins/proxy-login/ChangeLog @@ -1,3 +1,8 @@ +2005-07-15 Sankar P + + * proxy-login.c: Put permissions on the store instead of the + global structure as it gets unref before store_add. + 2005-07-14 Not Zed * proxy-login.c (proxy_login_add_new_store): fixed the store diff --git a/plugins/proxy-login/proxy-login.c b/plugins/proxy-login/proxy-login.c index 090f23d4b1..57970ea171 100644 --- a/plugins/proxy-login/proxy-login.c +++ b/plugins/proxy-login/proxy-login.c @@ -146,7 +146,6 @@ proxy_login_init (GObject *object) priv = g_new0 (proxyLoginPrivate, 1); prd->priv = priv; - prd->permissions = 0; prd->proxy_list = NULL; priv->xml = NULL; priv->main = NULL; @@ -323,6 +322,7 @@ proxy_soap_login (char *email) char *proxy_source_url = NULL, *parent_source_url = NULL ; char *name; int i; + int permissions = 0; for (i=0; email[i]!='\0' && email[i]!='@' ; i++); if (email[i]=='@') @@ -335,9 +335,8 @@ proxy_soap_login (char *email) srcAccount = pld->account; cnc = proxy_login_get_cnc(srcAccount); proxy_get_password (srcAccount, &user_name, &password); - pld->permissions = 0; - proxy_cnc = e_gw_connection_get_proxy_connection (cnc, user_name, password, email, &pld->permissions); - + proxy_cnc = e_gw_connection_get_proxy_connection (cnc, user_name, password, email, &permissions); + if (proxy_cnc) { parent = camel_url_new (e_account_get_string(srcAccount, E_ACCOUNT_SOURCE_URL), NULL); parent_source_url = camel_url_to_string (parent, CAMEL_URL_HIDE_PASSWORD); @@ -355,6 +354,7 @@ proxy_soap_login (char *email) e_account_list_add(accounts, dstAccount); e_account_list_change (accounts, srcAccount); e_account_list_save(accounts); + g_object_set_data ((GObject *)dstAccount, "permissions", permissions); mail_get_store(e_account_get_string(dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); g_free (proxy_source_url); @@ -376,15 +376,14 @@ proxy_login_add_new_store (char *uri, CamelStore *store, void *user_data) { MailComponent *component = mail_component_peek (); EAccount *account = user_data; + int permissions = g_object_get_data ((GObject *)account, "permissions"); + if (store == NULL) return; - if (pld->permissions & E_GW_PROXY_MAIL_READ) - store->mode |= CAMEL_STORE_READ; - if (pld->permissions & E_GW_PROXY_MAIL_WRITE) - store->mode |= CAMEL_STORE_WRITE; + if (!(permissions & E_GW_PROXY_MAIL_WRITE)) + store->mode &= !CAMEL_STORE_WRITE; - store->mode = pld->permissions; store->flags |= CAMEL_STORE_PROXY; mail_component_add_store (component, store, account->name); } -- cgit