client send done?

This commit is contained in:
Afonso Franco 2024-05-12 16:48:55 +01:00
parent b6e33c1052
commit f2fe2233f1
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
2 changed files with 7 additions and 16 deletions

View file

@ -1,6 +1,7 @@
#include "client.h"
int send_message(unsigned int sender, unsigned int receiver) {
int send_message(unsigned int receiver,int isgroup) {
int sender = getuid();
int pipe_to_child[2];
if (pipe(pipe_to_child) == -1) {
@ -34,7 +35,7 @@ int send_message(unsigned int sender, unsigned int receiver) {
fgets(content, MAX_CONTENT_SIZE, stdin);
message msg;
if (new_message(&msg, sender, 0, receiver, content) != 0) {
if (new_message(&msg, sender, isgroup, receiver, content) != 0) {
printf("Error when creating new message\n");
}
@ -105,19 +106,9 @@ int main(int argc, char *argv[]) {
}
}
if (groupFlag) {
if (syncFlag) {
// send to group synchronously
} else {
// send to group asynchronously
}
} else {
if (syncFlag) {
// send to user synchronously
} else {
// send to user asynchronously
}
}
int receiverUidInt = atoi(receiverUid);
send_message(receiverUidInt,groupFlag);
// unsigned int sender = getuid();
// unsigned int receiver = 1000;

View file

@ -11,5 +11,5 @@
#define MAX_VALUE_LENGTH 100
int send_message(unsigned int sender, unsigned int receiver);
int send_message(unsigned int receiver,int isgroup);
#endif // !CLIENT_H