You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
484 B
C
27 lines
484 B
C
2 years ago
|
#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;
|
||
|
|
||
|
}
|