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

23
LINES

< > BotCompany Repo | #1010919 // chatLinesAsWeb

JavaX fragment (include)

sbool chatLinesAsWeb_addIP;

// a, b are indices into the chat history
static Web chatLinesAsWeb(int a, int b) {
  ret chatLinesAsWeb(stefansChat_readHistory_fullMsgs(a, b));
}

static Web chatLinesAsWeb(L<ChatMsg> msgs) {
  Web web = simpleWeb();
  new L<WebNode> nodes;
  for i over msgs: {
    ChatMsg msg = msgs.get(i);
    WebNode n = web.newNode("Text " + quote(msg.text));
    if (msg.nr != 0) web_addLabel(n, str(msg.nr));
    nodes.add(n);
    web_addRelation(nextToLast(nodes), n, 'then);
    web_setPosition(n, 0.5, 0.2+i*0.6/max(1, l(msgs)-1));
    
    if (chatLinesAsWeb_addIP)
      web_addRelation_withPosition(n, "by IP", msg.ip, -0.2, -0.1);
  }
  ret web;
}

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: 444 / 477
Version history: 8 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010956 - chatLinesAsWeb2