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

34
LINES

< > BotCompany Repo | #1002433 // Mini-Chat Server

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1530L/10K/34K).

1  
!752
2  
3  
static PersistentLog<McMsg> msgs;
4  
5  
static class McMsg {
6  
  S miniChat, user, text;
7  
  long when;
8  
}
9  
10  
static new MultiMap<S, McMsg> byMiniChat;
11  
12  
p {
13  
  msgs = new PersistentLog("msgs.log");
14  
  for (McMsg m : msgs) byMiniChat.put(m.miniChat, m);
15  
}
16  
17  
synchronized answer {
18  
  if (match("mini chat size", s) || match("minichat size", s))
19  
    ret n(l(msgs), "msg") + ", " + n(l(byMiniChat.keySet()), "mini-chat");
20  
}
21  
22  
static synchronized void addToMiniChat(S miniChat, S user, S text) {
23  
  new McMsg m;
24  
  m.miniChat = miniChat;
25  
  m.user = user;
26  
  m.text = text;
27  
  m.when = now();
28  
  byMiniChat.put(m.miniChat, m);
29  
  msgs.add(m);
30  
}
31  
32  
static synchronized L<McMsg> listMiniChat(S miniChat) {
33  
  ret cloneList(byMiniChat.get(miniChat));
34  
}

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: #1002433
Snippet name: Mini-Chat Server
Eternal ID of this version: #1002433/1
Text MD5: fe02ac0c41ef6af8d477091f97bc59ed
Transpilation MD5: 04bf9bb65fd39f3f41bf314ddcf12e3f
Author: stefan
Category: eleu
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-21 23:46:40
Source code size: 756 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 619 / 1586
Referenced in: [show references]