-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.java
More file actions
executable file
·49 lines (42 loc) · 1.52 KB
/
Controller.java
File metadata and controls
executable file
·49 lines (42 loc) · 1.52 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package Client;
/**
* Created by amirpez on 11/15/17.
*/
public class Controller {
private MultithreadedClient threadedClient ;
public Controller(MultithreadedClient multithreadedClient) {
this.threadedClient = multithreadedClient;
}
public void identifier(String str) {
String[] words = str.split("#");
if (words[0].equalsIgnoreCase("signin")) {
if (words[1].equalsIgnoreCase("true")) {
threadedClient.setLoginAccessBoolean(true);
threadedClient.makeUser(words[2], words[3]);
} else if (words[1].equalsIgnoreCase("false")) {
threadedClient.setLoginAccessBoolean(false);
}
}
if (words[0].equalsIgnoreCase("users")) {
for (int i = 1; i < words.length; i++) {
threadedClient.setAllUsers(words[i]);
}
}
if (words[0].equalsIgnoreCase("serverPm")) {
String pm = words[2];
String from = words[1];
threadedClient.pmHandler(from,pm);
}
if (words[0].equalsIgnoreCase("onlineusers")){
threadedClient.clearOnlineUsers();
System.out.println("00");
for ( int i=1 ; i<words.length ; i++ ){
threadedClient.setOnlineUsers(words[i]);
}
System.out.println("11");
threadedClient.setOnlineListUpdated(false);
System.out.println("22");
System.out.println(threadedClient.isOnlineListUpdated());
}
}
}