sbool chatLinesAsWeb_addIP = true;

// 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;
}