Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. String roomKey = "exampleROOM1";
  2. URL homeUrl = new URL(MOTHERSHIP +"?pulseWord="+ pulseWord + "&pulseName=" + pulseName + "&action=" + (on ? "1" : "0") + "&chatDab=" + chatDab + "&roomKey=" + roomKey + "&userCount="+ userCount);
  3. URLConnection conn = homeUrl.openConnection();
  4. conn.setDoOutput(true);
  5. Util.fillHeaders(conn, "json post");
  6. OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
  7. // log(wr);
  8. wr.write("");
  9. wr.flush();
  10. wr.close();
  11. String line;
  12. // log(line);
  13. // log(conn.getInputStream());
  14.  
  15. try (Scanner s = new Scanner(conn.getInputStream());) {
  16. line = s.useDelimiter(Util.EOF).next();
  17. // log(line)
  18. }
  19. String[] parts = line.split(", name: ");
  20.  
  21. if (parts.length >= 1) {
  22. callback("chatname", parts[1]);
  23. }
  24. log("Pulse for " + getDisplayNick() + " (front " + server + "): " + line + ", interests: " + getPulseWords());
  25. mothershipDown = false;
  26. } catch (Exception ex) {
  27. log(ex);
  28. log("Failed to send pulse for " + getDisplayNick());
  29. mothershipDown = true;
  30. if (verbose) {
  31. ex.printStackTrace();
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement