tmp
[apps/madmutt.git] / lib-mx / hcache.c
index 01db5bd..de0e3e0 100644 (file)
@@ -187,8 +187,9 @@ static const void *restore_list(const char *d, string_list_t **l)
     return d;
 }
 
-static void dump_parameter(buffer_t *buf, parameter_t *p)
+static void dump_parameter(buffer_t *buf, parameters_t *p)
 {
+#if 0
     int pos = buf->len, counter = 0;
 
     dump_int(buf, counter);
@@ -199,22 +200,24 @@ static void dump_parameter(buffer_t *buf, parameter_t *p)
     }
 
     memcpy(buf->data + pos, &counter, sizeof(counter));
+#endif
 }
 
-static const void *restore_parameter(const char *d, parameter_t ** p)
+static const void *restore_parameter(const char *d, parameters_t *p)
 {
     int counter;
 
     d = restore_int(d, &counter);
 
     for (; counter > 0; counter--) {
-        *p = parameter_new();
-        d  = restore_cstr(d, &(*p)->attribute);
-        d  = restore_cstr(d, &(*p)->value);
-        p  = &(*p)->next;
+        char *k, *v;
+        d  = restore_cstr(d, &k);
+        d  = restore_cstr(d, &v);
+        parameter_setval(p, k, v);
+        p_delete(&k);
+        p_delete(&v);
     }
 
-    *p = NULL;
     return d;
 }
 
@@ -240,7 +243,7 @@ static const void *restore_body(const char *d, BODY *c)
     d = restore_cstr(d, &c->xtype);
     d = restore_cstr(d, &c->subtype);
 
-    d = restore_parameter(d, &c->parameter);
+    d = restore_parameter(d, c->parameter);
 
     d = restore_cstr(d, &c->description);
     d = restore_cstr(d, &c->form_name);
@@ -341,6 +344,7 @@ HEADER *mutt_hcache_restore(const void *_d, HEADER **oh)
     d = restore_envelope(d, h->env);
 
     h->content = body_new();
+    h->content->parameter = parameter_new();
     d = restore_body(d, h->content);
 
     d = restore_cstr(d, &h->maildir_flags);