Search in sources :

Example 1 with MemoryIdentityConfig

use of io.kamax.mxisd.config.memory.MemoryIdentityConfig in project mxisd by kamax-io.

the class MemoryIdentityStore method find.

@Override
public Optional<SingleLookupReply> find(SingleLookupRequest request) {
    logger.info("Performing lookup {} of type {}", request.getThreePid(), request.getType());
    ThreePid req = new ThreePid(request.getType(), request.getThreePid());
    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.empty();
}
Also used : SingleLookupReply(io.kamax.mxisd.lookup.SingleLookupReply) MemoryIdentityConfig(io.kamax.mxisd.config.memory.MemoryIdentityConfig) io.kamax.matrix._ThreePid(io.kamax.matrix._ThreePid) ThreePid(io.kamax.matrix.ThreePid) MemoryThreePid(io.kamax.mxisd.config.memory.MemoryThreePid) MemoryThreePid(io.kamax.mxisd.config.memory.MemoryThreePid) MatrixID(io.kamax.matrix.MatrixID) io.kamax.matrix._MatrixID(io.kamax.matrix._MatrixID)

Aggregations

MatrixID (io.kamax.matrix.MatrixID)1 ThreePid (io.kamax.matrix.ThreePid)1 io.kamax.matrix._MatrixID (io.kamax.matrix._MatrixID)1 io.kamax.matrix._ThreePid (io.kamax.matrix._ThreePid)1 MemoryIdentityConfig (io.kamax.mxisd.config.memory.MemoryIdentityConfig)1 MemoryThreePid (io.kamax.mxisd.config.memory.MemoryThreePid)1 SingleLookupReply (io.kamax.mxisd.lookup.SingleLookupReply)1