Search in sources :

Example 6 with UpdateMessage

use of im.actor.core.api.updates.UpdateMessage in project actor-platform by actorapp.

the class MessagesProcessor method onDifferenceMessages.

@Verified
public Promise<Void> onDifferenceMessages(ApiPeer _peer, List<UpdateMessage> messages) {
    Peer peer = convert(_peer);
    ArrayList<Message> nMessages = new ArrayList<>();
    for (UpdateMessage u : messages) {
        AbsContent msgContent = AbsContent.fromMessage(u.getMessage());
        nMessages.add(new Message(u.getRid(), u.getDate(), u.getDate(), u.getSenderUid(), myUid() == u.getSenderUid() ? MessageState.SENT : MessageState.UNKNOWN, msgContent));
    }
    return context().getMessagesModule().getRouter().onNewMessages(peer, nMessages);
}
Also used : UpdateMessage(im.actor.core.api.updates.UpdateMessage) UpdateMessage(im.actor.core.api.updates.UpdateMessage) ApiMessage(im.actor.core.api.ApiMessage) Message(im.actor.core.entity.Message) ApiPeer(im.actor.core.api.ApiPeer) Peer(im.actor.core.entity.Peer) ArrayList(java.util.ArrayList) AbsContent(im.actor.core.entity.content.AbsContent) Verified(im.actor.runtime.annotations.Verified)

Aggregations

UpdateMessage (im.actor.core.api.updates.UpdateMessage)6 ArrayList (java.util.ArrayList)4 UpdateChatGroupsChanged (im.actor.core.api.updates.UpdateChatGroupsChanged)3 Peer (im.actor.core.entity.Peer)3 ApiDialogGroup (im.actor.core.api.ApiDialogGroup)2 ApiDialogShort (im.actor.core.api.ApiDialogShort)2 UpdateMessageRead (im.actor.core.api.updates.UpdateMessageRead)2 UpdateMessageReadByMe (im.actor.core.api.updates.UpdateMessageReadByMe)2 UpdateMessageReceived (im.actor.core.api.updates.UpdateMessageReceived)2 Message (im.actor.core.entity.Message)2 AbsContent (im.actor.core.entity.content.AbsContent)2 ApiMember (im.actor.core.api.ApiMember)1 ApiMessage (im.actor.core.api.ApiMessage)1 ApiMessageReaction (im.actor.core.api.ApiMessageReaction)1 ApiPeer (im.actor.core.api.ApiPeer)1 UpdateChatClear (im.actor.core.api.updates.UpdateChatClear)1 UpdateChatDelete (im.actor.core.api.updates.UpdateChatDelete)1 UpdateChatDropCache (im.actor.core.api.updates.UpdateChatDropCache)1 UpdateContactRegistered (im.actor.core.api.updates.UpdateContactRegistered)1 UpdateContactsAdded (im.actor.core.api.updates.UpdateContactsAdded)1