diff --git a/pkg/message_filters.go b/pkg/message_filters.go index 683eb50..8756e1d 100644 --- a/pkg/message_filters.go +++ b/pkg/message_filters.go @@ -134,8 +134,6 @@ func pushMessageContext(sub *Subscriber, channel string, msg messages.Message) { strings.TrimSpace(msg.Message), )) - fmt.Printf("Context %s:\n%+v\n", channel, messageContexts[channel]) - // Trim the context to recent messages only. if len(messageContexts[channel]) > messageContextSize { messageContexts[channel] = messageContexts[channel][len(messageContexts[channel])-messageContextSize:] diff --git a/src/App.vue b/src/App.vue index 735662e..a8bb7f9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -967,6 +967,7 @@ export default { // WhoList updates. onWho(msg) { + let sendMe = false; // re-send our 'me' at the end this.whoList = msg.whoList; this.whoOnline = {}; @@ -974,15 +975,21 @@ export default { this.whoList = []; } - // If we had a camera open with any of these and they have gone - // off camera, close our side of the connection. for (let row of this.whoList) { this.whoMap[row.username] = row; this.whoOnline[row.username] = true; + + // If we had a camera open with any of these and they have gone + // off camera, close our side of the connection. if (this.WebRTC.streams[row.username] != undefined && !(row.video & this.VideoFlag.Active)) { this.closeVideo(row.username, "offerer"); } + + // If the server disagrees with our current status, send our status back. + if (row.username === this.username && row.status !== this.status) { + sendMe = true; + } } // Hang up on mutual cameras, if they changed their setting while we @@ -992,6 +999,11 @@ export default { // Has the back-end server forgotten we are on video? This can // happen if we disconnect/reconnect while we were streaming. if (this.webcam.active && !(this.whoMap[this.username]?.video & this.VideoFlag.Active)) { + sendMe = true; + } + + // Do we need to set our me status again? + if (sendMe) { this.sendMe(); } }, @@ -1670,7 +1682,7 @@ export default { }, isUserOffline(username) { // Return if the username is not presently online in the chat. - return this.whoOnline[username] !== true; + return this.whoOnline[username] !== true && username !== 'ChatServer' && username !== 'ChatClient'; }, avatarForUsername(username) { if (this.whoMap[username] != undefined && this.whoMap[username].avatar) { @@ -1703,9 +1715,6 @@ export default { if (nick) { return nick; } - } else if (this.whoMap[username] == undefined && username !== 'ChatServer' && username !== 'ChatClient') { - // User is not even logged in! Add this note to their name - username += " (offline)"; } return username; }, @@ -3751,37 +3760,10 @@ export default {