Done until djumbai-send

This commit is contained in:
Afonso Franco 2024-05-11 12:39:00 +01:00
parent 83bd6fb796
commit da345fc422
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
8 changed files with 135 additions and 36 deletions

View file

@ -1,11 +1,12 @@
#include "protocol.h"
int new_message(message *m, unsigned int sender, unsigned int receiver, char *content) {
int new_message(message *m, unsigned int sender, unsigned int isgroup, unsigned int receiver, char *content) {
if (strlen(content) > MAX_CONTENT_SIZE) {
return 1;
}
m->header.version = VERSION;
m->header.sender = sender;
m->header.isgroup = isgroup;
m->header.receiver = receiver;
time(&m->header.timestamp);
strncpy(m->content, content, MAX_CONTENT_SIZE);