Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String roomKey = "exampleROOM1";
- URL homeUrl = new URL(MOTHERSHIP +"?pulseWord="+ pulseWord + "&pulseName=" + pulseName + "&action=" + (on ? "1" : "0") + "&chatDab=" + chatDab + "&roomKey=" + roomKey + "&userCount="+ userCount);
- URLConnection conn = homeUrl.openConnection();
- conn.setDoOutput(true);
- Util.fillHeaders(conn, "json post");
- OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
- // log(wr);
- wr.write("");
- wr.flush();
- wr.close();
- String line;
- // log(line);
- // log(conn.getInputStream());
- try (Scanner s = new Scanner(conn.getInputStream());) {
- line = s.useDelimiter(Util.EOF).next();
- // log(line)
- }
- String[] parts = line.split(", name: ");
- if (parts.length >= 1) {
- callback("chatname", parts[1]);
- }
- log("Pulse for " + getDisplayNick() + " (front " + server + "): " + line + ", interests: " + getPulseWords());
- mothershipDown = false;
- } catch (Exception ex) {
- log(ex);
- log("Failed to send pulse for " + getDisplayNick());
- mothershipDown = true;
- if (verbose) {
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement