From 3b98e123e039d4bb8494f9f2e4a0e6ceb31ec1cf Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 30 Jul 2021 19:38:02 +0200 Subject: [PATCH] Send a message of kind "kicked" instead of "error". --- README.PROTOCOL | 5 +++-- rtpconn/webclient.go | 2 +- static/galene.js | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.PROTOCOL b/README.PROTOCOL index 6150f05..6a0c19e 100644 --- a/README.PROTOCOL +++ b/README.PROTOCOL @@ -292,8 +292,9 @@ chat history, and is not expected to contain user-visible content. } ``` -Currently defined kinds include `error`, `warning`, `info`, `clearchat` -(not to be confused with the `clearchat` group action), and `mute`. +Currently defined kinds include `error`, `warning`, `info`, `kicked`, +`clearchat` (not to be confused with the `clearchat` group action), and +`mute`. A user action requests that the server act upon a user. diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 31bfb4e..b9e1873 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -1815,7 +1815,7 @@ func errorMessage(id string, err error) *clientMessage { } return &clientMessage{ Type: "usermessage", - Kind: "error", + Kind: "kicked", Id: e.Id, Username: e.Username, Dest: id, diff --git a/static/galene.js b/static/galene.js index 631a64e..7f5b937 100644 --- a/static/galene.js +++ b/static/galene.js @@ -2198,6 +2198,7 @@ async function gotJoined(kind, group, perms, status, message) { */ function gotUserMessage(id, dest, username, time, privileged, kind, message) { switch(kind) { + case 'kicked': case 'error': case 'warning': case 'info': @@ -2934,7 +2935,6 @@ document.getElementById('resizer').addEventListener('mousedown', chatResizer, fa function displayError(message, level) { if(!level) level = "error"; - var background = 'linear-gradient(to right, #e20a0a, #df2d2d)'; var position = 'center'; var gravity = 'top'; @@ -2948,6 +2948,9 @@ function displayError(message, level) { case "warning": background = "linear-gradient(to right, #bdc511, #c2cf01)"; break; + case "kicked": + level = "error"; + break; } /** @ts-ignore */