Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1002905 // suckWebChatRoom

JavaX fragment (include)

static class ChatLine {
  long id, room;
  S who, text;
  boolean isBot, auth;
}

static long suckWebChatRoom_lastSuck;
  
static L<ChatLine> suckWebChatRoom(S myName, long room, long fromID, int n) {
  if (now() < suckWebChatRoom_lastSuck + 500)
    print("Warning: Sucking a lot :)");
  suckWebChatRoom_lastSuck = now();
  Map data = (Map) jsonDecode(loadPageSilently("tinybrain.de:8080/tb-int/groupchat.json.lines.php?room=" + room + "&fromID=" + fromID + "&n=" + n + "&who=" + urlencode(myName)));
  L<Map<S, S>> lines = (L) data.get("lines");
  new L<ChatLine> list;
  for (Map<S, S> m : lines) {
    new ChatLine l;
    l.who = m.get("who");
    l.text = m.get("text");
    l.isBot = "1".equals(m.get("bot"));
    l.auth = eq(m.get("auth"), "1");
    l.id = parseLong(m.get("id"));
    l.room = room;
    list.add(l);
  }
  ret list;
}

Author comment

Began life as a copy of #1001576

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002905
Snippet name: suckWebChatRoom
Eternal ID of this version: #1002905/1
Text MD5: f27a82554b4c0c83bc9cb58e8e8a6353
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-04 16:43:20
Source code size: 867 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 656 / 725
Referenced in: #1002917 - getWebChatPresences
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)