Translates Foundation conversation participants to Chat SDK conversation participants.

@param participants Foundation conversation participants.
@return Chat SDK result.
420828
public List<ChatParticipant> adapt(List<Participant> participants) {
        List<ChatParticipant> result = new ArrayList<>();
        if (participants != null && !participants.isEmpty()) {
            for (Participant p : participants) {
                result.add(ChatParticipant.builder().populate(p).build());
            }
        }
        return result;
    }
570207
function setConversationEtagHeader(res, conversationInfo) {
    var copy = JSON.parse(JSON.stringify(conversationInfo));
    delete copy.participants;
    delete copy.createdOn;
    delete copy.updatedOn;
    setEtagHeader(res, copy);
}
584053
public void removeListener(final ParticipantsListener participantsListener) {
        MessagingListener messagingListener = participantsListeners.get(participantsListener);
        if (messagingListener != null) {
            client.removeListener(messagingListener);
            participantsListeners.remove(participantsListener);
        }
    }
1303819
private static Stream<String> getAgentMembers(final IdentifierConverter<Resource, FedoraResource> translator,
                                                  final FedoraResource resource, final String hashPortion) {

        //resolve list of triples, accounting for hash-uris.
        final List<Triple> triples = resource.getTriples(translator, PROPERTIES).filter(
            triple -> hashPortion == null || triple.getSubject().getURI().endsWith(hashPortion)).collect(toList());
        //determine if there is a rdf:type vcard:Group
        final boolean hasVcardGroup = triples.stream().anyMatch(
            triple -> triple.matches(triple.getSubject(), RDF_TYPE_NODE, VCARD_GROUP_NODE));
        //return members only if there is an associated vcard:Group
        if (hasVcardGroup) {
            return triples.stream()
                          .filter(triple -> triple.predicateMatches(VCARD_MEMBER_NODE))
                          .map(Triple::getObject).flatMap(WebACRolesProvider::nodeToStringStream)
                                                 .map(WebACRolesProvider::stripUserAgentBaseURI);
        } else {
            return empty();
        }
    }
286440
Observable<ComapiResult<ConversationDetails>> doCreateConversation(@NonNull final String token, @NonNull final ConversationCreate request) {
        return wrapObservable(service.createConversation(AuthManager.addAuthPrefix(token), apiSpaceId, request)
                .map(mapToComapiResult()), log, "Creating conversation" + request.getName());
    }
846977
public Observable<ComapiResult<List<Conversation>>> getConversations(final boolean isPublic) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueGetConversationsExt(isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), isPublic ? Scope.PUBLIC : Scope.PARTICIPANT);
        }
    }
484004
public Observable<ComapiResult<ConversationDetails>> createConversation(@NonNull final ConversationCreate request) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueCreateConversation(request);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doCreateConversation(token, request);
        }
    }
1197688
public AVIMConversationsQuery withMembers(List<String> peerIds, boolean includeSelf) {
    Set<String> targetPeerIds = new HashSet<String>(peerIds);
    if (includeSelf) {
      targetPeerIds.add(client.getClientId());
    }
    containsMembers(new LinkedList<String>(targetPeerIds));
    this.whereSizeEqual(Conversation.MEMBERS, targetPeerIds.size());
    return this;
  }
597503
public Chat createChat(EntityJid userJID, ChatMessageListener listener) {
        return createChat(userJID, null, listener);
    }
806853
function(messageContent, threadId) {
                /**
                 * + forwardInfo                  {object : forwardInfoVO}
                 *   - participant                {object : ParticipantVO}
                 *   - conversation               {object : ConversationSummary}
                 */

                var forwardInfo = {
                    participant: undefined,
                    conversation: undefined
                };

                if (messageContent.conversation) {
                    forwardInfo.conversation = formatDataToMakeConversation(messageContent.conversation);
                }

                if (messageContent.participant) {
                    forwardInfo.participant = formatDataToMakeParticipant(messageContent.participant, threadId);
                }

                return forwardInfo;
            }
749379
@Local
    public CompletableFuture<Integer> sendMessage(final Convert convert, final Object message0, final boolean last, final Serializable... userids) {
        if (userids == null || userids.length < 1) return CompletableFuture.completedFuture(RETCODE_GROUP_EMPTY);
        if (message0 instanceof CompletableFuture) return ((CompletableFuture) message0).thenApply(msg -> sendMessage(convert, msg, last, userids));
        final Object message = (convert == null || message0 instanceof WebSocketPacket) ? message0 : ((convert instanceof TextConvert) ? new WebSocketPacket(((TextConvert) convert).convertTo(message0), last) : new WebSocketPacket(((BinaryConvert) convert).convertTo(message0), last));
        if (this.localEngine != null && this.sncpNodeAddresses == null) { //本地模式且没有分布式
            return this.localEngine.sendLocalMessage(message, last, userids);
        }
        final Object remoteMessage = formatRemoteMessage(message);
        CompletableFuture<Integer> rsfuture;
        if (userids.length == 1) {
            rsfuture = sendOneUserMessage(remoteMessage, last, userids[0]);
        } else {
            String[] keys = new String[userids.length];
            final Map<String, Serializable> keyuser = new HashMap<>();
            for (int i = 0; i < userids.length; i++) {
                keys[i] = SOURCE_SNCP_USERID_PREFIX + userids[i];
                keyuser.put(keys[i], userids[i]);
            }
            tryAcquireSemaphore();
            CompletableFuture<Map<String, Collection<InetSocketAddress>>> addrsFuture = sncpNodeAddresses.getCollectionMapAsync(InetSocketAddress.class, keys);
            if (semaphore != null) addrsFuture.whenComplete((r, e) -> releaseSemaphore());
            rsfuture = addrsFuture.thenCompose((Map<String, Collection<InetSocketAddress>> addrs) -> {
                if (addrs == null || addrs.isEmpty()) {
                    if (logger.isLoggable(Level.FINER)) logger.finer("websocket not found userids:" + JsonConvert.root().convertTo(userids) + " on any node ");
                    return CompletableFuture.completedFuture(RETCODE_GROUP_EMPTY);
                }
                Map<InetSocketAddress, List<Serializable>> addrUsers = new HashMap<>();
                addrs.forEach((key, as) -> {
                    for (InetSocketAddress a : as) {
                        addrUsers.computeIfAbsent(a, k -> new ArrayList<>()).add(keyuser.get(key));
                    }
                });
                if (logger.isLoggable(Level.FINEST)) {
                    logger.finest("websocket(localaddr=" + localSncpAddress + ", userids=" + JsonConvert.root().convertTo(userids) + ") found message-addr-userids: " + addrUsers);
                }
                CompletableFuture<Integer> future = null;
                for (Map.Entry<InetSocketAddress, List<Serializable>> en : addrUsers.entrySet()) {
                    Serializable[] us = en.getValue().toArray(new Serializable[en.getValue().size()]);
                    future = future == null ? sendOneAddrMessage(en.getKey(), remoteMessage, last, us)
                        : future.thenCombine(sendOneAddrMessage(en.getKey(), remoteMessage, last, us), (a, b) -> a | b);
                }
                return future == null ? CompletableFuture.completedFuture(RETCODE_GROUP_EMPTY) : future;
            });
        }
        return rsfuture == null ? CompletableFuture.completedFuture(RETCODE_GROUP_EMPTY) : rsfuture;
    }
1177079
@Override
    public Response recipients(Iterable<String> usernames) {
    	this.usernames.addAll(Sets.newHashSet(usernames));
    	return this;
    }
1200835
public Observable<ComapiResult<ConversationDetails>> getConversation(@NonNull final String conversationId) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueGetConversation(conversationId);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doGetConversation(token, conversationId);
        }
    }
1361202
public Observable<ComapiResult<List<Participant>>> getParticipants(@NonNull final String conversationId) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueGetParticipants(conversationId);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doGetParticipants(token, conversationId);
        }
    }
963185
@Deprecated
    public void getConversations(@NonNull final Scope scope, @Nullable Callback<ComapiResult<List<ConversationDetails>>> callback) {
        adapter.adapt(getConversations(scope), callback);
    }
540079
public ParticipantIdentity getParticipantIdentity(Participant participant) {
		if (participantIdentities != null) {
			for (ParticipantIdentity participantIdentity : participantIdentities) {
				if (participant.getParticipantId() == participantIdentity.getParticipantId()) {
					return participantIdentity;
				}
			}
		}
		
		return null;
	}
764905
Observable<ChatResult> synchroniseConversation(String conversationId) {

        return checkState().flatMap(client -> client.service().messaging()
                .queryMessages(conversationId, null, 1)
                .map(result -> {
                    if (result.isSuccessful() && result.getResult() != null) {
                        return (long) result.getResult().getLatestEventId();
                    }
                    return -1L;
                })
                .flatMap(result -> persistenceController.getConversation(conversationId).map(loaded -> compare(result, loaded)))
                .flatMap(this::updateLocalConversationList)
                .flatMap(result -> lookForMissingEvents(client, result))
                .map(result -> new ChatResult(result.isSuccessful, null)));
    }