First commit

This commit is contained in:
2023-03-28 08:08:11 -05:00
commit b048b09f64
5 changed files with 127 additions and 0 deletions

26
message.c Normal file
View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "message.h"
Message new_message(char* string, User from, User to) {
Message new_message;
new_message.text = malloc((strlen(string)+1)*sizeof(char));
strcpy(new_message.text,string);
new_message.sender = from;
new_message.recipient = to;
time_t rawtime;
struct tm timeinfo;
time(&rawtime);
timeinfo = *localtime(&rawtime);
new_message.timeinfo = timeinfo;
return new_message;
}