示例#1
0
        private void handleSynchronizeSentMessage(SignalServiceEnvelope 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());
        }
示例#2
0
 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));
     }
 }
示例#3
0
        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);
        }