Fix deprecated method calls
This commit is contained in:
@@ -49,7 +49,7 @@ public class GoogleFirebaseProvider extends GoogleFirebaseBackend implements ITh
|
||||
}
|
||||
|
||||
private String getMxid(UserRecord record) {
|
||||
return new MatrixID(record.getUid(), domain).getId();
|
||||
return MatrixID.asAcceptable(record.getUid(), domain).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -148,7 +148,7 @@ public class MemoryIdentityStore implements AuthenticatorProvider, IDirectoryPro
|
||||
for (MemoryIdentityConfig id : cfg.getIdentities()) {
|
||||
for (MemoryThreePid threepid : id.getThreepids()) {
|
||||
if (req.equals(new ThreePid(threepid.getMedium(), threepid.getAddress()))) {
|
||||
return Optional.of(new SingleLookupReply(request, new MatrixID(id.getUsername(), mxCfg.getDomain())));
|
||||
return Optional.of(new SingleLookupReply(request, MatrixID.asAcceptable(id.getUsername(), mxCfg.getDomain())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ public class RestDirectoryProvider extends RestProvider implements IDirectoryPro
|
||||
|
||||
UserDirectorySearchResult response = parser.parse(httpResponse, UserDirectorySearchResult.class);
|
||||
for (UserDirectorySearchResult.Result result : response.getResults()) {
|
||||
result.setUserId(new MatrixID(result.getUserId(), mxCfg.getDomain()).getId());
|
||||
result.setUserId(MatrixID.asAcceptable(result.getUserId(), mxCfg.getDomain()).getId());
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@@ -60,9 +60,9 @@ public class RestThreePidProvider extends RestProvider implements IThreePidProvi
|
||||
// TODO refactor in lookup manager with above FIXME
|
||||
private _MatrixID getMxId(UserID id) {
|
||||
if (UserIdType.Localpart.is(id.getType())) {
|
||||
return new MatrixID(id.getValue(), mxCfg.getDomain());
|
||||
return MatrixID.asAcceptable(id.getValue(), mxCfg.getDomain());
|
||||
} else {
|
||||
return new MatrixID(id.getValue());
|
||||
return MatrixID.asAcceptable(id.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -85,11 +85,11 @@ public abstract class SqlThreePidProvider implements IThreePidProvider {
|
||||
log.info("Found match: {}", uid);
|
||||
if (StringUtils.equals("uid", cfg.getIdentity().getType())) {
|
||||
log.info("Resolving as localpart");
|
||||
return Optional.of(new SingleLookupReply(request, new MatrixID(uid, mxCfg.getDomain())));
|
||||
return Optional.of(new SingleLookupReply(request, MatrixID.asAcceptable(uid, mxCfg.getDomain())));
|
||||
}
|
||||
if (StringUtils.equals("mxid", cfg.getIdentity().getType())) {
|
||||
log.info("Resolving as MXID");
|
||||
return Optional.of(new SingleLookupReply(request, new MatrixID(uid)));
|
||||
return Optional.of(new SingleLookupReply(request, MatrixID.asAcceptable(uid)));
|
||||
}
|
||||
|
||||
log.info("Identity type is unknown, skipping");
|
||||
|
@@ -86,7 +86,7 @@ public abstract class GenericSqlDirectoryProvider implements IDirectoryProvider
|
||||
while (rSet.next()) {
|
||||
processRow(rSet).ifPresent(e -> {
|
||||
if (StringUtils.equalsIgnoreCase("localpart", query.getType())) {
|
||||
e.setUserId(new MatrixID(e.getUserId(), mxCfg.getDomain()).getId());
|
||||
e.setUserId(MatrixID.asAcceptable(e.getUserId(), mxCfg.getDomain()).getId());
|
||||
}
|
||||
result.addResult(e);
|
||||
});
|
||||
|
@@ -73,7 +73,7 @@ class InvitationController {
|
||||
for (String key : request.getParameterMap().keySet()) {
|
||||
parameters.put(key, request.getParameter(key));
|
||||
}
|
||||
IThreePidInvite invite = new ThreePidInvite(new MatrixID(sender), medium, address, roomId, parameters);
|
||||
IThreePidInvite invite = new ThreePidInvite(MatrixID.asAcceptable(sender), medium, address, roomId, parameters);
|
||||
IThreePidInviteReply reply = mgr.storeInvite(invite);
|
||||
|
||||
return gson.toJson(new ThreePidInviteReplyIO(reply, keyMgr.getPublicKeyBase64(keyMgr.getCurrentIndex()), srvCfg.getPublicUrl()));
|
||||
|
@@ -108,7 +108,7 @@ public class InvitationManager {
|
||||
ioList.forEach(io -> {
|
||||
log.info("Processing invite {}", gson.toJson(io));
|
||||
ThreePidInvite invite = new ThreePidInvite(
|
||||
new MatrixID(io.getSender()),
|
||||
MatrixID.asAcceptable(io.getSender()),
|
||||
io.getMedium(),
|
||||
io.getAddress(),
|
||||
io.getRoomId(),
|
||||
|
@@ -48,7 +48,7 @@ public class SingleLookupReply {
|
||||
|
||||
try {
|
||||
SingeLookupReplyJson json = gson.fromJson(body, SingeLookupReplyJson.class);
|
||||
reply.mxid = new MatrixID(json.getMxid());
|
||||
reply.mxid = MatrixID.asAcceptable(json.getMxid());
|
||||
reply.notAfter = Instant.ofEpochMilli(json.getNot_after());
|
||||
reply.notBefore = Instant.ofEpochMilli(json.getNot_before());
|
||||
reply.timestamp = Instant.ofEpochMilli(json.getTs());
|
||||
@@ -64,7 +64,7 @@ public class SingleLookupReply {
|
||||
}
|
||||
|
||||
public SingleLookupReply(SingleLookupRequest request, String mxid) {
|
||||
this(request, new MatrixID(mxid));
|
||||
this(request, MatrixID.asAcceptable(mxid));
|
||||
}
|
||||
|
||||
public SingleLookupReply(SingleLookupRequest request, _MatrixID mxid) {
|
||||
|
@@ -218,7 +218,7 @@ public class SessionMananger {
|
||||
}
|
||||
|
||||
public void bind(String sid, String secret, String mxidRaw) {
|
||||
_MatrixID mxid = new MatrixID(mxidRaw);
|
||||
_MatrixID mxid = MatrixID.asAcceptable(mxidRaw);
|
||||
ThreePidSession session = getSessionIfValidated(sid, secret);
|
||||
|
||||
if (!session.isRemote()) {
|
||||
|
@@ -93,7 +93,7 @@ public class RestDirectoryProviderTest {
|
||||
assertNotNull(entry);
|
||||
assertTrue(StringUtils.equals(byNameAvatar, entry.getAvatarUrl()));
|
||||
assertTrue(StringUtils.equals(byNameDisplay, entry.getDisplayName()));
|
||||
assertTrue(StringUtils.equals(new MatrixID(byNameId, domain).getId(), entry.getUserId()));
|
||||
assertTrue(StringUtils.equals(MatrixID.asAcceptable(byNameId, domain).getId(), entry.getUserId()));
|
||||
|
||||
verify(postRequestedFor(urlMatching(endpoint))
|
||||
.withHeader("Content-Type", containing("application/json"))
|
||||
@@ -136,7 +136,7 @@ public class RestDirectoryProviderTest {
|
||||
assertNotNull(entry);
|
||||
assertTrue(StringUtils.equals(byThreepidAvatar, entry.getAvatarUrl()));
|
||||
assertTrue(StringUtils.equals(byThreepidDisplay, entry.getDisplayName()));
|
||||
assertTrue(StringUtils.equals(new MatrixID(byThreepidId, domain).getId(), entry.getUserId()));
|
||||
assertTrue(StringUtils.equals(MatrixID.asAcceptable(byThreepidId, domain).getId(), entry.getUserId()));
|
||||
|
||||
verify(postRequestedFor(urlMatching(endpoint))
|
||||
.withHeader("Content-Type", containing("application/json"))
|
||||
|
Reference in New Issue
Block a user