aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorShreyas Srinivasan <shres@src.gnome.org>2005-07-10 17:55:57 +0800
committerShreyas Srinivasan <shres@src.gnome.org>2005-07-10 17:55:57 +0800
commit38035659d1d57b512b28b19dc4436609de3d52ca (patch)
treeb89585e02a9a19bbd95f1fc25bc2e75f680e14cf /e-util
parentb239860999f0f90ed7e070111a106434fb4c22d6 (diff)
downloadgsoc2013-evolution-38035659d1d57b512b28b19dc4436609de3d52ca.tar.gz
gsoc2013-evolution-38035659d1d57b512b28b19dc4436609de3d52ca.tar.zst
gsoc2013-evolution-38035659d1d57b512b28b19dc4436609de3d52ca.zip
2005-07-10 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. svn path=/trunk/; revision=29697
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog6
-rw-r--r--e-util/e-account-list.c45
-rw-r--r--e-util/e-account-list.h5
-rw-r--r--e-util/e-account.c24
-rw-r--r--e-util/e-account.h4
5 files changed, 81 insertions, 3 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 400025dce7..1303a6a2e5 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-10 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
diff --git a/e-util/e-account-list.c b/e-util/e-account-list.c
index c4968d82b3..bc17e9a203 100644
--- a/e-util/e-account-list.c
+++ b/e-util/e-account-list.c
@@ -28,7 +28,7 @@
#include <string.h>
struct EAccountListPrivate {
- GConfClient *gconf;
+ GConfClient *gconf;
guint notify_id;
};
@@ -293,6 +293,45 @@ e_account_list_save (EAccountList *account_list)
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->parent_uid)
+ e_account_list_remove (account_list, account);
+ }
+
+ e_account_list_save (account_list);
+ g_object_unref (iter);
+}
+
+void
+e_account_list_remove_account_proxies (EAccountList *accounts, EAccount *account)
+{
+ EAccount *child_account;
+
+ while ( (child_account = e_account_list_find (accounts, E_ACCOUNT_FIND_PARENT_UID, account->uid))) {
+ e_account_list_remove (accounts, child_account);
+ child_account = NULL;
+ }
+
+ e_account_list_save (accounts);
+}
+
+int
+e_account_list_account_has_proxies (EAccountList *accounts, EAccount *account)
+{
+ if (e_account_list_find (accounts, E_ACCOUNT_FIND_PARENT_UID, account->uid))
+ return TRUE;
+
+ return FALSE;
+}
/**
* e_account_list_add:
* @accounts:
@@ -452,6 +491,10 @@ e_account_list_find(EAccountList *accounts, e_account_find_t type, const char *k
if (account->id)
found = g_ascii_strcasecmp(account->id->address, key) == 0;
break;
+ case E_ACCOUNT_FIND_PARENT_UID:
+ if (account->parent_uid)
+ found = strcmp(account->parent_uid, key) == 0;
+ break;
}
if (found)
diff --git a/e-util/e-account-list.h b/e-util/e-account-list.h
index f2b17af360..02b801aded 100644
--- a/e-util/e-account-list.h
+++ b/e-util/e-account-list.h
@@ -38,6 +38,7 @@ typedef enum _e_account_find_t {
E_ACCOUNT_FIND_UID,
E_ACCOUNT_FIND_ID_NAME,
E_ACCOUNT_FIND_ID_ADDRESS,
+ E_ACCOUNT_FIND_PARENT_UID,
} e_account_find_t;
typedef struct _EAccountList {
@@ -72,4 +73,8 @@ 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_remove_account_proxies (EAccountList *, EAccount *);
+int e_account_list_account_has_proxies (EAccountList *, EAccount *);
+
#endif /* __E_ACCOUNT_LIST__ */
diff --git a/e-util/e-account.c b/e-util/e-account.c
index 4ede2375e2..89c0525336 100644
--- a/e-util/e-account.c
+++ b/e-util/e-account.c
@@ -108,6 +108,8 @@ e_account_init (EAccount *account)
account->source = g_new0 (EAccountService, 1);
account->transport = g_new0 (EAccountService, 1);
+ account->parent_uid = NULL;
+
account->source->auto_check = FALSE;
account->source->auto_check_time = 10;
}
@@ -149,7 +151,7 @@ e_account_finalize (GObject *object)
identity_destroy (account->id);
service_destroy (account->source);
service_destroy (account->transport);
-
+
g_free (account->drafts_folder_uri);
g_free (account->sent_folder_uri);
@@ -160,6 +162,8 @@ e_account_finalize (GObject *object)
g_free (account->smime_sign_key);
g_free (account->smime_encrypt_key);
+ g_free (account->parent_uid);
+
G_OBJECT_CLASS (e_account_parent_class)->finalize (object);
}
@@ -486,6 +490,15 @@ e_account_set_from_xml (EAccount *account, const char *xml)
}
}
}
+ } else if (!strcmp (node->name, "proxy")) {
+ if (node->children) {
+ for (cur = node->children; cur; cur = cur->next) {
+ if (!strcmp (cur->name, "parent-uid")) {
+ changed |= xml_set_content (cur, &account->parent_uid);
+ break;
+ }
+ }
+ }
}
}
@@ -563,7 +576,7 @@ e_account_import (EAccount *dest, EAccount *src)
dest->smime_encrypt_to_self = src->smime_encrypt_to_self;
g_free (dest->smime_encrypt_key);
dest->smime_encrypt_key = g_strdup (src->smime_encrypt_key);
-
+
g_signal_emit(dest, signals[CHANGED], 0, -1);
}
@@ -652,6 +665,11 @@ e_account_to_xml (EAccount *account)
if (account->smime_encrypt_key)
xmlNewTextChild (node, NULL, "encrypt-key-id", account->smime_encrypt_key);
+ if (account->parent_uid) {
+ node = xmlNewChild (root, NULL, "proxy", NULL);
+ xmlNewTextChild (node, NULL, "parent-uid", account->parent_uid);
+ }
+
xmlDocDumpMemory (doc, &xmlbuf, &n);
xmlFreeDoc (doc);
@@ -778,6 +796,8 @@ 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_UID, */ 0, TYPE_STRING, G_STRUCT_OFFSET(EAccount, parent_uid) },
};
static GHashTable *ea_option_table;
diff --git a/e-util/e-account.h b/e-util/e-account.h
index 4e5de875d5..2969ecef63 100644
--- a/e-util/e-account.h
+++ b/e-util/e-account.h
@@ -69,6 +69,8 @@ typedef enum _e_account_item_t {
E_ACCOUNT_SMIME_ENCRYPT_TO_SELF,
E_ACCOUNT_SMIME_ENCRYPT_DEFAULT,
+ E_ACCOUNT_PROXY_PARENT_UID,
+
E_ACCOUNT_ITEM_LAST
} e_account_item_t;
@@ -125,6 +127,8 @@ typedef struct _EAccount {
gboolean pgp_no_imip_sign;
gboolean pgp_always_trust;
+ char *parent_uid;
+
char *smime_sign_key;
char *smime_encrypt_key;
gboolean smime_sign_default;