diff options
author | ERDI Gergo <cactus@cactus.rulez.org> | 2005-04-08 12:34:04 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-04-08 12:34:04 +0800 |
commit | 74adbf2671566b78409acb8ac33088498bd33ea2 (patch) | |
tree | 70c2f17b203cb5220786240cf74cf4537f2d00f3 /e-util | |
parent | ba7ec805fc02bb372049caf05e089dfe901fd3fc (diff) | |
download | gsoc2013-evolution-74adbf2671566b78409acb8ac33088498bd33ea2.tar.gz gsoc2013-evolution-74adbf2671566b78409acb8ac33088498bd33ea2.tar.zst gsoc2013-evolution-74adbf2671566b78409acb8ac33088498bd33ea2.zip |
Added new receipt_policy field to services
2004-08-07 ERDI Gergo <cactus@cactus.rulez.org>
* e-account.h: Added new receipt_policy field to services
svn path=/trunk/; revision=29184
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 4 | ||||
-rw-r--r-- | e-util/e-account.c | 61 | ||||
-rw-r--r-- | e-util/e-account.h | 10 |
3 files changed, 74 insertions, 1 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index ed6152ea56..7de00b20f8 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -365,6 +365,10 @@ * e-icon-factory.c (icon_foreach_remove): We must return TRUE here so that things actually get removed from the list +2004-08-07 ERDI Gergo <cactus@cactus.rulez.org> + + * e-account.h: Added new receipt_policy field to services + 2004-08-05 Rodrigo Moya <rodrigo@novell.com> * e-icon-factory.c (e_icon_factory_init): connect to "changed" diff --git a/e-util/e-account.c b/e-util/e-account.c index 79cc78e282..4ede2375e2 100644 --- a/e-util/e-account.c +++ b/e-util/e-account.c @@ -265,6 +265,56 @@ xml_set_prop (xmlNodePtr node, const char *name, char **val) return res; } +static EAccountReceiptPolicy +str_to_receipt_policy (const char *str) +{ + if (!strcmp (str, "ask")) + return E_ACCOUNT_RECEIPT_ASK; + if (!strcmp (str, "always")) + return E_ACCOUNT_RECEIPT_ALWAYS; + + return E_ACCOUNT_RECEIPT_NEVER; +} + +static char* +receipt_policy_to_str (EAccountReceiptPolicy val) +{ + char *ret = 0; + + switch (val) { + case E_ACCOUNT_RECEIPT_NEVER: + ret = "never"; + break; + case E_ACCOUNT_RECEIPT_ASK: + ret = "ask"; + break; + case E_ACCOUNT_RECEIPT_ALWAYS: + ret = "always"; + break; + } + + return ret; +} + +static gboolean +xml_set_receipt_policy (xmlNodePtr node, const char *name, EAccountReceiptPolicy *val) +{ + EAccountReceiptPolicy new_val; + char *buf; + + if ((buf = xmlGetProp (node, name))) { + new_val = str_to_receipt_policy (buf); + xmlFree (buf); + + if (new_val != *val) { + *val = new_val; + return TRUE; + } + } + + return FALSE; +} + static gboolean xml_set_content (xmlNodePtr node, char **val) { @@ -387,7 +437,7 @@ e_account_set_from_xml (EAccount *account, const char *xml) changed |= xml_set_prop (node, "name", &account->name); changed |= xml_set_bool (node, "enabled", &account->enabled); - + for (node = node->children; node; node = node->next) { if (!strcmp (node->name, "identity")) { changed |= xml_set_identity (node, account->id); @@ -405,6 +455,8 @@ e_account_set_from_xml (EAccount *account, const char *xml) } else if (!strcmp (node->name, "auto-bcc")) { changed |= xml_set_bool (node, "always", &account->always_bcc); changed |= xml_set_content (node, &account->bcc_addrs); + } else if (!strcmp (node->name, "receipt-policy")) { + changed |= xml_set_receipt_policy (node, "policy", &account->receipt_policy); } else if (!strcmp (node->name, "pgp")) { changed |= xml_set_bool (node, "encrypt-to-self", &account->pgp_encrypt_to_self); changed |= xml_set_bool (node, "always-trust", &account->pgp_always_trust); @@ -494,6 +546,8 @@ e_account_import (EAccount *dest, EAccount *src) g_free (dest->bcc_addrs); dest->bcc_addrs = g_strdup (src->bcc_addrs); + dest->receipt_policy = src->receipt_policy; + g_free (dest->pgp_key); dest->pgp_key = g_strdup (src->pgp_key); dest->pgp_encrypt_to_self = src->pgp_encrypt_to_self; @@ -578,6 +632,9 @@ e_account_to_xml (EAccount *account) if (account->bcc_addrs) xmlNewTextChild (node, NULL, "recipients", account->bcc_addrs); + node = xmlNewChild (root, NULL, "receipt-policy", NULL); + xmlSetProp (node, "policy", receipt_policy_to_str (account->receipt_policy)); + node = xmlNewChild (root, NULL, "pgp", NULL); xmlSetProp (node, "encrypt-to-self", account->pgp_encrypt_to_self ? "true" : "false"); xmlSetProp (node, "always-trust", account->pgp_always_trust ? "true" : "false"); @@ -708,6 +765,8 @@ static struct _account_info { { /* E_ACCOUNT_BCC_ALWAYS */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, always_bcc) }, { /* E_ACCOUNT_BCC_ADDRS */ 0, TYPE_STRING, G_STRUCT_OFFSET(EAccount, bcc_addrs) }, + { /* E_ACCOUNT_RECEIPT_POLICY */ 0, TYPE_INT, G_STRUCT_OFFSET(EAccount, receipt_policy) }, + { /* E_ACCOUNT_PGP_KEY */ 0, TYPE_STRING, G_STRUCT_OFFSET(EAccount, pgp_key) }, { /* E_ACCOUNT_PGP_ENCRYPT_TO_SELF */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, pgp_encrypt_to_self) }, { /* E_ACCOUNT_PGP_ALWAYS_SIGN */ 0, TYPE_BOOL, G_STRUCT_OFFSET(EAccount, pgp_always_sign) }, diff --git a/e-util/e-account.h b/e-util/e-account.h index 0e153ca993..4e5de875d5 100644 --- a/e-util/e-account.h +++ b/e-util/e-account.h @@ -55,6 +55,8 @@ typedef enum _e_account_item_t { E_ACCOUNT_BCC_ALWAYS, E_ACCOUNT_BCC_ADDRS, + E_ACCOUNT_RECEIPT_POLICY, + E_ACCOUNT_PGP_KEY, E_ACCOUNT_PGP_ENCRYPT_TO_SELF, E_ACCOUNT_PGP_ALWAYS_SIGN, @@ -82,6 +84,12 @@ typedef struct _EAccountIdentity { char *sig_uid; } EAccountIdentity; +typedef enum _EAccountReceiptPolicy { + E_ACCOUNT_RECEIPT_NEVER, + E_ACCOUNT_RECEIPT_ASK, + E_ACCOUNT_RECEIPT_ALWAYS +} EAccountReceiptPolicy; + typedef struct _EAccountService { char *url; gboolean keep_on_server; @@ -109,6 +117,8 @@ typedef struct _EAccount { gboolean always_bcc; char *bcc_addrs; + EAccountReceiptPolicy receipt_policy; + char *pgp_key; gboolean pgp_encrypt_to_self; gboolean pgp_always_sign; |