fixes! it works!

This commit is contained in:
Andrew Pamment 2018-05-26 23:11:02 +10:00
parent 8e1b0f7c91
commit c43abcac1e

View File

@ -52,6 +52,14 @@ void msg_to_hl(struct msg_t *msg) {
msg->type = ntohl(msg->type);
}
void msg_to_nl(struct msg_t *msg) {
msg->area = htonl(msg->area);
msg->timedate = htonl(msg->timedate);
msg->oaddr = htonl(msg->oaddr);
msg->daddr = htonl(msg->daddr);
msg->type = htonl(msg->type);
}
unsigned long generate_msgid() {
char buffer[1024];
@ -477,7 +485,15 @@ int import(char *filename) {
} else {
snprintf(buffer2, PATH_MAX, "%s/%d/%d-%s.message", baseoutdir, hubnode, areas[areaid]->links[i], uuid);
}
copy_file(buffer, buffer2);
msg.daddr = areas[areaid]->links[i];
msg_to_nl(&msg);
fptr = fopen(buffer2, "wb");
fwrite(&msg, sizeof(struct msg_t), 1, fptr);
fwrite(body, strlen(body), 1, fptr);
fclose(fptr);
msg_to_hl(&msg);
}
}
}