diff options
Diffstat (limited to 'vendor/gomod.garykim.dev/nc-talk/user')
-rw-r--r-- | vendor/gomod.garykim.dev/nc-talk/user/user.go | 58 |
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 |