summaryrefslogtreecommitdiff
path: root/pith/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'pith/send.c')
-rw-r--r--pith/send.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/pith/send.c b/pith/send.c
index 024fc9ac..ba2f709b 100644
--- a/pith/send.c
+++ b/pith/send.c
@@ -1714,15 +1714,53 @@ fprintf(log_file,"a\n"); fflush(log_file);
int header_count=0;
int addresses_count=0;
- for(pf = header->local; pf && pf->name; pf = pf->next) {
+ for(pf = header->local; pf; pf = pf->next) {
header_count++;
if(pf->type == Address && pf->rcptto && pf->addr && *pf->addr)
addresses_count++;
}
fprintf(log_file,"%u %u b\n",header_count,addresses_count); fflush(log_file);
- addresses_count=1; // for now
- fs_resize((void**)&header->local, (size_t)(header_count+100+addresses_count)*sizeof(PINEFIELD));
-fprintf(log_file,"%u c\n", &header->local); fflush(log_file);
+
+ PINEFIELD* old_local = header->local;
+fprintf(log_file,"%u c\n", header->local); fflush(log_file);
+ fs_resize((void**)header->local, (size_t)(header_count+addresses_count)*sizeof(PINEFIELD));
+fprintf(log_file,"%u d\n", header->local); fflush(log_file);
+ header->local += header->local - old_local;
+ header->custom += header->local - old_local;
+ for(pf = header->local; pf; pf = pf->next) {
+ if (pf->next)
+ pf->next += header->local - old_local;
+ }
+ int sending_order_count=0;
+ PINEFIELD** pfp;
+ for(pfp = header->sending_order; pfp; pfp += 1)
+ sending_order_count++;
+
+ fs_resize((void**)header->sending_order, (size_t)(sending_order_count+addresses_count)*sizeof(PINEFIELD*));
+ for(int ii=0; ii<sending_order_count; ii++)
+ header->sending_order[ii] += header->local - old_local;
+ for(int ii=0; ii<addresses_count; ii++) {
+ header->sending_order[sending_order_count+ii] = header->local + header_count + ii;
+ header->local[header_count + ii - 1].next = header->local + header_count + ii;
+ memset(header->local + header_count + ii, 0, (size_t)sizeof(PINEFIELD));
+ header->local[header_count + ii].name = (char*)fs_get((size_t)11*sizeof(char));
+ snprintf(header->local[header_count + ii].name, 10, "X-Hashcash");
+ header->local[header_count + ii].name[10]='\0';
+/* header->local[header_count + ii].type = FreeText;
+ header->local[header_count + ii].canedit = 0;
+ header->local[header_count + ii].writehdr = 1;
+ header->local[header_count + ii].localcopy = 0;
+ header->local[header_count + ii].posterr = 0;
+ header->local[header_count + ii].textbuf = (char*)fs_get((size_t)16*sizeof(char));
+ header->local[header_count + ii].text = (char*)fs_get((size_t)2*sizeof(char*));
+ header->local[header_count + ii].text[0] = header->local[header_count + ii].textbuf;
+ header->local[header_count + ii].text[1] = NULL;
+ memcpy(header->local[header_count + ii].textbuf, header->local[header_count + ii].name, 10);
+ header->local[header_count + ii].textbuf[11]='\0';
+*/
+ }
+// memset(header->sending_order + sending_order_count + addresses_count, 0, (size_t)sizeof(PINEFIELD*));
+
// fs_resize((void**)&header->local, (size_t)header_count*sizeof(PINEFIELD));
/*
PINEFIELD *hashcashs = &header->local[header_count];