diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 7a23f95..36d1e2b 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -1194,7 +1194,7 @@ func handleAction(c *webClient, a interface{}) error { for _, m := range h { err := c.write(clientMessage{ Type: "chathistory", - Id: m.Id, + Source: m.Id, Username: m.User, Time: m.Time, Value: m.Value, diff --git a/static/galene.js b/static/galene.js index 95d2ec6..2f30b04 100644 --- a/static/galene.js +++ b/static/galene.js @@ -2594,12 +2594,11 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa if(kind !== 'me') { let p = formatLines(message.toString().split('\n')); let doHeader = true; - if(!peerId && !dest && !nick) { - doHeader = false; - } else if(lastMessage.nick !== (nick || null) || - lastMessage.peerId !== peerId || - lastMessage.dest !== (dest || null) || - !time || !lastMessage.time) { + if(lastMessage.nick !== (nick || null) || + lastMessage.peerId !== (peerId || null) || + lastMessage.dest !== (dest || null) || + !time || !lastMessage.time) { + console.log("A", nick, peerId, dest, time, lastMessage.time); doHeader = true; } else { let delta = time - lastMessage.time; @@ -2608,16 +2607,14 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa if(doHeader) { let header = document.createElement('p'); - if(peerId || nick || dest) { - let user = document.createElement('span'); - let u = serverConnection.users[dest]; - let name = (u && u.username); - user.textContent = dest ? - `${nick||'(anon)'} \u2192 ${name || '(anon)'}` : - (nick || '(anon)'); - user.classList.add('message-user'); - header.appendChild(user); - } + let user = document.createElement('span'); + let u = dest && serverConnection.users[dest]; + let name = (u && u.username); + user.textContent = dest ? + `${nick || '(anon)'} \u2192 ${name || '(anon)'}` : + (nick || '(anon)'); + user.classList.add('message-user'); + header.appendChild(user); header.classList.add('message-header'); container.appendChild(header); if(time) {