Bläddra i källkod

minimum product

Lawrence Wu 6 år sedan
förälder
incheckning
3b16646eb0
1 ändrade filer med 9 tillägg och 18 borttagningar
  1. 9
    18
      Client/src/main/java/SimpleShell.java

+ 9
- 18
Client/src/main/java/SimpleShell.java Visa fil

@@ -76,14 +76,15 @@ public class SimpleShell {
76 76
                     continue;
77 77
                 }
78 78
                 if (list.get(0).equals("send")){
79
-                    if (list.get(1).equals("to")){
79
+                    if (list.get(2).equals("to")){
80 80
                         ObjectMapper mapper = new ObjectMapper();
81
-                        String friend = list.get(2);
81
+                        String friend = list.get(3);
82 82
                         String message = "";
83
-                        for (int i = 3; i < list.size(); i++){
83
+                        for (int i = 4; i < list.size(); i++){
84 84
                             message += list.get(i) + " ";
85 85
                         }
86
-                        Message sendMessage = new Message("wulawrence", friend, message);
86
+                        String fromId = list.get(1);
87
+                        Message sendMessage = new Message(fromId, friend, message);
87 88
                         String messageload = mapper.writeValueAsString(sendMessage);
88 89
                         String results = webber.postMessage(messageload);
89 90
                         SimpleShell.prettyPrint(results);
@@ -91,27 +92,17 @@ public class SimpleShell {
91 92
                     else {
92 93
                         ObjectMapper mapper = new ObjectMapper();
93 94
                         String message = "";
94
-                        for (int i = 1; i < list.size(); i++) {
95
+                        for (int i = 2; i < list.size(); i++) {
95 96
                             message += list.get(i) + " ";
96 97
                         }
97
-                        Message messages = new Message("wulawrence", "", message);
98
+                        String fromId = list.get(1);
99
+                        Message messages = new Message(fromId, "", message);
98 100
                         String messageload = mapper.writeValueAsString(messages);
99 101
                         String results = webber.postMessage(messageload);
100 102
                         SimpleShell.prettyPrint(results);
101 103
                     }
102 104
                 }
103
-//                if (list.get(1).equals("to")){
104
-//                    ObjectMapper mapper = new ObjectMapper();
105
-//                    String friend = list.get(2);
106
-//                    String message = "";
107
-//                    for (int i = 3; i < list.size(); i++){
108
-//                        message += list.get(i) + " ";
109
-//                    }
110
-//                    Message sendMessage = new Message("wulawrence", friend, message);
111
-//                    String messageload = mapper.writeValueAsString(sendMessage);
112
-//                    String results = webber.postMessage(messageload);
113
-//                    SimpleShell.prettyPrint(results);
114
-//                }
105
+
115 106
                 // you need to add a bunch more.
116 107
 
117 108
                 //!! command returns the last command in history