client send done?
This commit is contained in:
parent
b6e33c1052
commit
f2fe2233f1
2 changed files with 7 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "client.h"
|
#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];
|
int pipe_to_child[2];
|
||||||
|
|
||||||
if (pipe(pipe_to_child) == -1) {
|
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);
|
fgets(content, MAX_CONTENT_SIZE, stdin);
|
||||||
|
|
||||||
message msg;
|
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");
|
printf("Error when creating new message\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,19 +106,9 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupFlag) {
|
int receiverUidInt = atoi(receiverUid);
|
||||||
if (syncFlag) {
|
|
||||||
// send to group synchronously
|
send_message(receiverUidInt,groupFlag);
|
||||||
} else {
|
|
||||||
// send to group asynchronously
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (syncFlag) {
|
|
||||||
// send to user synchronously
|
|
||||||
} else {
|
|
||||||
// send to user asynchronously
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// unsigned int sender = getuid();
|
// unsigned int sender = getuid();
|
||||||
// unsigned int receiver = 1000;
|
// unsigned int receiver = 1000;
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
|
|
||||||
#define MAX_VALUE_LENGTH 100
|
#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
|
#endif // !CLIENT_H
|
||||||
|
|
Loading…
Reference in a new issue