Search in sources :

Example 6 with PendingMessage

use of im.actor.core.modules.messaging.actions.entity.PendingMessage in project actor-platform by actorapp.

the class SenderActor method doSendAudio.

public void doSendAudio(Peer peer, String descriptor, String fileName, int fileSize, int duration) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    VoiceContent audioContent = VoiceContent.createLocalAudio(descriptor, fileName, fileSize, duration);
    Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, audioContent);
    context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
    pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, audioContent));
    savePending();
    performUploadFile(rid, descriptor, fileName);
}
Also used : VoiceContent(im.actor.core.entity.content.VoiceContent) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage) ApiTextMessage(im.actor.core.api.ApiTextMessage) Message(im.actor.core.entity.Message) ApiDocumentMessage(im.actor.core.api.ApiDocumentMessage) RequestSendMessage(im.actor.core.api.rpc.RequestSendMessage) ApiMessage(im.actor.core.api.ApiMessage) ApiJsonMessage(im.actor.core.api.ApiJsonMessage) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Example 7 with PendingMessage

use of im.actor.core.modules.messaging.actions.entity.PendingMessage in project actor-platform by actorapp.

the class SenderActor method doSendPhoto.

public void doSendPhoto(Peer peer, FastThumb fastThumb, String descriptor, String fileName, int fileSize, int w, int h) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    PhotoContent photoContent = PhotoContent.createLocalPhoto(descriptor, fileName, fileSize, w, h, fastThumb);
    Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, photoContent);
    context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
    pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, photoContent));
    savePending();
    performUploadFile(rid, descriptor, fileName);
}
Also used : PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage) ApiTextMessage(im.actor.core.api.ApiTextMessage) Message(im.actor.core.entity.Message) ApiDocumentMessage(im.actor.core.api.ApiDocumentMessage) RequestSendMessage(im.actor.core.api.rpc.RequestSendMessage) ApiMessage(im.actor.core.api.ApiMessage) ApiJsonMessage(im.actor.core.api.ApiJsonMessage) PhotoContent(im.actor.core.entity.content.PhotoContent) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Example 8 with PendingMessage

use of im.actor.core.modules.messaging.actions.entity.PendingMessage in project actor-platform by actorapp.

the class SenderActor method doSendContact.

public void doSendContact(@NotNull Peer peer, @NotNull ArrayList<String> emails, @NotNull ArrayList<String> phones, @Nullable String name, @Nullable String base64photo) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    ContactContent content = ContactContent.create(name, phones, emails, base64photo);
    Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, content);
    context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
    pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, content));
    savePending();
    performSendContent(peer, rid, content);
}
Also used : PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage) ApiTextMessage(im.actor.core.api.ApiTextMessage) Message(im.actor.core.entity.Message) ApiDocumentMessage(im.actor.core.api.ApiDocumentMessage) RequestSendMessage(im.actor.core.api.rpc.RequestSendMessage) ApiMessage(im.actor.core.api.ApiMessage) ApiJsonMessage(im.actor.core.api.ApiJsonMessage) ContactContent(im.actor.core.entity.content.ContactContent) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Example 9 with PendingMessage

use of im.actor.core.modules.messaging.actions.entity.PendingMessage in project actor-platform by actorapp.

the class SenderActor method doSendVideo.

public void doSendVideo(Peer peer, String fileName, int w, int h, int duration, FastThumb fastThumb, String descriptor, int fileSize) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    VideoContent videoContent = VideoContent.createLocalVideo(descriptor, fileName, fileSize, w, h, duration, fastThumb);
    Message message = new Message(rid, sortDate, date, myUid(), MessageState.PENDING, videoContent);
    context().getMessagesModule().getRouter().onOutgoingMessage(peer, message);
    pendingMessages.getPendingMessages().add(new PendingMessage(peer, rid, videoContent));
    savePending();
    performUploadFile(rid, descriptor, fileName);
}
Also used : VideoContent(im.actor.core.entity.content.VideoContent) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage) ApiTextMessage(im.actor.core.api.ApiTextMessage) Message(im.actor.core.entity.Message) ApiDocumentMessage(im.actor.core.api.ApiDocumentMessage) RequestSendMessage(im.actor.core.api.rpc.RequestSendMessage) ApiMessage(im.actor.core.api.ApiMessage) ApiJsonMessage(im.actor.core.api.ApiJsonMessage) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Example 10 with PendingMessage

use of im.actor.core.modules.messaging.actions.entity.PendingMessage in project actor-platform by actorapp.

the class SenderActor method onError.

private void onError(Peer peer, long rid) {
    for (PendingMessage pending : pendingMessages.getPendingMessages()) {
        if (pending.getRid() == rid && pending.getPeer().equals(peer)) {
            pendingMessages.getPendingMessages().remove(pending);
            break;
        }
    }
    savePending();
    context().getMessagesModule().getRouter().onOutgoingError(peer, rid);
}
Also used : PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Aggregations

PendingMessage (im.actor.core.modules.messaging.actions.entity.PendingMessage)15 ApiDocumentMessage (im.actor.core.api.ApiDocumentMessage)11 ApiJsonMessage (im.actor.core.api.ApiJsonMessage)11 ApiMessage (im.actor.core.api.ApiMessage)11 ApiTextMessage (im.actor.core.api.ApiTextMessage)11 RequestSendMessage (im.actor.core.api.rpc.RequestSendMessage)11 Message (im.actor.core.entity.Message)11 DocumentContent (im.actor.core.entity.content.DocumentContent)3 AnimationContent (im.actor.core.entity.content.AnimationContent)2 PhotoContent (im.actor.core.entity.content.PhotoContent)2 TextContent (im.actor.core.entity.content.TextContent)2 VideoContent (im.actor.core.entity.content.VideoContent)2 VoiceContent (im.actor.core.entity.content.VoiceContent)2 Group (im.actor.core.entity.Group)1 GroupMember (im.actor.core.entity.GroupMember)1 User (im.actor.core.entity.User)1 AbsContent (im.actor.core.entity.content.AbsContent)1 ContactContent (im.actor.core.entity.content.ContactContent)1 FileLocalSource (im.actor.core.entity.content.FileLocalSource)1 LocationContent (im.actor.core.entity.content.LocationContent)1