-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChat.java
More file actions
35 lines (27 loc) · 750 Bytes
/
Chat.java
File metadata and controls
35 lines (27 loc) · 750 Bytes
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
/*
this should be a conversation between two users
no perspective
should generate when new conversation starts
user a and user b
users a, b, and c
etc
*/
import java.util.*;
public class Chat {
LinkedList<Message> messages = new LinkedList<>();
ParticipantGroup participants;
Chat(Server h) {
participants = new ParticipantGroup();
}
Chat(Server h, ParticipantGroup p) {
participants = p;
}
public void addMessage(Message m) { messages.addLast(m); }
public String generateMessageFeed() {
String mf = "";
for(Message m : messages) {
mf += m.getAuthor().getName() + ", " + m.getTimeSent() + ": \n" + m.getContent() + "\n\n";
}
return mf;
}
}