Brian He před 6 roky
rodič
revize
19dae84ca8
1 změnil soubory, kde provedl 1 přidání a 36 odebrání
  1. 1
    36
      Client/src/main/java/SimpleShell.java

+ 1
- 36
Client/src/main/java/SimpleShell.java Zobrazit soubor

@@ -99,42 +99,7 @@ public class SimpleShell {
99 99
                     continue;
100 100
                 }
101 101
 
102
-                if(list.contains("send") && list.size() > 2 && !list.get(list.size() - 2).equals("to")) {
103
-                    StringBuilder message = new StringBuilder();
104
-                    String github = list.get(1);
105
-                    for(int i = 2; i < list.size(); i++) {
106
-                        if(i == 2) {
107
-                            message.append(list.get(i).substring(1) + " ");
108
-                        } else if(i == list.size() - 1) {
109
-                            message.append(list.get(i).substring(0, list.get(i).length() - 1));
110
-                        } else {
111
-                            message.append(list.get(i) + " ");
112
-                        }
113
-                    }
114
-                    Message messageToSend = new Message(list.get(1), message.toString(), "");
115
-                    String messageToString = objectMapper.writeValueAsString(messageToSend);
116
-                    webber.MakeURLCall("/ids/" + github + "/messages", "POST", messageToString);
117
-                    continue;
118
-                }
119
-
120
-                if(list.contains("send") && list.get(list.size() - 2).equals("to")) {
121
-                    StringBuilder message = new StringBuilder();
122
-                    String fromid = list.get(1);
123
-                    String toid = list.get(list.size() - 1);
124
-                    for (int i = 2; i < list.size() - 2; i++) {
125
-                        if (i == 2) {
126
-                            message.append(list.get(i).substring(1) + " ");
127
-                        } else if (i == list.size() - 3) {
128
-                            message.append(list.get(i).substring(0, list.get(i).length() - 1));
129
-                        } else {
130
-                            message.append(list.get(i) + " ");
131
-                        }
132
-                    }
133
-                    Message messageToSend = new Message(toid, message.toString(), fromid);
134
-                    String messageToString = objectMapper.writeValueAsString(messageToSend);
135
-                    webber.MakeURLCall("/ids/" + toid + "/messages", "POST", messageToString);
136
-                    continue;
137
-                }
102
+                if(list.contains("send") && list.size() > 2 && !list.get(list.size() - 2).equals("to")) { StringBuilder message = new StringBuilder();String github = list.get(1);for(int i = 2; i < list.size(); i++) { if(i == 2) { message.append(list.get(i).substring(1) + " "); } else if(i == list.size() - 1) { message.append(list.get(i).substring(0, list.get(i).length() - 1)); } else { message.append(list.get(i) + " "); } }Message messageToSend = new Message(list.get(1), message.toString(), "");String messageToString = objectMapper.writeValueAsString(messageToSend);webber.MakeURLCall("/ids/" + github + "/messages", "POST", messageToString);continue; }if(list.contains("send") && list.get(list.size() - 2).equals("to")) { StringBuilder message = new StringBuilder();String fromid = list.get(1);String toid = list.get(list.size() - 1);for (int i = 2; i < list.size() - 2; i++) { if (i == 2) { message.append(list.get(i).substring(1) + " "); } else if (i == list.size() - 3) { message.append(list.get(i).substring(0, list.get(i).length() - 1)); } else { message.append(list.get(i) + " "); } }Message messageToSend = new Message(toid, message.toString(), fromid);String messageToString = objectMapper.writeValueAsString(messageToSend);webber.MakeURLCall("/ids/" + toid + "/messages", "POST", messageToString);continue; }
138 103
 
139 104
                 //!! command returns the last command in history
140 105
                 if (list.get(list.size() - 1).equals("!!")) {