static class ChatLine {
int id, room;
S who, text;
boolean isBot, auth;
}
static int suckWebChat_lastID;
static long suckWebChat_lastSuck;
static int suckWebChat_room = 1;
static L<ChatLine> suckWebChat(S myName) {
ret suckWebChat(myName, 1);
}
// suckFirst = how many lines to suck on startup (history)
static L<ChatLine> suckWebChat(S myName, int suckFirst) {
if (now() < suckWebChat_lastSuck + 500)
print("Warning: Sucking a lot :)");
suckWebChat_lastSuck = now();
int n = suckWebChat_lastID == 0 ? suckFirst : 1000;
Map data = (Map) jsonDecode(loadPageSilently("tinybrain.de:8080/tb-int/groupchat.json.lines.php?room=" + suckWebChat_room + "&fromID=" + suckWebChat_lastID + "&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 = parseInt(m.get("id"));
l.room = room;
if (l.id > suckWebChat_lastID) suckWebChat_lastID = l.id;
list.add(l);
}
ret list;
}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