public static TextSecureSyncMessage forSentTranscript(SentTranscriptMessage sent) { return(new TextSecureSyncMessage(new May <SentTranscriptMessage>(sent), May <TextSecureAttachment> .NoValue, May <TextSecureAttachment> .NoValue, May <RequestMessage> .NoValue)); }
public static TextSecureSyncMessage forSentTranscript(SentTranscriptMessage sent) { return new TextSecureSyncMessage(new May<SentTranscriptMessage>(sent), May<TextSecureAttachment>.NoValue, May<TextSecureAttachment>.NoValue, May<RequestMessage>.NoValue); }
private Recipients getSyncMessageDestination(SentTranscriptMessage message) { if (message.getMessage().getGroupInfo().HasValue) { throw new NotImplementedException("GROUP getSyncMessageDestination"); //return RecipientFactory.getRecipientsFromString(GroupUtil.getEncodedId(message.getMessage().getGroupInfo().get().getGroupId()), false); // TODO: Group enable } else { return RecipientFactory.getRecipientsFromString(message.getDestination().ForceGetValue(), false); } }
private long handleSynchronizeSentMediaMessage(SentTranscriptMessage message, May<long> smsMessageId) // throws MmsException { throw new NotImplementedException("handleSynchronizeSentMediaMessage"); /*MmsDatabase database = DatabaseFactory.getMmsDatabase(); Recipients recipients = getSyncMessageDestination(message); OutgoingMediaMessage mediaMessage = new OutgoingMediaMessage(recipients, message.getMessage().getBody().orNull(), PointerAttachment.forPointers(masterSecret, message.getMessage().getAttachments()), message.getTimestamp(), ThreadDatabase.DistributionTypes.DEFAULT); mediaMessage = new OutgoingSecureMediaMessage(mediaMessage); long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipients); long messageId = database.insertMessageOutbox(masterSecret, mediaMessage, threadId, false); database.markAsSent(messageId); database.markAsPush(messageId); for (DatabaseAttachment attachment : DatabaseFactory.getAttachmentDatabase(context).getAttachmentsForMessage(messageId)) { ApplicationContext.getInstance(context) .getJobManager() .add(new AttachmentDownloadJob(context, messageId, attachment.getAttachmentId())); } if (smsMessageId.isPresent()) { DatabaseFactory.getSmsDatabase(context).deleteMessage(smsMessageId.get()); } return threadId;*/ }
private long handleSynchronizeSentTextMessage(SentTranscriptMessage message, May<long> smsMessageId) { var textMessageDatabase = DatabaseFactory.getTextMessageDatabase();//getEncryptingSmsDatabase(context); Recipients recipients = getSyncMessageDestination(message); String body = message.getMessage().getBody().HasValue ? message.getMessage().getBody().ForceGetValue() : ""; OutgoingTextMessage outgoingTextMessage = new OutgoingTextMessage(recipients, body); long threadId = DatabaseFactory.getThreadDatabase().GetThreadIdForRecipients(recipients); long messageId = textMessageDatabase.InsertMessageOutbox(threadId, outgoingTextMessage, TimeUtil.GetDateTime(message.getTimestamp())); textMessageDatabase.MarkAsSent(messageId); textMessageDatabase.MarkAsPush(messageId); textMessageDatabase.MarkAsSecure(messageId); if (smsMessageId.HasValue) { textMessageDatabase.Delete(smsMessageId.ForceGetValue()); } return threadId; }
private void handleSynchronizeSentMessage(TextSecureEnvelope envelope, SentTranscriptMessage message, May<long> smsMessageId) // throws MmsException { long threadId; if (message.getMessage().isGroupUpdate()) { throw new NotImplementedException("GROUP handleSynchronizeSentMessage"); //threadId = GroupMessageProcessor.process(context, masterSecret, envelope, message.getMessage(), true); // TODO: Group enable } else if (message.getMessage().getAttachments().HasValue) { threadId = handleSynchronizeSentMediaMessage(message, smsMessageId); } else { threadId = handleSynchronizeSentTextMessage(message, smsMessageId); } if (threadId == 0L) return; DatabaseFactory.getThreadDatabase().SetRead(threadId); //MessageNotifier.updateNotification(getContext(), masterSecret.getMasterSecret().orNull()); }