Re: [evolution-patches] Proxy Login Patches
- From: Shreyas <sshreyas novell com>
- To: psankar novell com
- Cc: Evolution Patches <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] Proxy Login Patches
- Date: Wed, 06 Jul 2005 15:58:05 +0530
oops accidentally included libedataserver/e-proxy.h. Instead of
e-util/e-proxy.h
Attaching the patch with that change.
Thanks,
Shreyas
On Wed, 2005-07-06 at 11:51 +0530, Shreyas wrote:
> Hey,
>
> Attaching a list of patches which implement the proxy login feature on a
> Groupwise Account.
>
> I created multiple patches hoping that it would be easier to review as
> the code transcends multiple regions. Pardon me if that's a wrong
> assumption. There are Changlelog entries within the patches as per
> rules
>
> proxy-login-enablers.diff : contains changes to
> -EAccount structure
> - New API's to EAccountList to handle proxy removal/ handling parent's
> deletion
> etc
> - A permissions variable on a CamelStore which checks for ReadOnly/
> Writeable Stores at proxy login.
> - e-msg-composer-hdrs.c: Disable loading e-mail id's in the from
> section whose
> store's dont have write permissions
>
> proxy-camel-groupwise.diff: contains changes to
> - camel-groupwise-folder.c: Use GetItems instead of GetQM
> - camel-groupwise-store.c: Dont ask password for proxy login.
>
> proxy-login.diff: Is the plugin which implements the actual login ui and
> calls suitable API.
>
> Cheers,
> Shreyas
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.544
diff -u -p -w -r1.544 ChangeLog
--- e-util/ChangeLog 18 Jun 2005 15:59:56 -0000 1.544
+++ e-util/ChangeLog 5 Jul 2005 09:31:12 -0000
@@ -1,3 +1,9 @@
+2005-07-05 Shreyas Srinivasan
+
+ * e-util/e-account.[ch]: Add structures to handle proxies.
+ * e-util/e-account-list.[ch]: Add functions to remove proxy
+ accounts and account's proxies.
+
2005-06-18 Tor Lillqvist <tml novell com>
* Makefile.am (WIN32_BOOTSTRAP_LIBS): Use bootstrap library for
Index: e-util/e-account.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.h,v
retrieving revision 1.9
diff -u -p -w -r1.9 e-account.h
--- e-util/e-account.h 8 Apr 2005 04:34:04 -0000 1.9
+++ e-util/e-account.h 5 Jul 2005 09:31:29 -0000
@@ -69,6 +69,9 @@ typedef enum _e_account_item_t {
E_ACCOUNT_SMIME_ENCRYPT_TO_SELF,
E_ACCOUNT_SMIME_ENCRYPT_DEFAULT,
+ E_ACCOUNT_PROXY_PARENT_URL,
+ E_ACCOUNT_PROXY_PARENT_UID,
+
E_ACCOUNT_ITEM_LAST
} e_account_item_t;
@@ -98,6 +101,11 @@ typedef struct _EAccountService {
gboolean save_passwd;
} EAccountService;
+typedef struct _EAccountProxyInfo {
+ char *parent_url;
+ char *parent_uid;
+} EAccountProxyInfo;
+
typedef struct _EAccount {
GObject parent_object;
@@ -109,6 +117,7 @@ typedef struct _EAccount {
EAccountIdentity *id;
EAccountService *source;
EAccountService *transport;
+ EAccountProxyInfo *proxy_account;
char *drafts_folder_uri, *sent_folder_uri;
@@ -130,6 +139,7 @@ typedef struct _EAccount {
gboolean smime_sign_default;
gboolean smime_encrypt_to_self;
gboolean smime_encrypt_default;
+ GList *proxy_children;
} EAccount;
typedef struct {
Index: e-util/e-account.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.c,v
retrieving revision 1.15
diff -u -p -w -r1.15 e-account.c
--- e-util/e-account.c 8 Apr 2005 04:34:04 -0000 1.15
+++ e-util/e-account.c 5 Jul 2005 09:32:58 -0000
@@ -107,6 +107,10 @@ e_account_init (EAccount *account)
account->id = g_new0 (EAccountIdentity, 1);
account->source = g_new0 (EAccountService, 1);
account->transport = g_new0 (EAccountService, 1);
+ account->proxy_account = g_new0 (EAccountProxyInfo, 1);
+
+ account->proxy_account->parent_url = NULL;
+ account->proxy_account->parent_uid = NULL;
account->source->auto_check = FALSE;
account->source->auto_check_time = 10;
@@ -139,6 +143,17 @@ service_destroy (EAccountService *servic
}
static void
+proxy_destroy (EAccountProxyInfo *proxy_info)
+{
+ if (proxy_info->parent_url)
+ g_free (proxy_info->parent_url);
+ if (proxy_info->parent_uid)
+ g_free (proxy_info->parent_uid);
+
+ g_free (proxy_info);
+}
+
+static void
e_account_finalize (GObject *object)
{
EAccount *account = E_ACCOUNT (object);
@@ -149,7 +164,11 @@ e_account_finalize (GObject *object)
identity_destroy (account->id);
service_destroy (account->source);
service_destroy (account->transport);
+ proxy_destroy (account->proxy_account);
+ g_list_foreach (account->proxy_children, (GFunc) g_free, NULL);
+ g_list_free (account->proxy_children);
+ account->proxy_children = NULL;
g_free (account->drafts_folder_uri);
g_free (account->sent_folder_uri);
@@ -486,6 +505,17 @@ e_account_set_from_xml (EAccount *accoun
}
}
}
+ } else if (!strcmp (node->name, "proxy")) {
+ if (node->children) {
+ for (cur = node->children; cur; cur = cur->next) {
+ if (!strcmp (cur->name, "parent-source-url")) {
+ changed |= xml_set_content (cur, &account->proxy_account->parent_url);
+ } else if (!strcmp (cur->name, "parent-uid")) {
+ changed |= xml_set_content (cur, &account->proxy_account->parent_uid);
+ break;
+ }
+ }
+ }
}
}
@@ -564,6 +594,7 @@ e_account_import (EAccount *dest, EAccou
g_free (dest->smime_encrypt_key);
dest->smime_encrypt_key = g_strdup (src->smime_encrypt_key);
+ dest->proxy_children = g_list_copy(src->proxy_children);
g_signal_emit(dest, signals[CHANGED], 0, -1);
}
@@ -652,6 +683,12 @@ e_account_to_xml (EAccount *account)
if (account->smime_encrypt_key)
xmlNewTextChild (node, NULL, "encrypt-key-id", account->smime_encrypt_key);
+ if (account->proxy_account && account->proxy_account->parent_url) {
+ node = xmlNewChild (root, NULL, "proxy", NULL);
+ xmlNewTextChild (node, NULL, "parent-source-url", account->proxy_account->parent_url);
+ xmlNewTextChild (node, NULL, "parent-uid", account->proxy_account->parent_uid);
+ }
+
xmlDocDumpMemory (doc, &xmlbuf, &n);
xmlFreeDoc (doc);
@@ -778,6 +815,9 @@ static struct _account_info {
{ /* E_ACCOUNT_SMIME_SIGN_DEFAULT */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, smime_sign_default) },
{ /* E_ACCOUNT_SMIME_ENCRYPT_TO_SELF */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, smime_encrypt_to_self) },
{ /* E_ACCOUNT_SMIME_ENCRYPT_DEFAULT */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, smime_encrypt_default) },
+
+ { /* E_ACCOUNT_PROXY_PARENT_URL, */ 0, TYPE_STRING|TYPE_STRUCT, G_STRUCT_OFFSET(EAccount, proxy_account), G_STRUCT_OFFSET(EAccountProxyInfo, parent_url) },
+ { /* E_ACCOUNT_PROXY_PARENT_UID, */ 0, TYPE_STRING|TYPE_STRUCT, G_STRUCT_OFFSET(EAccount, proxy_account), G_STRUCT_OFFSET(EAccountProxyInfo, parent_uid) },
};
static GHashTable *ea_option_table;
Index: e-util/e-account-list.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account-list.h,v
retrieving revision 1.4
diff -u -p -w -r1.4 e-account-list.h
--- e-util/e-account-list.h 31 Mar 2004 10:08:38 -0000 1.4
+++ e-util/e-account-list.h 5 Jul 2005 09:33:13 -0000
@@ -71,5 +71,7 @@ void e_account_list_remove
const EAccount *e_account_list_get_default(EAccountList *);
void e_account_list_set_default(EAccountList *, EAccount *);
const EAccount *e_account_list_find (EAccountList *, e_account_find_t type, const char *key);
+void e_account_list_prune_proxies (EAccountList *);
+void e_account_list_update_parent (EAccountList *, EAccount *);
#endif /* __E_ACCOUNT_LIST__ */
Index: e-util/e-account-list.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account-list.c,v
retrieving revision 1.10
diff -u -p -w -r1.10 e-account-list.c
--- e-util/e-account-list.c 21 Dec 2004 15:50:38 -0000 1.10
+++ e-util/e-account-list.c 5 Jul 2005 09:33:32 -0000
@@ -293,6 +293,56 @@ e_account_list_save (EAccountList *accou
gconf_client_suggest_sync (account_list->priv->gconf, NULL);
}
+void
+e_account_list_prune_proxies (EAccountList *account_list)
+{
+ EAccount *account;
+ EIterator *iter;
+
+ for (iter = e_list_get_iterator (E_LIST (account_list));
+ e_iterator_is_valid (iter);
+ e_iterator_next (iter)) {
+ account = (EAccount *)e_iterator_get (iter);
+ if (account->proxy_account->parent_url) {
+ e_account_list_remove (account_list, account);
+ e_account_list_save (account_list);
+ }
+ }
+ g_object_unref (iter);
+}
+
+void
+e_account_list_update_parent (EAccountList *accounts, EAccount *account)
+{
+ char *parent = NULL;
+ EAccount *parent_account;
+
+ parent = e_account_get_string (account, E_ACCOUNT_PROXY_PARENT_URL);
+ parent_account = e_account_list_find (accounts, E_ACCOUNT_FIND_UID, account->proxy_account->parent_uid);
+ if (parent_account) {
+ parent_account->proxy_children = g_list_remove (parent_account->proxy_children, account->uid);
+ e_account_list_change (accounts, parent_account);
+ }
+}
+
+void
+e_account_list_remove_account_proxies (EAccountList *accounts, EAccount *account)
+{
+ int i,n;
+ EAccount *child_account;
+ char *uid;
+
+ n = g_list_length (account->proxy_children);
+ for (i=0; i<n; i++) {
+ uid = g_list_nth_data(account->proxy_children, i);
+ child_account = e_account_list_find (accounts, E_ACCOUNT_FIND_UID, uid);
+ e_account_list_remove (accounts, child_account);
+ e_account_list_save (accounts);
+ account->proxy_children = g_list_remove (account->proxy_children, uid);
+ }
+ g_list_free (account->proxy_children);
+ e_account_list_save (accounts);
+}
/**
* e_account_list_add:
* @accounts:
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3649
diff -u -p -w -r1.3649 ChangeLog
--- mail/ChangeLog 1 Jul 2005 03:29:22 -0000 1.3649
+++ mail/ChangeLog 5 Jul 2005 10:33:10 -0000
@@ -1,3 +1,13 @@
+2005-07-05 Shreyas Srinivasan <sshreyas novell com>
+
+ * mail-config.[ch]: Add new functions to remove proxy accounts and
+ proxies created by the account.
+ * mail-compnent.c: Remove proxy accounts at startup
+ * mail.error.xml: Add warnings for proxy disable and removal of a
+ proxy when its parents are removed.
+ * em-account-prefs.c: Add checks not to display proxies and
+ handling of parent removal/ disabling.
+
2005-06-24 Matt Brown <matt mattb net nz>
* em-inline-filter.c: implement extraction of inline signed/encrypted pgp
Index: mail/mail-config.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.h,v
retrieving revision 1.119
diff -u -p -w -r1.119 mail-config.h
--- mail/mail-config.h 19 Oct 2004 06:35:44 -0000 1.119
+++ mail/mail-config.h 5 Jul 2005 10:33:42 -0000
@@ -133,6 +133,9 @@ struct _EAccountList *mail_config_get_ac
void mail_config_add_account (struct _EAccount *account);
void mail_config_remove_account (struct _EAccount *account);
void mail_config_set_default_account (struct _EAccount *account);
+void mail_config_update_parent (struct _EAccount *account);
+void mail_config_remove_account_proxies (struct _EAccount *account);
+void mail_config_prune_proxies (void);
struct _EAccountIdentity *mail_config_get_default_identity (void);
struct _EAccountService *mail_config_get_default_transport (void);
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.317
diff -u -p -w -r1.317 mail-config.c
--- mail/mail-config.c 23 Jun 2005 09:11:06 -0000 1.317
+++ mail/mail-config.c 5 Jul 2005 10:33:53 -0000
@@ -671,6 +671,25 @@ mail_config_get_account_by_transport_url
return NULL;
}
+
+void
+mail_config_update_parent (EAccount *account)
+{
+ e_account_list_update_parent (config->accounts, account);
+}
+
+void
+mail_config_remove_account_proxies (EAccount *account)
+{
+ e_account_list_remove_account_proxies (config->accounts, account);
+}
+
+void
+mail_config_prune_proxies (void)
+{
+ e_account_list_prune_proxies (config->accounts);
+}
+
EAccountList *
mail_config_get_accounts (void)
{
Index: mail/mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.120
diff -u -p -w -r1.120 mail-component.c
--- mail/mail-component.c 23 Jun 2005 09:11:06 -0000 1.120
+++ mail/mail-component.c 5 Jul 2005 10:34:12 -0000
@@ -359,6 +359,7 @@ mc_startup(MailComponent *mc)
started = 1;
mc_setup_local_store(mc);
+ mail_config_prune_proxies ();
load_accounts(mc, mail_config_get_accounts());
vfolder_load_storage();
}
Index: mail/mail.error.xml
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail.error.xml,v
retrieving revision 1.3
diff -u -p -w -r1.3 mail.error.xml
--- mail/mail.error.xml 7 Jun 2005 05:05:43 -0000 1.3
+++ mail/mail.error.xml 5 Jul 2005 10:34:29 -0000
@@ -249,6 +249,25 @@ The message is stored in the Outbox fold
<button stock="gtk-no" _label="Don't delete" response="GTK_RESPONSE_NO"/>
</error>
+<error id="ask-delete-account-with-proxies" type="question" default="GTK_RESPONSE_NO" modal="true">
+ <_title>Delete account?</_title>
+ <_primary>Are you sure you want to delete this account and all its proxies?</_primary>
+ <_secondary xml:space="preserve">If you proceed, the account information and
+all proxy information will be deleted permanently.</_secondary>
+ <button stock="gtk-delete" response="GTK_RESPONSE_YES"/>
+ <button stock="gtk-no" _label="Don't delete" response="GTK_RESPONSE_NO"/>
+ </error>
+
+<error id="ask-delete-proxy-accounts" type="question" default="GTK_RESPONSE_NO" modal="true">
+ <_title>Disable account and log out all proxies?</_title>
+ <_primary>Are you sure you want to disable?</_primary>
+ <_secondary xml:space="preserve">If you proceed, the account will be disabled
+and all its proxies will be logged out.</_secondary>
+ <button stock="gtk-ok" response="GTK_RESPONSE_YES"/>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_NO"/>
+ </error>
+
+
<error id="no-save-signature" type="error">
<_primary>Could not save signature file.</_primary>
<_secondary xml:space="preserve">Because "{0}".</_secondary>
Index: mail/em-account-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-prefs.c,v
retrieving revision 1.19
diff -u -p -w -r1.19 em-account-prefs.c
--- mail/em-account-prefs.c 16 May 2005 06:15:37 -0000 1.19
+++ mail/em-account-prefs.c 5 Jul 2005 10:34:50 -0000
@@ -192,7 +192,7 @@ account_edit_clicked (GtkButton *button,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, 3, &account, -1);
- if (account) {
+ if (account && !account->proxy_account->parent_url && !g_list_length(account->proxy_children)) {
EMAccountEditor *emae;
/** @HookPoint-EMConfig: Mail Account Editor
@@ -227,6 +227,7 @@ account_delete_clicked (GtkButton *butto
GtkTreeModel *model;
GtkTreeIter iter;
int ans;
+ gboolean has_spawned_proxies = FALSE;
selection = gtk_tree_view_get_selection (prefs->table);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -236,7 +237,11 @@ account_delete_clicked (GtkButton *butto
if (account == NULL || prefs->editor != NULL)
return;
+ if (g_list_length(account->proxy_children))
+ ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-account-with-proxies",NULL);
+ else
ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-account", NULL);
+
if (ans == GTK_RESPONSE_YES) {
int len;
@@ -244,6 +249,12 @@ account_delete_clicked (GtkButton *butto
if (account->enabled && account->source && account->source->url)
mail_component_remove_store_by_uri (mail_component_peek (), account->source->url);
+ /* remove all the proxies you created*/
+ if (g_list_length (account->proxy_children)) {
+ has_spawned_proxies = TRUE;
+ mail_config_remove_account_proxies(account);
+ }
+
/* remove it from the config file */
mail_config_remove_account (account);
accounts = mail_config_get_accounts ();
@@ -252,6 +263,8 @@ account_delete_clicked (GtkButton *butto
gtk_list_store_remove ((GtkListStore *) model, &iter);
+ if (has_spawned_proxies)
+ mail_accounts_load (prefs);
len = e_list_length ((EList *) accounts);
if (len > 0) {
gtk_tree_selection_select_iter (selection, &iter);
@@ -344,17 +357,30 @@ account_able_toggled (GtkCellRendererTog
if (gtk_tree_model_get_iter (model, &iter, path)) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
+
+ if (g_list_length (account->proxy_children)) {
+ char *ans;
+ ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-proxy-accounts",NULL);
+ if (ans == GTK_RESPONSE_YES) {
account->enabled = !account->enabled;
+ e_account_list_change(mail_config_get_accounts(), account);
gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
-
if (gtk_tree_selection_iter_is_selected (selection, &iter))
gtk_button_set_label (prefs->mail_able, account->enabled ? _("Disable") : _("Enable"));
-
- /* let the rest of the application know it changed */
+ mail_config_remove_account_proxies (account);
+ gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1);
+ account_able_changed (account);
+ }
+ } else {
+ account->enabled = !account->enabled;
e_account_list_change(mail_config_get_accounts(), account);
+ gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
+ if (gtk_tree_selection_iter_is_selected (selection, &iter))
+ gtk_button_set_label (prefs->mail_able, account->enabled ? _("Disable") : _("Enable"));
+ /* let the rest of the application know it changed */
account_able_changed(account);
}
-
+ }
gtk_tree_path_free (path);
}
@@ -371,13 +397,17 @@ account_cursor_change (GtkTreeSelection
EAccount *account = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
+ char *url = NULL;
int state;
+/* This function needs to get the account variable rather than parse for stupid proxy = yes*/
+
state = gconf_client_key_is_writable(mail_config_get_gconf_client(), "/apps/evolution/mail/accounts", NULL);
if (state) {
state = gtk_tree_selection_get_selected (selection, &model, &iter);
if (state) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
+ url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
if (account->source && account->enabled)
gtk_button_set_label (prefs->mail_able, _("Disable"));
else
@@ -390,7 +420,12 @@ account_cursor_change (GtkTreeSelection
gtk_widget_set_sensitive (GTK_WIDGET (prefs), FALSE);
}
+ if( url != NULL ) {
+ if( g_list_length(account->proxy_children))
+ gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 0);
+ else
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), state);
+ }
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), state);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), state);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), state);
@@ -420,6 +455,7 @@ mail_accounts_load (EMAccountPrefs *pref
account = (EAccount *) e_iterator_get (node);
+ if (!account->proxy_account->parent_url) {
url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
gtk_list_store_append (model, &iter);
@@ -443,6 +479,7 @@ mail_accounts_load (EMAccountPrefs *pref
camel_url_free (url);
row++;
+ }
e_iterator_next (node);
}
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.700
diff -u -p -w -r1.700 ChangeLog
--- composer/ChangeLog 3 Jun 2005 09:52:02 -0000 1.700
+++ composer/ChangeLog 5 Jul 2005 11:37:48 -0000
@@ -1,3 +1,8 @@
+2005-07-05 Shreyas Srinivasan <sshreyas novell com>
+
+ * e-msg-composer-hdrs.c: Take into account store
+ permissions (Read Only). These are proxy specific as of now.
+
2005-06-03 Srinivasa Ragavan <sragavan novell com>
* e-msg-composer.c (e_msg_composer_attach): Fixed to show the
Index: composer/e-msg-composer-hdrs.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-hdrs.c,v
retrieving revision 1.137
diff -u -p -w -r1.137 e-msg-composer-hdrs.c
--- composer/e-msg-composer-hdrs.c 17 Jun 2005 15:20:28 -0000 1.137
+++ composer/e-msg-composer-hdrs.c 5 Jul 2005 13:06:55 -0000
@@ -56,6 +56,9 @@
#include "e-util/e-error.h"
#include <camel/camel.h>
+#include <camel/camel-store.h>
+#include <camel/camel-session.h>
+#include <e-util/e-proxy.h>
#include "e-msg-composer-hdrs.h"
#include "mail/mail-config.h"
/*#include "mail/em-folder-selection-button.h"*/
@@ -65,6 +68,7 @@
/*#include "mail/mail-component.h"*/
struct _MailComponent *mail_component_peek(void);
extern struct _EMFolderTreeModel *mail_component_peek_tree_model(struct _MailComponent *);
+CamelSession *session;
#include "mail/em-folder-tree.h"
@@ -228,6 +232,8 @@ account_added_cb (EAccountList *accounts
omenu = e_msg_composer_hdrs_get_from_omenu (hdrs);
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
+ if (account_can_write_mails (account))
+ {
label = g_strdup_printf ("%s <%s>", account->id->name, account->id->address);
item = gtk_menu_item_new_with_label (label);
gtk_widget_show (item);
@@ -245,6 +251,7 @@ account_added_cb (EAccountList *accounts
toplevel = gtk_widget_get_toplevel ((GtkWidget *) hdrs);
gtk_widget_set_sensitive (toplevel, TRUE);
}
+}
static void
account_changed_cb (EAccountList *accounts, EAccount *account, EMsgComposerHdrs *hdrs)
@@ -316,6 +323,26 @@ account_removed_cb (EAccountList *accoun
}
}
+gboolean
+account_can_write_mails (EAccount *account)
+{
+ static CamelStore *store;
+ CamelException ex;
+
+ if (!account->proxy_account->parent_url)
+ return TRUE;
+
+ if (!(store = (CamelStore *) camel_session_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, &ex))) {
+ camel_exception_clear (&ex);
+ return FALSE;
+ }
+
+ if (store->permissions & PROXY_MAIL_WRITE)
+ return TRUE;
+
+ return FALSE;
+}
+
static GtkWidget *
create_from_optionmenu (EMsgComposerHdrs *hdrs)
{
@@ -341,7 +368,7 @@ create_from_optionmenu (EMsgComposerHdrs
while (e_iterator_is_valid (iter)) {
account = (EAccount *) e_iterator_get (iter);
- if (account->id->address)
+ if (account->id->address && account_can_write_mails (account))
g_ptr_array_add (addresses, account->id->address);
e_iterator_next (iter);
@@ -360,7 +387,7 @@ create_from_optionmenu (EMsgComposerHdrs
continue;
}
- if (account->id->address && *account->id->address) {
+ if (account->id->address && *account->id->address && account_can_write_mails (account)) {
/* If the account has a unique email address, just
* show that. Otherwise include the account name.
*/
@@ -1104,6 +1131,8 @@ e_msg_composer_hdrs_set_from_account (EM
item = l->data;
account = g_object_get_data ((GObject *) item, "account");
+ if (account_can_write_mails (account))
+ {
if (account_name) {
if (account->name && !strcmp (account_name, account->name)) {
/* set the correct optionlist item */
@@ -1121,7 +1150,7 @@ e_msg_composer_hdrs_set_from_account (EM
return;
}
-
+ }
l = l->next;
i++;
}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
retrieving revision 1.2451
diff -u -p -w -r1.2451 ChangeLog
--- ChangeLog 1 Jul 2005 03:30:35 -0000 1.2451
+++ ChangeLog 5 Jul 2005 14:14:48 -0000
@@ -1,3 +1,8 @@
+2005-07-05 Shreyas Srinivasan <sshreyas novell com>
+
+ * camel-store.h: Add a new #define to identify proxy stores
+ and a new data member permissions to hold store specific permissions.
+
2005-06-24 Matt Brown <matt mattb net nz>
* camel-gpg-context.c: Extend verify and decrypt functions to support
Index: camel-store.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-store.h,v
retrieving revision 1.75
diff -u -p -w -r1.75 camel-store.h
--- camel-store.h 9 May 2005 20:13:13 -0000 1.75
+++ camel-store.h 5 Jul 2005 14:15:13 -0000
@@ -112,6 +112,7 @@ typedef struct _CamelRenameInfo {
#define CAMEL_STORE_VTRASH (1 << 1)
#define CAMEL_STORE_FILTER_INBOX (1 << 2)
#define CAMEL_STORE_VJUNK (1 << 3)
+#define CAMEL_STORE_PROXY (1 << 4)
struct _CamelStore {
CamelService parent_object;
@@ -120,6 +121,7 @@ struct _CamelStore {
CamelObjectBag *folders;
int flags;
+ gint16 permissions;
};
/* open mode for folder */
Index: camel-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-store.c,v
retrieving revision 1.163
diff -u -p -w -r1.163 camel-store.c
--- camel-store.c 9 Jun 2005 07:00:23 -0000 1.163
+++ camel-store.c 5 Jul 2005 14:15:40 -0000
@@ -138,6 +138,7 @@ camel_store_init (void *o)
/* set vtrash and vjunk on by default */
store->flags = CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK;
+ store->permissions = 0;
store->priv = g_malloc0 (sizeof (*store->priv));
store->priv->folder_lock = e_mutex_new (E_MUTEX_REC);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]