aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/camel-cipher-context.c34
-rw-r--r--camel/camel-cipher-context.h7
3 files changed, 39 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 97a65efeeb..fb3f2470e8 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,15 @@
+2003-11-25 Not Zed <NotZed@Ximian.com>
+
+ * camel-cipher-context.c (camel_cipher_validity_envelope): change
+ args to make it suit storing the validity in a tree.
+ (camel_cipher_validity_init): init the list header.
+ (camel_cipher_validity_clone): call validity_new so it gets init
+ properly.
+ (camel_cipher_validity_free): free any children nodes recursively.
+
+ * camel-cipher-context.h (CamelCipherValidity): added next/prev
+ and list header.
+
2003-11-18 Jeffrey Stedfast <fejj@ximian.com>
* camel-session.c (camel_session_finalise): Don't destroy the
diff --git a/camel/camel-cipher-context.c b/camel/camel-cipher-context.c
index 40f8d152eb..b730d927c8 100644
--- a/camel/camel-cipher-context.c
+++ b/camel/camel-cipher-context.c
@@ -357,6 +357,7 @@ camel_cipher_validity_init (CamelCipherValidity *validity)
g_assert (validity != NULL);
memset(validity, 0, sizeof(*validity));
+ e_dlist_init(&validity->children);
}
gboolean
@@ -407,7 +408,7 @@ camel_cipher_validity_clone(CamelCipherValidity *vin)
{
CamelCipherValidity *vo;
- vo = g_malloc0(sizeof(*vo));
+ vo = camel_cipher_validity_new();
vo->sign.status = vin->sign.status;
vo->sign.description = g_strdup(vin->sign.description);
vo->encrypt.status = vin->encrypt.status;
@@ -425,22 +426,22 @@ camel_cipher_validity_clone(CamelCipherValidity *vin)
* another one.
**/
void
-camel_cipher_validity_envelope(CamelCipherValidity *valid, CamelCipherValidity *outer)
+camel_cipher_validity_envelope(CamelCipherValidity *parent, CamelCipherValidity *valid)
{
- if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE
- && valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
- && outer->sign.status == CAMEL_CIPHER_VALIDITY_SIGN_NONE
- && outer->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
+ if (parent->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE
+ && parent->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
+ && valid->sign.status == CAMEL_CIPHER_VALIDITY_SIGN_NONE
+ && valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
/* case 1: only signed inside only encrypted -> merge both */
- valid->encrypt.status = outer->encrypt.status;
- valid->encrypt.description = g_strdup(outer->encrypt.description);
- } else if (valid->sign.status == CAMEL_CIPHER_VALIDITY_SIGN_NONE
- && valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
- && outer->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE
- && outer->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
+ parent->encrypt.status = valid->encrypt.status;
+ parent->encrypt.description = g_strdup(valid->encrypt.description);
+ } else if (parent->sign.status == CAMEL_CIPHER_VALIDITY_SIGN_NONE
+ && parent->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
+ && valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE
+ && valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
/* case 2: only encrypted inside only signed */
- valid->sign.status = outer->sign.status;
- valid->sign.description = g_strdup(outer->sign.description);
+ parent->sign.status = valid->sign.status;
+ parent->sign.description = g_strdup(valid->sign.description);
}
/* Otherwise, I dunno - what do you do? */
}
@@ -448,9 +449,14 @@ camel_cipher_validity_envelope(CamelCipherValidity *valid, CamelCipherValidity *
void
camel_cipher_validity_free (CamelCipherValidity *validity)
{
+ CamelCipherValidity *child;
+
if (validity == NULL)
return;
+ while ((child = (CamelCipherValidity *)e_dlist_remhead(&validity->children)))
+ camel_cipher_validity_free(child);
+
camel_cipher_validity_clear(validity);
g_free(validity);
}
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index a3edab6a5e..1a7387ac2c 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -26,6 +26,9 @@
#include <camel/camel-session.h>
#include <camel/camel-exception.h>
+/* FIXME: camelise */
+#include "e-util/e-msgport.h"
+
struct _CamelStream;
struct _CamelMimePart;
@@ -66,6 +69,10 @@ enum _camel_cipher_validity_encrypt_t {
};
struct _CamelCipherValidity {
+ struct _CamelCipherValidity *next;
+ struct _CamelCipherValidity *prev;
+ EDList children;
+
struct {
enum _camel_cipher_validity_sign_t status;
char *description;