Browse Source

putting this on pause

Keith Brinker 6 years ago
parent
commit
901f2fcde5

+ 6
- 0
Client/src/main/java/Messages.java View File

@@ -13,6 +13,12 @@ public class Messages {
13 13
         this.message = message;
14 14
     }
15 15
 
16
+    public Messages(String fromid, String toid, String message){
17
+        this.fromid = fromid;
18
+        this.toid = toid;
19
+        this.message = message;
20
+    }
21
+
16 22
     @Override
17 23
     public String toString() {
18 24
         return "Messages{" +

+ 5
- 0
Client/src/main/java/SimpleShell.java View File

@@ -93,6 +93,11 @@ public class SimpleShell {
93 93
                 }
94 94
                 // you need to add a bunch more.
95 95
 
96
+//                if (list.contains("POST-message")){
97
+//                    String 
98
+//
99
+//                }
100
+
96 101
                 //!! command returns the last command in history
97 102
                 if (list.get(list.size() - 1).equals("!!")) {
98 103
                     pb.command(history.get(history.size() - 2));

+ 10
- 1
Client/src/main/java/YouAreEll.java View File

@@ -1,6 +1,9 @@
1
+import com.fasterxml.jackson.core.JsonProcessingException;
1 2
 import com.fasterxml.jackson.databind.ObjectMapper;
3
+import com.oracle.javafx.jmx.json.JSONException;
2 4
 import jdk.nashorn.internal.ir.RuntimeNode;
3 5
 import okhttp3.*;
6
+import sun.plugin2.message.Message;
4 7
 
5 8
 import java.io.IOException;
6 9
 
@@ -25,7 +28,13 @@ public class YouAreEll {
25 28
         }
26 29
 
27 30
 
28
-
31
+    public String postMessage(String fromid, String toid, String message) throws JsonProcessingException{
32
+        ObjectMapper mapper = new ObjectMapper();
33
+        Messages myMessage = new Messages(fromid, toid, message);
34
+        String payload = mapper.writeValueAsString(myMessage);
35
+        String url = "/ids/" + toid + "/messages";
36
+       return  MakeURLCall(url, "POST", payload);
37
+    }
29 38
 
30 39
     public String get_ids() {
31 40
         return MakeURLCall("/ids", "GET", "");