Brian He 6 년 전
부모
커밋
695f616907
1개의 변경된 파일35개의 추가작업 그리고 1개의 파일을 삭제
  1. 35
    1
      Client/src/main/java/SimpleShell.java

+ 35
- 1
Client/src/main/java/SimpleShell.java 파일 보기

@@ -99,7 +99,41 @@ 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")) { 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; }
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
+                if(list.contains("send") && list.get(list.size() - 2).equals("to")) {
120
+                    StringBuilder message = new StringBuilder();
121
+                    String fromid = list.get(1);
122
+                    String toid = list.get(list.size() - 1);
123
+                    for (int i = 2; i < list.size() - 2; i++) {
124
+                        if (i == 2) {
125
+                            message.append(list.get(i).substring(1) + " ");
126
+                        } else if (i == list.size() - 3) {
127
+                            message.append(list.get(i).substring(0, list.get(i).length() - 1));
128
+                        } else {
129
+                            message.append(list.get(i) + " ");
130
+                        }
131
+                    }
132
+                    Message messageToSend = new Message(toid, message.toString(), fromid);
133
+                    String messageToString = objectMapper.writeValueAsString(messageToSend);
134
+                    webber.MakeURLCall("/ids/" + toid + "/messages", "POST", messageToString);
135
+                    continue;
136
+                }
103 137
 
104 138
                 //!! command returns the last command in history
105 139
                 if (list.get(list.size() - 1).equals("!!")) {