-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.cpp
More file actions
35 lines (35 loc) · 1.72 KB
/
message.cpp
File metadata and controls
35 lines (35 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "message.h"
#include <iostream>
using namespace std;
void welcomeMessage(){
cout << "***************************************\n"
"** Welcome to the information server **\n"
"***************************************" << endl;
}
void loginMessage(const char IP[], int port){
cout << "*** User '(no name)' entered from " << IP << ":" << port << ". ***" << endl;
}
void logoutMessage(string name){
cout << "*** User '(no name)' left. ***" << endl;
}
void yellMessage(const char name[], const char message[]){
cout << "*** " << name << " yelled ***: " << message << endl;
}
void toldMessage(const char name[], const char message[]){
cout << "*** " << name << " told you ***: " << message << endl;
}
void sendMessage(const char sendername[], int senderID, const char message[], const char receivername[], int receiverID){
cout << "*** " << sendername << " " << "(#" << senderID << ") just piped '" << message <<" ' to " << receivername <<" (#" << receiverID << ") ***" << endl;
}
void receiveMessage(const char receivername[], int receiverID, const char message[], const char sendername[], int senderID){
cout << "*** " << receivername << " " << "(#" << receiverID << ") just received from '" << receivername <<" (#" << receiverID << ") " << "by '" << message << "' ***" << endl;
}
void nouserMessage(int ID){
cout << "*** Error: user #" << ID << " does not exist yet. ***";
}
void nomessageMessage(int senderID, int receiverID){
cout << "*** Error: the pipe #" << senderID << "->#" << receiverID << " does not exist yet. ***" << endl;
}
void occuipiedMessage(int senderID, int receiverID){
cout << "*** Error: the pipe #" << senderID << "->#" << receiverID << " already exists. ***" << endl;
}