1 | static class ChatLine { |
2 | long id, room; |
3 | S who, text; |
4 | boolean isBot, auth; |
5 | } |
6 | |
7 | static long suckWebChatRoom_lastSuck; |
8 | |
9 | static L<ChatLine> suckWebChatRoom(S myName, long room, long fromID, int n) { |
10 | if (now() < suckWebChatRoom_lastSuck + 500) |
11 | print("Warning: Sucking a lot :)"); |
12 | suckWebChatRoom_lastSuck = now(); |
13 | Map data = (Map) jsonDecode(loadPageSilently("tinybrain.de:8080/tb-int/groupchat.json.lines.php?room=" + room + "&fromID=" + fromID + "&n=" + n + "&who=" + urlencode(myName))); |
14 | L<Map<S, S>> lines = (L) data.get("lines"); |
15 | new L<ChatLine> list; |
16 | for (Map<S, S> m : lines) { |
17 | new ChatLine l; |
18 | l.who = m.get("who"); |
19 | l.text = m.get("text"); |
20 | l.isBot = "1".equals(m.get("bot")); |
21 | l.auth = eq(m.get("auth"), "1"); |
22 | l.id = parseLong(m.get("id")); |
23 | l.room = room; |
24 | list.add(l); |
25 | } |
26 | ret list; |
27 | } |
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: | 655 / 725 |
Referenced in: | [show references] |