Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clientapi/clientapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/element-hq/dendrite/test/testrig"
"github.com/element-hq/dendrite/userapi"
uapi "github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
Expand Down Expand Up @@ -1074,7 +1073,7 @@ func TestTurnserver(t *testing.T) {
if !tc.wantEmptyResponse {
assert.NotEqual(t, "{}", rec.Body.String())

resp := gomatrix.RespTurnServer{}
resp := mautrix.RespTurnServer{}
err := json.NewDecoder(rec.Body).Decode(&resp)
assert.NoError(t, err)

Expand Down
10 changes: 7 additions & 3 deletions clientapi/routing/joinroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/element-hq/dendrite/internal/eventutil"
roomserverAPI "github.com/element-hq/dendrite/roomserver/api"
"github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"maunium.net/go/mautrix"
)

func JoinRoomByIDOrAlias(
Expand Down Expand Up @@ -107,9 +107,13 @@ func JoinRoomByIDOrAlias(
Code: http.StatusForbidden,
JSON: jsonErr,
}
case *gomatrix.HTTPError: // this ensures we proxy responses over federation to the client
case *mautrix.HTTPError: // this ensures we proxy responses over federation to the client
code := http.StatusInternalServerError
if e.Response != nil {
code = e.Response.StatusCode
}
response = util.JSONResponse{
Code: e.Code,
Code: code,
JSON: json.RawMessage(e.Message),
}
case eventutil.ErrRoomNoExists:
Expand Down
10 changes: 7 additions & 3 deletions clientapi/routing/peekroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

roomserverAPI "github.com/element-hq/dendrite/roomserver/api"
"github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"github.com/sirupsen/logrus"
"maunium.net/go/mautrix"
)

func PeekRoomByIDOrAlias(
Expand Down Expand Up @@ -58,9 +58,13 @@ func PeekRoomByIDOrAlias(
Code: http.StatusForbidden,
JSON: spec.Forbidden(e.Error()),
}
case *gomatrix.HTTPError:
case *mautrix.HTTPError:
code := http.StatusInternalServerError
if e.Response != nil {
code = e.Response.StatusCode
}
return util.JSONResponse{
Code: e.Code,
Code: code,
JSON: json.RawMessage(e.Message),
}
case nil:
Expand Down
6 changes: 3 additions & 3 deletions clientapi/routing/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/element-hq/dendrite/roomserver/types"
"github.com/element-hq/dendrite/setup/config"
userapi "github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/util"
"maunium.net/go/mautrix"
)

// GetProfile implements GET /profile/{userID}
Expand Down Expand Up @@ -320,8 +320,8 @@ func getProfile(
if !cfg.Matrix.IsLocalServerName(domain) {
profile, fedErr := federation.LookupProfile(ctx, cfg.Matrix.ServerName, domain, userID, "")
if fedErr != nil {
if x, ok := fedErr.(gomatrix.HTTPError); ok {
if x.Code == http.StatusNotFound {
if x, ok := fedErr.(mautrix.HTTPError); ok {
if x.IsStatus(http.StatusNotFound) {
return nil, appserviceAPI.ErrProfileNotExists
}
}
Expand Down
10 changes: 5 additions & 5 deletions clientapi/routing/room_tagging.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/element-hq/dendrite/clientapi/httputil"
"github.com/element-hq/dendrite/clientapi/producers"
"github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"maunium.net/go/mautrix/event"
)

// GetTags implements GET /_matrix/client/r0/user/{userID}/rooms/{roomID}/tags
Expand Down Expand Up @@ -70,7 +70,7 @@ func PutTag(
}
}

var properties gomatrix.TagProperties
var properties event.Tag
if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
return *reqErr
}
Expand All @@ -85,7 +85,7 @@ func PutTag(
}

if tagContent.Tags == nil {
tagContent.Tags = make(map[string]gomatrix.TagProperties)
tagContent.Tags = make(event.Tags)
}
tagContent.Tags[tag] = properties

Expand Down Expand Up @@ -164,7 +164,7 @@ func obtainSavedTags(
userID string,
roomID string,
userAPI api.ClientUserAPI,
) (tags gomatrix.TagContent, err error) {
) (tags event.TagEventContent, err error) {
dataReq := api.QueryAccountDataRequest{
UserID: userID,
RoomID: roomID,
Expand All @@ -191,7 +191,7 @@ func saveTagData(
userID string,
roomID string,
userAPI api.ClientUserAPI,
Tag gomatrix.TagContent,
Tag event.TagEventContent,
) error {
newTagData, err := json.Marshal(Tag)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions clientapi/routing/server_notices.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
"net/http"
"time"

"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/tokens"
"github.com/matrix-org/util"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"maunium.net/go/mautrix/event"

"github.com/element-hq/dendrite/roomserver/types"

Expand Down Expand Up @@ -169,9 +169,9 @@ func SendServerNotice(
roomID = data.RoomID

// tag the room, so we can later check if the user tries to reject an invite
serverAlertTag := gomatrix.TagContent{Tags: map[string]gomatrix.TagProperties{
serverAlertTag := event.TagEventContent{Tags: event.Tags{
"m.server_notice": {
Order: 1.0,
Order: json.Number("1"),
},
}}
if err = saveTagData(req, r.UserID, roomID, userAPI, serverAlertTag); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions clientapi/routing/userdirectory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"github.com/element-hq/dendrite/clientapi/auth/authtypes"
"github.com/element-hq/dendrite/roomserver/api"
userapi "github.com/element-hq/dendrite/userapi/api"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"maunium.net/go/mautrix"
)

type UserDirectoryResponse struct {
Expand Down Expand Up @@ -102,8 +102,8 @@ knownUsersLoop:
// TODO: We should probably cache/store this
fedProfile, fedErr := federation.LookupProfile(ctx, localServerName, serverName, userID, "")
if fedErr != nil {
if x, ok := fedErr.(gomatrix.HTTPError); ok {
if x.Code == http.StatusNotFound {
if x, ok := fedErr.(mautrix.HTTPError); ok {
if x.IsStatus(http.StatusNotFound) {
continue
}
}
Expand Down
4 changes: 2 additions & 2 deletions clientapi/routing/voip.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"net/http"
"time"

"github.com/matrix-org/gomatrix"
"github.com/matrix-org/util"
"maunium.net/go/mautrix"

"github.com/element-hq/dendrite/setup/config"
"github.com/element-hq/dendrite/userapi/api"
Expand All @@ -39,7 +39,7 @@ func RequestTurnServer(req *http.Request, device *api.Device, cfg *config.Client
// Duration checked at startup, err not possible
duration, _ := time.ParseDuration(turnConfig.UserLifetime)

resp := gomatrix.RespTurnServer{
resp := mautrix.RespTurnServer{
URIs: turnConfig.URIs,
TTL: int(duration.Seconds()),
}
Expand Down
Loading