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).

!752

static PersistentLog<McMsg> msgs;

static class McMsg {
  S miniChat, user, text;
  long when;
}

static new MultiMap<S, McMsg> byMiniChat;

p {
  msgs = new PersistentLog("msgs.log");
  for (McMsg m : msgs) byMiniChat.put(m.miniChat, m);
}

synchronized answer {
  if (match("mini chat size", s) || match("minichat size", s))
    ret n(l(msgs), "msg") + ", " + n(l(byMiniChat.keySet()), "mini-chat");
}

static synchronized void addToMiniChat(S miniChat, S user, S text) {
  new McMsg m;
  m.miniChat = miniChat;
  m.user = user;
  m.text = text;
  m.when = now();
  byMiniChat.put(m.miniChat, m);
  msgs.add(m);
}

static synchronized L<McMsg> listMiniChat(S miniChat) {
  ret cloneList(byMiniChat.get(miniChat));
}

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: 704 / 1688
Referenced in: #1002192 - Slack Tagger
#1002434 - miniChat - post message about current input to mini-chat
#3000169 - Answer for stefanreich
#3000174 - Answer for stefanreich
#3000175 - Answer for stefanreich
#3000176 - Answer for stefanreich
#3000177 - Answer for stefanreich
#3000179 - Answer for stefanreich
#3000180 - Answer for stefanreich
#3000181 - Answer for stefanreich
#3000182 - Answer for stefanreich
#3000184 - Answer for stefanreich
#3000185 - Answer for stefanreich
#3000195 - Answer for stefanreich (>> y)
#3000196 - Answer for stefanreich (>> y)
#3000197 - Answer for stefanreich (>> program data sizes)
#3000198 - Answer for stefanreich (>> program data sizes)
#3000199 - Answer for stefanreich (>> program data sizes)
#3000200 - Answer for stefanreich (>> program data sizes)
#3000201 - Answer for stefanreich (>> list all files)
#3000203 - Answer for stefanreich (>> timing hello bot)
#3000208 - Answer for bgrgndz (>> list sub bots)
#3000209 - Answer for bgrgndz (>> list sub bots)
#3000369 - Answer for Stefan (>> list sub bots)
#3000376 - Answer for stefanreich (>> list sub bots)
#3000377 - Answer for stefanreich (>> timing eleu?)
#3000380 - Answer for stefanreich (>> list sub bots)
#3000381 - Answer for speedforce (>> list sub bots)
#3000382 - Answer for ferdie (>> t = 1, f = 0)