Search in sources :

Example 16 with Message

use of im.actor.core.entity.Message 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 17 with Message

use of im.actor.core.entity.Message 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 18 with Message

use of im.actor.core.entity.Message in project actor-platform by actorapp.

the class SenderActor method doSendLocation.

public void doSendLocation(@NotNull Peer peer, @NotNull Double longitude, @NotNull Double latitude, @Nullable String street, @Nullable String place) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    LocationContent content = LocationContent.create(longitude, latitude, street, place);
    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 : LocationContent(im.actor.core.entity.content.LocationContent) 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 19 with Message

use of im.actor.core.entity.Message in project actor-platform by actorapp.

the class SenderActor method doSendSticker.

// Sending sticker
public void doSendSticker(@NotNull Peer peer, @NotNull Sticker sticker) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    StickerContent content = StickerContent.create(sticker);
    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 : StickerContent(im.actor.core.entity.content.StickerContent) 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 20 with Message

use of im.actor.core.entity.Message in project actor-platform by actorapp.

the class SenderActor method doForwardContent.

public void doForwardContent(Peer peer, AbsContent content) {
    long rid = RandomUtils.nextRid();
    long date = createPendingDate();
    long sortDate = date + 365 * 24 * 60 * 60 * 1000L;
    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) PendingMessage(im.actor.core.modules.messaging.actions.entity.PendingMessage)

Aggregations

Message (im.actor.core.entity.Message)28 ApiMessage (im.actor.core.api.ApiMessage)13 ApiTextMessage (im.actor.core.api.ApiTextMessage)12 ApiDocumentMessage (im.actor.core.api.ApiDocumentMessage)11 ApiJsonMessage (im.actor.core.api.ApiJsonMessage)11 RequestSendMessage (im.actor.core.api.rpc.RequestSendMessage)11 PendingMessage (im.actor.core.modules.messaging.actions.entity.PendingMessage)11 UpdateMessage (im.actor.core.api.updates.UpdateMessage)7 TextContent (im.actor.core.entity.content.TextContent)6 RouterOutgoingMessage (im.actor.core.modules.messaging.router.entity.RouterOutgoingMessage)6 ArrayList (java.util.ArrayList)6 ConversationState (im.actor.core.entity.ConversationState)5 Peer (im.actor.core.entity.Peer)5 AbsContent (im.actor.core.entity.content.AbsContent)5 Reaction (im.actor.core.entity.Reaction)3 UserVM (im.actor.core.viewmodel.UserVM)3 Void (im.actor.runtime.actors.messages.Void)3 ApiPeer (im.actor.core.api.ApiPeer)2 Dialog (im.actor.core.entity.Dialog)2 Sticker (im.actor.core.entity.Sticker)2