summaryrefslogtreecommitdiffstats
path: root/vendor/gomod.garykim.dev/nc-talk/user/user.go
diff options
context:
space:
mode:
authorGary Kim <gary@garykim.dev>2020-12-10 07:06:27 +0800
committerGitHub <noreply@github.com>2020-12-10 00:06:27 +0100
commit41b4e64be9216f5fa6db694b7a8f47f34ca415be (patch)
tree559ff1a6e8896cba67aff5f519009a9611280818 /vendor/gomod.garykim.dev/nc-talk/user/user.go
parent0d7315249d20bf9856605068074a7b6c6bcce835 (diff)
downloadmatterbridge-msglm-41b4e64be9216f5fa6db694b7a8f47f34ca415be.tar.gz
matterbridge-msglm-41b4e64be9216f5fa6db694b7a8f47f34ca415be.tar.bz2
matterbridge-msglm-41b4e64be9216f5fa6db694b7a8f47f34ca415be.zip
Update go-nc-talk (nctalk) (#1333)
Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'vendor/gomod.garykim.dev/nc-talk/user/user.go')
-rw-r--r--vendor/gomod.garykim.dev/nc-talk/user/user.go58
1 files changed, 31 insertions, 27 deletions
diff --git a/vendor/gomod.garykim.dev/nc-talk/user/user.go b/vendor/gomod.garykim.dev/nc-talk/user/user.go
index 08c01e33..2b42dacf 100644
--- a/vendor/gomod.garykim.dev/nc-talk/user/user.go
+++ b/vendor/gomod.garykim.dev/nc-talk/user/user.go
@@ -87,38 +87,38 @@ type Capabilities struct {
// RoomInfo contains information about a room
type RoomInfo struct {
- Token string `json:"token"`
- Name string `json:"name"`
- DisplayName string `json:"displayName"`
- SessionID string `json:"sessionId"`
- ObjectType string `json:"objectType"`
- ObjectID string `json:"objectId"`
- Type int `json:"type"`
- ParticipantType int `json:"participantType"`
- ParticipantFlags int `json:"participantFlags"`
- ReadOnly int `json:"readOnly"`
- LastPing int `json:"lastPing"`
- LastActivity int `json:"lastActivity"`
- NotificationLevel int `json:"notificationLevel"`
- LobbyState int `json:"lobbyState"`
- LobbyTimer int `json:"lobbyTimer"`
- UnreadMessages int `json:"unreadMessages"`
- LastReadMessage int `json:"lastReadMessage"`
- HasPassword bool `json:"hasPassword"`
- HasCall bool `json:"hasCall"`
- CanStartCall bool `json:"canStartCall"`
- CanDeleteConversation bool `json:"canDeleteConversation"`
- CanLeaveConversation bool `json:"canLeaveConversation"`
- IsFavorite bool `json:"isFavorite"`
- UnreadMention bool `json:"unreadMention"`
- LastMessage ocs.TalkRoomMessageData `json:"lastMessage"`
+ Token string `json:"token"`
+ Name string `json:"name"`
+ DisplayName string `json:"displayName"`
+ SessionID string `json:"sessionId"`
+ ObjectType string `json:"objectType"`
+ ObjectID string `json:"objectId"`
+ Type int `json:"type"`
+ ParticipantType int `json:"participantType"`
+ ParticipantFlags int `json:"participantFlags"`
+ ReadOnly int `json:"readOnly"`
+ LastPing int `json:"lastPing"`
+ LastActivity int `json:"lastActivity"`
+ NotificationLevel int `json:"notificationLevel"`
+ LobbyState int `json:"lobbyState"`
+ LobbyTimer int `json:"lobbyTimer"`
+ UnreadMessages int `json:"unreadMessages"`
+ LastReadMessage int `json:"lastReadMessage"`
+ HasPassword bool `json:"hasPassword"`
+ HasCall bool `json:"hasCall"`
+ CanStartCall bool `json:"canStartCall"`
+ CanDeleteConversation bool `json:"canDeleteConversation"`
+ CanLeaveConversation bool `json:"canLeaveConversation"`
+ IsFavorite bool `json:"isFavorite"`
+ UnreadMention bool `json:"unreadMention"`
+ LastMessage *ocs.TalkRoomMessageData `json:"lastMessage"`
}
// NewUser returns a TalkUser instance
// The url should be the full URL of the Nextcloud instance (e.g. https://cloud.mydomain.me)
func NewUser(url string, username string, password string, config *TalkUserConfig) (*TalkUser, error) {
return &TalkUser{
- NextcloudURL: url,
+ NextcloudURL: strings.TrimSuffix(url, "/"),
User: username,
Pass: password,
Config: config,
@@ -143,7 +143,11 @@ func (t *TalkUser) RequestClient(client request.Client) *request.Client {
// Set Nextcloud URL if there is no host
if !strings.HasPrefix(client.URL, t.NextcloudURL) {
- client.URL = t.NextcloudURL + "/" + client.URL
+ if strings.HasPrefix(client.URL, "/") {
+ client.URL = t.NextcloudURL + client.URL
+ } else {
+ client.URL = t.NextcloudURL + "/" + client.URL
+ }
}
// Set TLS Config