MCPcopy Create free account
hub / github.com/Giyn/LiveChat / UserController

Class UserController

src/pers/giyn/LiveChat/client/UserController.java:16–141  ·  view source on GitHub ↗

@author 许继元

Source from the content-addressed store, hash-verified

14 * @author 许继元
15 */
16public class UserController {
17 public ClientBusinesses client;
18 public Login loggingLogin;
19 public FriendGUI friendGUI;
20 public ArrayList<Friend> friendList;
21 public ArrayList<Friend> applyFriendList;
22 public HashMap<String, ChattingGUI> chattingPanel;
23 public String id;
24
25 public boolean login(String id, String password) throws Exception {
26 client.login(id, password);
27 this.id = id;
28 this.friendGUI.frame.setVisible(true);
29 return true;
30 }
31
32 public boolean sendFile(String id, String name, byte[] file) {
33 try {
34 this.client.sendFile(id, name, file);
35 } catch (Exception e) {
36 e.printStackTrace();
37 }
38 return true;
39 }
40
41 public void openChattingPanel(Friend friend) {
42 if (chattingPanel.get(friend.id) != null) {
43 } else {
44 chattingPanel.put(friend.id, new ChattingGUI(this, friend));
45 }
46 }
47
48 public void updateFriendList(ArrayList<Friend> friendList) {
49 this.friendGUI.friendsList = friendList;
50
51 for (Friend friend : friendList) {
52 if (this.chattingPanel.get(friend.id) != null) {
53 this.chattingPanel.get(friend.id).friend = friend;
54 this.chattingPanel.get(friend.id).update();
55 }
56 }
57 this.friendGUI.updateFriend();
58 }
59
60 public void updateApplyFriendList(ArrayList<Friend> applyFriendsList) {
61 this.friendGUI.applyFriendsList = applyFriendsList;
62 }
63
64 public boolean closeChattingPanel(Friend friend) {
65 boolean res = true;
66
67 if (chattingPanel.get(friend.id) == null) {
68 res = false;
69 } else {
70 chattingPanel.remove(friend.id);
71 }
72
73 return res;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…