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

23
LINES

< > BotCompany Repo | #1010919 // chatLinesAsWeb

JavaX fragment (include)

1  
sbool chatLinesAsWeb_addIP;
2  
3  
// a, b are indices into the chat history
4  
static Web chatLinesAsWeb(int a, int b) {
5  
  ret chatLinesAsWeb(stefansChat_readHistory_fullMsgs(a, b));
6  
}
7  
8  
static Web chatLinesAsWeb(L<ChatMsg> msgs) {
9  
  Web web = simpleWeb();
10  
  new L<WebNode> nodes;
11  
  for i over msgs: {
12  
    ChatMsg msg = msgs.get(i);
13  
    WebNode n = web.newNode("Text " + quote(msg.text));
14  
    if (msg.nr != 0) web_addLabel(n, str(msg.nr));
15  
    nodes.add(n);
16  
    web_addRelation(nextToLast(nodes), n, 'then);
17  
    web_setPosition(n, 0.5, 0.2+i*0.6/max(1, l(msgs)-1));
18  
    
19  
    if (chatLinesAsWeb_addIP)
20  
      web_addRelation_withPosition(n, "by IP", msg.ip, -0.2, -0.1);
21  
  }
22  
  ret web;
23  
}

Author comment

Began life as a copy of #1010915

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: #1010919
Snippet name: chatLinesAsWeb
Eternal ID of this version: #1010919/9
Text MD5: 83b60226cbc27bcd4f5713ec98722883
Author: stefan
Category: javax / chat / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-10 18:21:29
Source code size: 698 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 443 / 477
Version history: 8 change(s)
Referenced in: [show references]