summaryrefslogtreecommitdiffstats
path: root/vendor/gomod.garykim.dev
diff options
context:
space:
mode:
authorGary Kim <gary@garykim.dev>2020-10-01 16:59:35 -0400
committerGitHub <noreply@github.com>2020-10-01 22:59:35 +0200
commit219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f (patch)
tree113553069c5577b4dd96e26b467f4d69a2df6884 /vendor/gomod.garykim.dev
parent214a6a13861b9fd495797386f36507373728e577 (diff)
downloadmatterbridge-msglm-219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f.tar.gz
matterbridge-msglm-219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f.tar.bz2
matterbridge-msglm-219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f.zip
Append a suffix if user is a guest user (nctalk) (#1250)
Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'vendor/gomod.garykim.dev')
-rw-r--r--vendor/gomod.garykim.dev/nc-talk/CHANGELOG.md8
-rw-r--r--vendor/gomod.garykim.dev/nc-talk/ocs/message.go21
2 files changed, 29 insertions, 0 deletions
diff --git a/vendor/gomod.garykim.dev/nc-talk/CHANGELOG.md b/vendor/gomod.garykim.dev/nc-talk/CHANGELOG.md
index 987b0e19..b30e1f11 100644
--- a/vendor/gomod.garykim.dev/nc-talk/CHANGELOG.md
+++ b/vendor/gomod.garykim.dev/nc-talk/CHANGELOG.md
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [v0.1.4](https://github.com/gary-kim/go-nc-talk/tree/v0.1.4) - 2020-09-22
+
+[Full Changelog](https://github.com/gary-kim/go-nc-talk/compare/v0.1.3...v0.1.4)
+
+### Fixed
+
+- Add ActorType for message data [\#18](https://github.com/gary-kim/go-nc-talk/pull/18) ([@gary-kim](https://github.com/gary-kim))
+
## [v0.1.3](https://github.com/gary-kim/go-nc-talk/tree/v0.1.3) - 2020-09-03
[Full Changelog](https://github.com/gary-kim/go-nc-talk/compare/v0.1.2...v0.1.3)
diff --git a/vendor/gomod.garykim.dev/nc-talk/ocs/message.go b/vendor/gomod.garykim.dev/nc-talk/ocs/message.go
index e23078de..9de28b47 100644
--- a/vendor/gomod.garykim.dev/nc-talk/ocs/message.go
+++ b/vendor/gomod.garykim.dev/nc-talk/ocs/message.go
@@ -22,6 +22,9 @@ import (
// MessageType describes what kind of message a returned Nextcloud Talk message is
type MessageType string
+// ActorType describes what kind of actor a returned Nextcloud Talk message is from
+type ActorType string
+
const (
// MessageComment is a Nextcloud Talk message that is a comment
MessageComment MessageType = "comment"
@@ -31,12 +34,19 @@ const (
// MessageCommand is a Nextcloud Talk message that is a command
MessageCommand MessageType = "command"
+
+ // ActorUser is a Nextcloud Talk message sent by a user
+ ActorUser ActorType = "users"
+
+ // ActorGuest is a Nextcloud Talk message sent by a guest
+ ActorGuest ActorType = "guests"
)
// TalkRoomMessageData describes the data part of a ocs response for a Talk room message
type TalkRoomMessageData struct {
Message string `json:"message"`
ID int `json:"id"`
+ ActorType ActorType `json:"actorType"`
ActorID string `json:"actorId"`
ActorDisplayName string `json:"actorDisplayName"`
SystemMessage string `json:"systemMessage"`
@@ -63,6 +73,17 @@ func (m *TalkRoomMessageData) PlainMessage() string {
return tr
}
+// DisplayName returns the display name for the sender of the message (" (Guest)" is appended if sent by a guest user)
+func (m *TalkRoomMessageData) DisplayName() string {
+ if m.ActorType == ActorGuest {
+ if m.ActorDisplayName == "" {
+ return "Guest"
+ }
+ return m.ActorDisplayName + " (Guest)"
+ }
+ return m.ActorDisplayName
+}
+
// TalkRoomMessage describes an ocs response for a Talk room message
type TalkRoomMessage struct {
OCS talkRoomMessage `json:"ocs"`