Fossil

Hex Artifact Content
Login

Artifact 70a75a3c869d2a5356c007c6b55f74b0903130a9933d0afb8e021edd84a864fb:


0000: 23 20 46 6f 73 73 69 6c 20 43 68 61 74 0a 0a 23  # Fossil Chat..#
0010: 23 20 49 6e 74 72 6f 64 75 63 74 69 6f 6e 0a 0a  # Introduction..
0020: 41 73 20 6f 66 20 76 65 72 73 69 6f 6e 20 32 2e  As of version 2.
0030: 31 34 20 28 61 6e 64 20 70 72 65 72 65 6c 65 61  14 (and prerelea
0040: 73 65 20 76 65 72 73 69 6f 6e 73 20 61 66 74 65  se versions afte
0050: 72 20 61 62 6f 75 74 20 32 30 32 30 2d 31 32 2d  r about 2020-12-
0060: 32 35 29 2c 0a 46 6f 73 73 69 6c 20 73 75 70 70  25),.Fossil supp
0070: 6f 72 74 73 20 61 20 64 65 76 65 6c 6f 70 65 72  orts a developer
0080: 20 63 68 61 74 72 6f 6f 6d 20 66 65 61 74 75 72   chatroom featur
0090: 65 2e 20 20 54 68 65 20 63 68 61 74 72 6f 6f 6d  e.  The chatroom
00a0: 20 70 72 6f 76 69 64 65 73 20 61 6e 0a 65 70 68   provides an.eph
00b0: 65 6d 65 72 61 6c 20 64 69 73 63 75 73 73 69 6f  emeral discussio
00c0: 6e 20 66 6f 72 75 6d 20 66 6f 72 20 69 6e 73 69  n forum for insi
00d0: 64 65 72 73 2e 20 20 44 65 73 69 67 6e 20 67 6f  ders.  Design go
00e0: 61 6c 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 20 20  als include:..  
00f0: 2a 20 20 2a 2a 53 69 6d 70 6c 65 20 62 75 74 20  *  **Simple but 
0100: 66 75 6e 63 74 69 6f 6e 61 6c 2a 2a 20 26 72 61  functional** &ra
0110: 72 72 3b 20 46 6f 73 73 69 6c 20 63 68 61 74 20  rr; Fossil chat 
0120: 69 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 70  is designed to p
0130: 72 6f 76 69 64 65 20 61 0a 20 20 20 20 20 63 6f  rovide a.     co
0140: 6e 76 65 6e 69 65 6e 74 20 72 65 61 6c 2d 74 69  nvenient real-ti
0150: 6d 65 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e  me communication
0160: 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 67   mechanism for g
0170: 65 6f 67 72 61 70 68 69 63 61 6c 6c 79 0a 20 20  eographically.  
0180: 20 20 20 64 69 73 74 72 69 62 75 74 65 64 20 64     distributed d
0190: 65 76 65 6c 6f 70 65 72 73 2e 20 20 49 74 20 69  evelopers.  It i
01a0: 73 20 6e 6f 74 20 69 6e 74 65 6e 64 65 64 20 61  s not intended a
01b0: 73 20 61 20 72 65 70 6c 61 63 65 20 6f 72 20 0a  s a replace or .
01c0: 20 20 20 20 20 63 6f 6d 70 65 74 69 74 6f 72 20       competitor 
01d0: 66 6f 72 20 49 52 43 2c 20 53 6c 61 63 6b 2c 20  for IRC, Slack, 
01e0: 44 69 73 63 6f 72 64 2c 20 54 65 6c 65 67 72 61  Discord, Telegra
01f0: 6d 2c 20 47 6f 6f 67 6c 65 20 48 61 6e 67 6f 75  m, Google Hangou
0200: 74 73 2c 20 65 74 63 2e 0a 0a 20 20 2a 20 20 2a  ts, etc...  *  *
0210: 2a 4c 6f 77 20 61 64 6d 69 6e 69 73 74 72 61 74  *Low administrat
0220: 69 76 65 20 6f 76 65 72 68 65 61 64 2a 2a 20 26  ive overhead** &
0230: 72 61 72 72 3b 0a 20 20 20 20 20 54 68 65 72 65  rarr;.     There
0240: 20 69 73 20 6e 6f 74 68 69 6e 67 20 6e 65 77 20   is nothing new 
0250: 74 6f 20 73 65 74 20 75 70 20 6f 72 20 63 6f 6e  to set up or con
0260: 66 69 67 75 72 65 2e 0a 20 20 20 20 20 53 69 6d  figure..     Sim
0270: 70 6c 79 20 65 6e 61 62 6c 65 20 74 68 65 20 5b  ply enable the [
0280: 43 20 63 61 70 61 62 69 6c 69 74 79 5d 28 2f 73  C capability](/s
0290: 65 74 75 70 5f 75 63 61 70 5f 6c 69 73 74 29 20  etup_ucap_list) 
02a0: 66 6f 72 20 75 73 65 72 73 0a 20 20 20 20 20 77  for users.     w
02b0: 68 6f 6d 20 79 6f 75 20 77 61 6e 74 20 74 6f 20  hom you want to 
02c0: 67 69 76 65 20 61 63 63 65 73 73 20 74 6f 20 74  give access to t
02d0: 68 65 20 63 68 61 74 72 6f 6f 6d 2e 0a 0a 20 20  he chatroom...  
02e0: 2a 20 20 2a 2a 45 70 68 65 6d 65 72 61 6c 2a 2a  *  **Ephemeral**
02f0: 20 26 72 61 72 72 3b 0a 20 20 20 20 20 43 68 61   →.     Cha
0300: 74 20 6d 65 73 73 61 67 65 73 20 64 6f 20 6e 6f  t messages do no
0310: 74 20 73 79 6e 63 20 74 6f 20 70 65 65 72 20 72  t sync to peer r
0320: 65 70 6f 73 69 74 6f 72 69 65 73 2e 20 20 41 6e  epositories.  An
0330: 64 20 74 68 65 79 20 61 72 65 0a 20 20 20 20 20  d they are.     
0340: 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 64 65  automatically de
0350: 6c 65 74 65 64 20 61 66 74 65 72 20 61 20 63 6f  leted after a co
0360: 6e 66 69 67 75 72 61 62 6c 65 20 64 65 6c 61 79  nfigurable delay
0370: 20 28 64 65 66 61 75 6c 74 3a 20 37 20 64 61 79   (default: 7 day
0380: 73 29 2e 0a 0a 46 6f 73 73 69 6c 20 63 68 61 74  s)...Fossil chat
0390: 20 69 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20   is designed to 
03a0: 70 72 6f 76 69 64 65 20 61 20 63 6f 6d 6d 75 6e  provide a commun
03b0: 69 63 61 74 69 6f 6e 20 76 65 6e 75 65 20 66 6f  ication venue fo
03c0: 72 20 64 69 73 63 75 73 73 69 6f 6e 0a 74 68 61  r discussion.tha
03d0: 74 20 64 6f 65 73 20 2a 6e 6f 74 2a 20 62 65 63  t does *not* bec
03e0: 6f 6d 65 20 70 61 72 74 20 6f 66 20 74 68 65 20  ome part of the 
03f0: 70 65 72 6d 61 6e 65 6e 74 20 72 65 63 6f 72 64  permanent record
0400: 20 66 6f 72 20 74 68 65 20 70 72 6f 6a 65 63 74   for the project
0410: 2e 0a 46 6f 72 20 70 65 72 73 69 73 74 20 61 6e  ..For persist an
0420: 64 20 73 79 6e 63 61 62 6c 65 20 64 69 73 63 75  d syncable discu
0430: 73 73 69 6f 6e 2c 20 75 73 65 20 74 68 65 20 5b  ssion, use the [
0440: 46 6f 72 75 6d 5d 28 2e 2f 66 6f 72 75 6d 2e 77  Forum](./forum.w
0450: 69 6b 69 29 2e 0a 0a 46 6f 73 73 69 6c 20 63 68  iki)...Fossil ch
0460: 61 74 20 69 73 20 64 65 73 69 67 6e 65 64 20 66  at is designed f
0470: 6f 72 20 75 73 65 20 62 79 20 69 6e 73 69 64 65  or use by inside
0480: 72 73 20 2d 20 70 65 6f 70 6c 65 20 77 69 74 68  rs - people with
0490: 20 63 68 65 63 6b 2d 69 6e 0a 70 72 69 76 69 6c   check-in.privil
04a0: 65 67 65 73 20 6f 72 20 68 69 67 68 65 72 2e 20  eges or higher. 
04b0: 20 49 74 20 69 73 20 6e 6f 74 20 69 6e 74 65 6e   It is not inten
04c0: 64 65 64 20 61 73 20 61 20 67 65 6e 65 72 61 6c  ded as a general
04d0: 2d 75 72 70 6f 73 65 20 67 61 74 68 65 72 69 6e  -urpose gatherin
04e0: 67 0a 70 6c 61 63 65 20 66 6f 72 20 72 61 6e 64  g.place for rand
04f0: 6f 6d 20 70 61 73 73 65 72 73 2d 62 79 20 6f 6e  om passers-by on
0500: 20 74 68 65 20 69 6e 74 65 72 6e 65 74 2e 20 20   the internet.  
0510: 28 49 74 20 63 6f 75 6c 64 20 62 65 20 75 73 65  (It could be use
0520: 64 20 66 6f 72 20 74 68 61 74 2c 0a 69 6e 20 74  d for that,.in t
0530: 68 65 6f 72 79 2c 20 62 75 74 20 69 74 73 20 66  heory, but its f
0540: 65 61 74 75 72 65 20 73 65 74 20 69 73 20 6e 6f  eature set is no
0550: 74 20 64 65 73 69 67 6e 65 64 20 77 69 74 68 20  t designed with 
0560: 74 68 61 74 20 75 73 65 20 63 61 73 65 20 69 6e  that use case in
0570: 20 6d 69 6e 64 2e 29 0a 0a 46 6f 73 73 69 6c 20   mind.)..Fossil 
0580: 63 68 61 74 20 69 73 20 64 65 73 69 67 6e 65 64  chat is designed
0590: 20 66 6f 72 20 74 72 61 6e 73 69 65 6e 74 2c 20   for transient, 
05a0: 65 70 68 65 6d 65 72 69 61 6c 2c 20 72 65 61 6c  ephemerial, real
05b0: 2d 74 69 6d 65 20 64 69 73 63 75 73 73 69 6f 6e  -time discussion
05c0: 2e 0a 54 68 65 20 63 6f 6e 76 65 72 73 61 74 69  ..The conversati
05d0: 6f 6e 20 69 73 20 6c 6f 63 61 6c 20 74 6f 20 61  on is local to a
05e0: 20 73 69 6e 67 6c 65 20 72 65 70 6f 73 69 74 6f   single reposito
05f0: 72 79 20 61 6e 64 20 69 73 20 6e 6f 74 20 73 79  ry and is not sy
0600: 6e 63 65 64 20 6f 72 0a 72 65 74 61 69 6e 65 64  nced or.retained
0610: 20 6c 6f 6e 67 2d 74 65 72 6d 2e 0a 0a 46 6f 73   long-term...Fos
0620: 73 69 6c 20 63 68 61 74 20 69 73 20 73 70 65 63  sil chat is spec
0630: 69 66 69 63 20 74 6f 20 61 20 73 69 6e 67 6c 65  ific to a single
0640: 20 72 65 70 6f 73 69 74 6f 72 79 2e 20 20 49 74   repository.  It
0650: 20 69 73 20 6f 6e 6c 79 20 72 65 61 6c 6c 79 20   is only really 
0660: 75 73 65 66 75 6c 0a 69 66 20 79 6f 75 20 63 6f  useful.if you co
0670: 6e 66 69 67 75 72 65 20 61 20 5b 63 6f 6d 6d 6f  nfigure a [commo
0680: 6e 20 73 65 72 76 65 72 20 72 65 70 6f 73 69 74  n server reposit
0690: 6f 72 79 5d 28 2e 2f 73 65 72 76 65 72 2f 29 20  ory](./server/) 
06a0: 74 68 61 74 20 61 6c 6c 20 63 68 61 74 0a 70 61  that all chat.pa
06b0: 72 74 69 63 69 70 61 6e 74 73 20 63 61 6e 20 63  rticipants can c
06c0: 6f 6e 6e 65 63 74 20 74 6f 2e 0a 0a 23 23 20 53  onnect to...## S
06d0: 65 74 75 70 0a 0a 54 6f 20 61 63 74 69 76 61 74  etup..To activat
06e0: 65 20 46 6f 73 73 69 6c 20 63 68 61 74 2c 20 73  e Fossil chat, s
06f0: 69 6d 70 6c 79 20 61 64 64 20 74 68 65 20 5b 43  imply add the [C
0700: 20 63 61 70 61 62 69 6c 69 74 79 5d 28 2f 73 65   capability](/se
0710: 74 75 70 5f 75 63 61 70 5f 6c 69 73 74 29 0a 74  tup_ucap_list).t
0720: 6f 20 65 76 65 72 79 20 75 73 65 72 20 77 68 6f  o every user who
0730: 20 69 73 20 61 75 74 68 6f 72 69 7a 65 64 20 74   is authorized t
0740: 6f 20 70 61 72 74 69 63 69 70 61 74 65 2e 20 20  o participate.  
0750: 41 6e 79 6f 6e 65 20 77 68 6f 20 63 61 6e 20 72  Anyone who can r
0760: 65 61 64 20 63 68 61 74 0a 63 61 6e 20 61 6c 73  ead chat.can als
0770: 6f 20 70 6f 73 74 20 74 6f 20 63 68 61 74 2e 0a  o post to chat..
0780: 0a 53 65 74 75 70 20 28 22 73 22 29 20 61 6e 64  .Setup ("s") and
0790: 20 41 64 6d 69 6e 20 28 22 61 22 29 20 75 73 65   Admin ("a") use
07a0: 72 73 20 61 6c 77 61 79 73 20 68 61 76 65 20 61  rs always have a
07b0: 63 63 65 73 73 20 74 6f 20 63 68 61 74 2c 20 77  ccess to chat, w
07c0: 69 74 68 6f 75 74 20 6e 65 65 64 69 6e 67 0a 74  ithout needing.t
07d0: 68 65 20 22 43 22 20 63 61 70 61 62 69 6c 69 74  he "C" capabilit
07e0: 79 2e 20 20 41 20 63 6f 6d 6d 6f 6e 20 63 6f 6e  y.  A common con
07f0: 66 69 67 75 72 61 74 69 6f 6e 20 69 73 20 74 6f  figuration is to
0800: 20 61 64 64 20 74 68 65 20 22 43 22 20 63 61 70   add the "C" cap
0810: 61 62 69 6c 69 74 79 0a 74 6f 20 22 44 65 76 65  ability.to "Deve
0820: 6c 6f 70 65 72 22 20 73 6f 20 74 68 61 74 20 61  loper" so that a
0830: 6e 79 20 69 6e 64 69 76 69 64 75 61 6c 20 75 73  ny individual us
0840: 65 72 20 77 68 6f 20 68 61 73 20 74 68 65 20 22  er who has the "
0850: 76 22 20 63 61 70 61 62 69 6c 69 74 79 20 77 69  v" capability wi
0860: 6c 6c 0a 61 6c 73 6f 20 68 61 76 65 20 61 63 63  ll.also have acc
0870: 65 73 73 20 74 6f 20 63 68 61 74 2e 0a 0a 54 68  ess to chat...Th
0880: 65 72 65 20 61 72 65 20 61 6c 73 6f 20 73 6f 6d  ere are also som
0890: 65 20 73 65 74 74 69 6e 67 73 20 75 6e 64 65 72  e settings under
08a0: 20 2f 41 64 6d 69 6e 2f 43 68 61 74 20 74 68 61   /Admin/Chat tha
08b0: 74 20 63 6f 6e 74 72 6f 6c 20 74 68 65 0a 62 65  t control the.be
08c0: 68 61 76 69 6f 72 20 6f 66 20 63 68 61 74 2c 20  havior of chat, 
08d0: 74 68 6f 75 67 68 20 74 68 65 20 64 65 66 61 75  though the defau
08e0: 6c 74 20 73 65 74 74 69 6e 67 73 20 61 72 65 20  lt settings are 
08f0: 72 65 61 73 6f 6e 61 62 6c 65 20 73 6f 20 69 6e  reasonable so in
0900: 20 6d 6f 73 74 0a 63 61 73 65 73 20 74 68 6f 73   most.cases thos
0910: 65 20 73 65 74 74 69 6e 67 73 20 63 61 6e 20 62  e settings can b
0920: 65 20 69 67 6e 6f 72 65 64 2e 20 20 54 68 65 20  e ignored.  The 
0930: 73 65 74 74 69 6e 67 73 20 63 6f 6e 74 72 6f 6c  settings control
0940: 20 74 68 69 6e 67 73 20 6c 69 6b 65 0a 74 68 65   things like.the
0950: 20 61 6d 6f 75 6e 74 20 6f 66 20 74 69 6d 65 20   amount of time 
0960: 74 68 61 74 20 63 68 61 74 20 6d 65 73 73 61 67  that chat messag
0970: 65 73 20 61 72 65 20 72 65 74 61 69 6e 65 64 20  es are retained 
0980: 62 65 66 6f 72 65 20 62 65 69 6e 67 20 70 75 72  before being pur
0990: 67 65 64 0a 66 72 6f 6d 20 74 68 65 20 72 65 70  ged.from the rep
09a0: 6f 73 69 74 6f 72 79 20 64 61 74 61 62 61 73 65  ository database
09b0: 2e 0a 0a 23 23 20 55 73 61 67 65 0a 0a 46 6f 72  ...## Usage..For
09c0: 20 75 73 65 72 73 20 77 69 74 68 20 61 70 70 72   users with appr
09d0: 6f 70 72 69 61 74 65 20 70 65 72 6d 69 73 73 69  opriate permissi
09e0: 6f 6e 73 20 73 69 6d 70 6c 79 20 62 72 6f 77 73  ons simply brows
09f0: 65 20 74 6f 20 74 68 65 0a 5b 2f 63 68 61 74 5d  e to the.[/chat]
0a00: 28 2f 68 65 6c 70 3f 63 6d 64 3d 2f 63 68 61 74  (/help?cmd=/chat
0a10: 29 20 74 6f 20 73 74 61 72 74 20 75 70 20 61 20  ) to start up a 
0a20: 63 68 61 74 20 73 65 73 73 69 6f 6e 2e 20 20 54  chat session.  T
0a30: 68 65 20 64 65 66 61 75 6c 74 0a 73 6b 69 6e 20  he default.skin 
0a40: 69 6e 63 6c 75 64 65 73 20 61 20 22 43 68 61 74  includes a "Chat
0a50: 22 20 65 6e 74 72 79 20 6f 6e 20 74 68 65 20 6d  " entry on the m
0a60: 65 6e 75 20 62 61 72 20 6f 6e 20 77 69 64 65 20  enu bar on wide 
0a70: 73 63 72 65 65 6e 73 20 66 6f 72 0a 70 65 6f 70  screens for.peop
0a80: 6c 65 20 77 69 74 68 20 63 68 61 74 20 70 72 69  le with chat pri
0a90: 76 69 6c 65 67 65 2e 20 20 54 68 65 72 65 20 69  vilege.  There i
0aa0: 73 20 61 6c 73 6f 20 61 20 22 43 68 61 74 22 20  s also a "Chat" 
0ab0: 6f 70 74 69 6f 6e 20 6f 6e 0a 74 68 65 20 5b 53  option on.the [S
0ac0: 69 74 65 6d 61 70 20 70 61 67 65 5d 28 2f 73 69  itemap page](/si
0ad0: 74 65 6d 61 70 29 20 28 77 68 69 63 68 20 69 73  temap) (which is
0ae0: 20 6c 69 6e 6b 65 64 20 74 6f 20 74 68 65 20 68   linked to the h
0af0: 61 6d 62 75 72 67 65 72 20 6d 65 6e 75 0a 6f 66  amburger menu.of
0b00: 20 6d 61 6e 79 20 73 6b 69 6e 73 29 2e 0a 0a 4d   many skins)...M
0b10: 65 73 73 61 67 65 20 74 65 78 74 20 69 73 20 64  essage text is d
0b20: 65 6c 69 76 65 72 65 64 20 76 65 72 62 61 74 69  elivered verbati
0b30: 6d 2e 20 20 54 68 65 72 65 20 69 73 20 6e 6f 20  m.  There is no 
0b40: 6d 61 72 6b 75 70 2e 20 20 48 6f 77 65 76 65 72  markup.  However
0b50: 2c 0a 74 68 65 20 63 68 61 74 20 73 79 73 74 65  ,.the chat syste
0b60: 6d 20 64 6f 65 73 20 74 72 79 20 74 6f 20 69 64  m does try to id
0b70: 65 6e 74 69 66 79 20 61 6e 64 20 74 61 67 20 68  entify and tag h
0b80: 79 70 65 72 6c 69 6e 6b 73 2c 20 61 73 20 66 6f  yperlinks, as fo
0b90: 6c 6c 6f 77 73 3a 0a 0a 20 20 2a 20 20 41 6e 79  llows:..  *  Any
0ba0: 20 77 6f 72 64 20 74 68 61 74 20 62 65 67 69 6e   word that begin
0bb0: 73 20 77 69 74 68 20 22 68 74 74 70 3a 2f 2f 22  s with "http://"
0bc0: 20 6f 72 20 22 68 74 74 70 73 3a 2f 2f 22 20 69   or "https://" i
0bd0: 73 20 61 73 73 75 6d 65 64 0a 20 20 20 20 20 74  s assumed.     t
0be0: 6f 20 62 65 20 61 20 68 79 70 65 72 6c 69 6e 6b  o be a hyperlink
0bf0: 20 61 6e 64 20 69 73 20 74 61 67 67 65 64 2e 0a   and is tagged..
0c00: 0a 20 20 2a 20 20 54 65 78 74 20 77 69 74 68 69  .  *  Text withi
0c10: 6e 20 60 5b 2e 2e 2e 5d 60 20 69 73 20 70 61 72  n `[...]` is par
0c20: 73 65 64 20 61 6e 64 20 69 74 20 69 66 20 69 73  sed and it if is
0c30: 20 61 20 76 61 6c 69 64 20 68 79 70 65 72 6c 69   a valid hyperli
0c40: 6e 6b 0a 20 20 20 20 20 74 61 72 67 65 74 20 28  nk.     target (
0c50: 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65  according to the
0c60: 20 77 61 79 20 74 68 61 74 20 5b 46 6f 73 73 69   way that [Fossi
0c70: 6c 20 57 69 6b 5d 28 2f 77 69 6b 69 5f 72 75 6c  l Wik](/wiki_rul
0c80: 65 73 29 20 6f 72 0a 20 20 20 20 20 5b 4d 61 72  es) or.     [Mar
0c90: 6b 64 6f 77 6e 5d 28 2f 6d 64 5f 72 75 6c 65 73  kdown](/md_rules
0ca0: 29 20 75 6e 64 65 72 73 74 61 6e 64 20 68 79 70  ) understand hyp
0cb0: 65 72 6c 69 6e 6b 73 29 20 74 68 65 6e 20 74 68  erlinks) then th
0cc0: 61 74 20 74 65 78 74 0a 20 20 20 20 20 69 73 20  at text.     is 
0cd0: 74 61 67 67 65 64 2e 0a 0a 41 70 61 72 74 20 66  tagged...Apart f
0ce0: 72 6f 6d 20 61 64 64 69 6e 67 20 68 79 70 65 72  rom adding hyper
0cf0: 6c 69 6e 6b 20 61 6e 63 68 6f 72 20 74 61 67 73  link anchor tags
0d00: 20 74 6f 20 62 69 74 73 20 6f 66 20 74 65 78 74   to bits of text
0d10: 20 74 68 61 74 20 6c 6f 6f 6b 0a 6c 69 6b 65 20   that look.like 
0d20: 68 79 70 65 72 6c 69 6e 6b 73 2c 20 6e 6f 20 63  hyperlinks, no c
0d30: 68 61 6e 67 65 73 20 61 72 65 20 6d 61 64 65 20  hanges are made 
0d40: 74 6f 20 74 68 65 20 69 6e 70 75 74 20 74 65 78  to the input tex
0d50: 74 2e 0a 0a 23 23 20 49 6d 70 6c 65 6d 65 6e 74  t...## Implement
0d60: 61 74 69 6f 6e 20 44 65 74 61 69 6c 73 0a 0a 2a  ation Details..*
0d70: 28 54 68 69 73 20 73 65 63 74 69 6f 6e 20 69 73  (This section is
0d80: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 61 6c 20 6f   informational o
0d90: 6e 6c 79 2e 20 20 59 6f 75 20 64 6f 20 6e 6f 74  nly.  You do not
0da0: 20 6e 65 65 64 20 74 6f 20 75 6e 64 65 72 73 74   need to underst
0db0: 61 6e 64 0a 68 6f 77 20 46 6f 73 73 69 6c 20 63  and.how Fossil c
0dc0: 68 61 74 20 77 6f 72 6b 73 20 69 6e 20 6f 72 64  hat works in ord
0dd0: 65 72 20 74 6f 20 75 73 65 20 69 74 2e 20 20 42  er to use it.  B
0de0: 75 74 20 6d 61 6e 79 20 64 65 76 65 6c 6f 70 65  ut many develope
0df0: 72 73 20 70 72 65 66 65 72 0a 74 6f 20 6b 6e 6f  rs prefer.to kno
0e00: 77 20 77 68 61 74 20 69 73 20 68 61 70 70 65 6e  w what is happen
0e10: 69 6e 67 20 22 75 6e 64 65 72 20 74 68 65 20 68  ing "under the h
0e20: 6f 6f 64 22 2e 29 2a 0a 0a 54 68 65 20 5b 2f 63  ood".)*..The [/c
0e30: 68 61 74 5d 28 2f 68 65 6c 70 3f 63 6d 64 3d 2f  hat](/help?cmd=/
0e40: 63 68 61 74 29 20 77 65 62 70 61 67 65 20 64 6f  chat) webpage do
0e50: 77 6e 6c 6f 61 64 73 20 61 20 73 6d 61 6c 6c 20  wnloads a small 
0e60: 61 6d 6f 75 6e 74 20 6f 66 0a 48 54 4d 4c 20 61  amount of.HTML a
0e70: 6e 64 20 61 20 66 65 77 20 4b 42 20 6f 66 20 6a  nd a few KB of j
0e80: 61 76 61 73 63 72 69 70 74 20 74 6f 20 72 75 6e  avascript to run
0e90: 20 74 68 65 20 63 68 61 74 20 73 65 73 73 69 6f   the chat sessio
0ea0: 6e 2e 20 20 54 68 65 20 0a 6a 61 76 61 73 63 72  n.  The .javascr
0eb0: 69 70 74 20 75 73 65 73 20 58 4d 4c 48 74 74 70  ipt uses XMLHttp
0ec0: 52 65 71 75 65 73 74 20 28 58 48 52 29 20 74 6f  Request (XHR) to
0ed0: 20 64 6f 77 6e 6c 6f 61 64 20 63 68 61 74 20 63   download chat c
0ee0: 6f 6e 74 65 6e 74 2c 0a 70 6f 73 74 20 6e 6f 74  ontent,.post not
0ef0: 20 63 6f 6e 74 65 6e 74 2c 20 6f 72 20 64 65 6c   content, or del
0f00: 65 74 65 20 68 69 73 74 6f 72 69 63 61 6c 20 6d  ete historical m
0f10: 65 73 73 61 67 65 2e 20 20 54 68 65 20 66 6f 6c  essage.  The fol
0f20: 6c 6f 77 69 6e 67 0a 77 65 62 20 69 6e 74 65 72  lowing.web inter
0f30: 66 61 63 65 73 20 61 72 65 20 75 73 65 64 20 62  faces are used b
0f40: 79 20 74 68 65 20 58 48 52 3a 0a 0a 20 20 2a 20  y the XHR:..  * 
0f50: 20 2a 2a 2f 63 68 61 74 2d 70 6f 6c 6c 2a 2a 20   **/chat-poll** 
0f60: 26 72 61 72 72 3b 0a 20 20 20 20 20 44 6f 77 6e  →.     Down
0f70: 6c 6f 61 64 20 63 68 61 74 20 63 6f 6e 74 65 6e  load chat conten
0f80: 74 20 61 73 20 4a 53 4f 4e 2e 0a 20 20 20 20 20  t as JSON..     
0f90: 43 68 61 74 20 6d 65 73 73 61 67 65 73 20 61 72  Chat messages ar
0fa0: 65 20 6e 75 6d 62 65 72 20 73 65 71 75 65 6e 74  e number sequent
0fb0: 69 61 6c 6c 79 2e 0a 20 20 20 20 20 54 68 65 20  ially..     The 
0fc0: 63 6c 69 65 6e 74 20 74 65 6c 6c 73 20 74 68 65  client tells the
0fd0: 20 73 65 72 76 65 72 20 74 68 65 20 6c 61 72 67   server the larg
0fe0: 65 73 74 20 63 68 61 74 20 6d 65 73 73 61 67 65  est chat message
0ff0: 20 69 74 20 63 75 72 72 65 6e 74 6c 79 0a 20 20   it currently.  
1000: 20 20 20 68 6f 6c 64 73 20 61 6e 64 20 74 68 65     holds and the
1010: 20 73 65 72 76 65 72 20 73 65 6e 64 73 20 62 61   server sends ba
1020: 63 6b 20 73 75 62 73 65 71 75 65 6e 74 20 6d 65  ck subsequent me
1030: 73 73 61 67 65 73 2e 20 20 49 66 20 74 68 65 72  ssages.  If ther
1040: 65 0a 20 20 20 20 20 61 72 65 20 6e 6f 20 73 75  e.     are no su
1050: 62 73 65 71 75 65 6e 74 20 6d 65 73 73 61 67 65  bsequent message
1060: 73 2c 20 74 68 65 20 2f 63 68 61 74 2d 70 6f 6c  s, the /chat-pol
1070: 6c 20 70 61 67 65 20 62 6c 6f 63 6b 73 20 75 6e  l page blocks un
1080: 74 69 6c 20 6e 65 77 0a 20 20 20 20 20 6d 65 73  til new.     mes
1090: 73 61 67 65 73 20 61 72 65 20 61 76 61 69 6c 61  sages are availa
10a0: 62 6c 65 2e 0a 0a 20 20 2a 20 20 2a 2a 2f 63 68  ble...  *  **/ch
10b0: 61 74 2d 73 65 6e 64 2a 2a 20 26 72 61 72 72 3b  at-send** →
10c0: 0a 20 20 20 20 20 53 65 6e 64 73 20 61 20 6e 65  .     Sends a ne
10d0: 77 20 63 68 61 74 20 6d 65 73 73 61 67 65 20 74  w chat message t
10e0: 6f 20 74 68 65 20 73 65 72 76 65 72 2e 0a 0a 20  o the server... 
10f0: 20 2a 20 20 2a 2a 2f 63 68 61 74 2d 64 65 6c 65   *  **/chat-dele
1100: 74 65 2a 2a 20 26 72 61 72 72 3b 0a 20 20 20 20  te** →.    
1110: 20 44 65 6c 65 74 65 20 61 20 63 68 61 74 20 6d   Delete a chat m
1120: 65 73 73 61 67 65 2e 0a 0a 54 68 65 20 46 6f 73  essage...The Fos
1130: 73 69 6c 20 63 68 61 74 20 64 65 73 69 67 6e 20  sil chat design 
1140: 75 73 65 73 20 74 68 65 20 74 72 61 64 69 74 69  uses the traditi
1150: 6f 6e 61 6c 20 22 68 61 6e 67 69 6e 67 20 47 45  onal "hanging GE
1160: 54 22 20 6f 72 20 0a 22 5b 6c 6f 6e 67 20 70 6f  T" or ."[long po
1170: 6c 6c 69 6e 67 5d 28 77 69 6b 69 70 65 64 69 61  lling](wikipedia
1180: 3a 2f 77 69 6b 69 2f 50 75 73 68 5f 74 65 63 68  :/wiki/Push_tech
1190: 6e 6f 6c 6f 67 79 23 4c 6f 6e 67 5f 70 6f 6c 6c  nology#Long_poll
11a0: 69 6e 67 29 22 0a 74 6f 20 77 61 69 74 20 66 6f  ing)".to wait fo
11b0: 72 20 6e 65 77 20 63 68 61 74 20 6d 65 73 73 61  r new chat messa
11c0: 67 65 73 2e 20 20 54 68 69 73 20 69 73 20 64 6f  ges.  This is do
11d0: 6e 65 20 62 65 63 61 75 73 65 20 74 68 61 74 20  ne because that 
11e0: 74 65 63 68 6e 69 71 75 65 20 77 6f 72 6b 73 0a  technique works.
11f0: 65 61 73 69 6c 79 20 77 69 74 68 20 43 47 49 20  easily with CGI 
1200: 61 6e 64 20 53 43 47 49 2c 20 77 68 69 63 68 20  and SCGI, which 
1210: 61 72 65 20 74 68 65 20 75 73 75 61 6c 20 6d 65  are the usual me
1220: 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 73 65 74  chanisms for set
1230: 74 69 6e 67 20 75 70 0a 61 20 46 6f 73 73 69 6c  ting up.a Fossil
1240: 20 73 65 72 76 65 72 2e 20 20 4d 6f 72 65 20 61   server.  More a
1250: 64 76 61 6e 63 65 64 20 74 65 63 68 6e 69 71 75  dvanced techniqu
1260: 65 73 20 73 75 63 68 20 61 73 20 0a 5b 53 65 72  es such as .[Ser
1270: 76 65 72 2d 73 65 6e 74 20 65 76 65 6e 74 73 5d  ver-sent events]
1280: 28 77 69 6b 69 70 65 64 69 61 3a 2f 77 69 6b 69  (wikipedia:/wiki
1290: 2f 53 65 72 76 65 72 2d 73 65 6e 74 5f 65 76 65  /Server-sent_eve
12a0: 6e 74 73 29 20 61 6e 64 20 65 73 70 65 63 69 61  nts) and especia
12b0: 6c 6c 79 0a 5b 57 65 62 53 6f 63 6b 65 74 73 5d  lly.[WebSockets]
12c0: 28 77 69 6b 69 70 65 64 69 61 3a 2f 77 69 6b 69  (wikipedia:/wiki
12d0: 2f 57 65 62 53 6f 63 6b 65 74 29 20 6d 69 67 68  /WebSocket) migh
12e0: 74 20 73 65 65 6d 20 6d 6f 72 65 20 61 70 70 72  t seem more appr
12f0: 6f 70 72 69 61 74 65 20 66 6f 72 0a 61 20 63 68  opriate for.a ch
1300: 61 74 20 73 79 73 74 65 6d 2c 20 62 75 74 20 74  at system, but t
1310: 68 6f 73 65 20 74 65 63 68 6e 6f 6c 6f 67 69 65  hose technologie
1320: 73 20 61 72 65 20 6e 6f 74 20 72 65 61 64 69 6c  s are not readil
1330: 79 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74  y compatible wit
1340: 68 20 43 47 49 2e 0a 0a 43 68 61 74 20 6d 65 73  h CGI...Chat mes
1350: 73 61 67 65 73 20 61 72 65 20 73 74 6f 72 65 64  sages are stored
1360: 20 6f 6e 20 74 68 65 20 73 65 72 76 65 72 2d 73   on the server-s
1370: 69 64 65 20 69 6e 20 74 68 65 20 43 48 41 54 20  ide in the CHAT 
1380: 74 61 62 6c 65 20 6f 66 0a 74 68 65 20 72 65 70  table of.the rep
1390: 6f 73 69 74 6f 72 79 2e 0a 0a 7e 7e 7e 0a 20 20  ository...~~~.  
13a0: 20 43 52 45 41 54 45 20 54 41 42 4c 45 20 72 65   CREATE TABLE re
13b0: 70 6f 73 69 74 6f 72 79 2e 63 68 61 74 28 0a 20  pository.chat(. 
13c0: 20 20 20 20 20 6d 73 67 69 64 20 49 4e 54 45 47       msgid INTEG
13d0: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41  ER PRIMARY KEY A
13e0: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0a 20 20  UTOINCREMENT,.  
13f0: 20 20 20 20 6d 74 69 6d 65 20 4a 55 4c 49 41 4e      mtime JULIAN
1400: 44 41 59 2c 0a 20 20 20 20 20 20 78 66 72 6f 6d  DAY,.      xfrom
1410: 20 54 45 58 54 2c 0a 20 20 20 20 20 20 78 6d 73   TEXT,.      xms
1420: 67 20 20 54 45 58 54 2c 0a 20 20 20 20 20 20 66  g  TEXT,.      f
1430: 69 6c 65 20 20 42 4c 4f 42 2c 0a 20 20 20 20 20  ile  BLOB,.     
1440: 20 66 6e 61 6d 65 20 54 45 58 54 2c 0a 20 20 20   fname TEXT,.   
1450: 20 20 20 66 6d 69 6d 65 20 54 45 58 54 2c 0a 20     fmime TEXT,. 
1460: 20 20 20 20 20 6d 64 65 6c 20 49 4e 54 29 0a 20       mdel INT). 
1470: 20 20 20 29 3b 0a 7e 7e 7e 0a 0a 54 68 65 20 43     );.~~~..The C
1480: 48 41 54 20 74 61 62 6c 65 20 69 73 20 6e 6f 74  HAT table is not
1490: 20 63 72 6f 73 73 2d 6c 69 6e 6b 65 64 20 77 69   cross-linked wi
14a0: 74 68 20 61 6e 79 20 6f 74 68 65 72 20 74 61 62  th any other tab
14b0: 6c 65 73 20 69 6e 20 74 68 65 20 72 65 70 6f 73  les in the repos
14c0: 69 74 6f 72 79 0a 73 63 68 65 6d 61 2e 20 20 41  itory.schema.  A
14d0: 6e 20 61 64 6d 69 6e 69 73 74 72 61 74 6f 72 20  n administrator 
14e0: 63 61 6e 20 22 44 45 4c 45 54 45 20 54 41 42 4c  can "DELETE TABL
14f0: 45 20 63 68 61 74 3b 22 20 61 74 20 61 6e 79 20  E chat;" at any 
1500: 74 69 6d 65 2c 20 77 69 74 68 6f 75 74 0a 68 61  time, without.ha
1510: 72 6d 20 28 61 70 61 72 74 20 66 72 6f 6d 20 64  rm (apart from d
1520: 65 6c 65 74 69 6e 67 20 61 6c 6c 20 63 68 61 74  eleting all chat
1530: 20 68 69 73 74 6f 72 79 2c 20 6f 66 20 63 6f 75   history, of cou
1540: 72 73 65 29 2e 20 20 54 68 65 20 43 48 41 54 20  rse).  The CHAT 
1550: 74 61 62 6c 65 0a 69 73 20 64 72 6f 70 70 65 64  table.is dropped
1560: 20 77 68 65 6e 20 72 75 6e 6e 69 6e 67 20 5b 66   when running [f
1570: 6f 73 73 69 6c 20 73 63 72 75 62 20 2d 2d 76 65  ossil scrub --ve
1580: 72 69 6c 79 5d 28 2f 68 65 6c 70 3f 63 6d 64 3d  rily](/help?cmd=
1590: 73 63 72 75 62 29 2e 0a 0a 4f 6e 20 74 68 65 20  scrub)...On the 
15a0: 73 65 72 76 65 72 2d 73 69 64 65 2c 20 6d 65 73  server-side, mes
15b0: 73 61 67 65 20 74 65 78 74 20 69 73 20 73 74 6f  sage text is sto
15c0: 72 65 64 20 65 78 61 63 74 6c 79 20 61 73 20 65  red exactly as e
15d0: 6e 74 65 72 65 64 20 62 79 20 74 68 65 0a 75 73  ntered by the.us
15e0: 65 72 73 2e 20 20 54 68 65 20 2f 63 68 61 74 2d  ers.  The /chat-
15f0: 70 6f 6c 6c 20 70 61 67 65 20 71 75 65 72 69 65  poll page querie
1600: 73 20 74 68 65 20 43 48 41 54 20 74 61 62 6c 65  s the CHAT table
1610: 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 73 0a   and constructs.
1620: 61 20 4a 53 4f 4e 20 72 65 70 6c 79 20 64 65 73  a JSON reply des
1630: 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 5b 2f  cribed in the [/
1640: 63 68 61 74 2d 70 6f 6c 6c 20 64 6f 63 75 6d 65  chat-poll docume
1650: 6e 74 61 74 69 6f 6e 5d 28 2f 68 65 6c 70 3f 63  ntation](/help?c
1660: 6d 64 3d 2f 63 68 61 74 2d 70 6f 6c 6c 29 2e 0a  md=/chat-poll)..
1670: 54 68 65 20 6d 65 73 73 61 67 65 20 74 65 78 74  The message text
1680: 20 69 73 20 74 72 61 6e 73 6c 61 74 65 64 20 69   is translated i
1690: 6e 74 6f 20 48 54 4d 4c 20 70 72 69 6f 72 20 74  nto HTML prior t
16a0: 6f 20 62 65 69 6e 67 20 63 6f 6e 76 65 72 74 65  o being converte
16b0: 64 20 69 6e 74 6f 0a 4a 53 4f 4e 20 73 6f 20 74  d into.JSON so t
16c0: 68 61 74 20 74 68 65 20 74 65 78 74 20 63 61 6e  hat the text can
16d0: 20 62 65 20 73 61 66 65 6c 79 20 61 64 64 65 64   be safely added
16e0: 20 74 6f 20 74 68 65 20 64 69 73 70 6c 61 79 20   to the display 
16f0: 75 73 69 6e 67 0a 69 6e 6e 65 72 48 54 4d 4c 2e  using.innerHTML.
1700: 0a                                               .