diff --git a/src/client/client.c b/src/client/client.c index 7952575..98c842c 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -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; diff --git a/src/client/client.h b/src/client/client.h index 49fc0d5..b0b6290 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -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