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