public async static Task<long> send( OutgoingTextMessage message, long threadId) { //EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context); TextMessageDatabase database = DatabaseFactory.getTextMessageDatabase(); Recipients recipients = message.Recipients; bool keyExchange = message.IsKeyExchange; long allocatedThreadId; if (threadId == -1) { allocatedThreadId = DatabaseFactory.getThreadDatabase().GetThreadIdForRecipients(recipients); } else { allocatedThreadId = threadId; } long messageId = database.InsertMessageOutbox(allocatedThreadId, message, TimeUtil.GetDateTimeMillis()); await sendTextMessage(recipients, keyExchange, messageId); return allocatedThreadId; }
protected OutgoingTextMessage(OutgoingTextMessage message, string body) { this.Recipients = message.Recipients; this.MessageBody = body; }
public OutgoingPrekeyBundleMessage(OutgoingTextMessage message, String body) : base(message, body) { }
public OutgoingEndSessionMessage(OutgoingTextMessage message, string body) : base(message, body) { }
public OutgoingEndSessionMessage(OutgoingTextMessage message) : base(message, message.MessageBody) { }
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; }
public long InsertMessageOutbox(long threadId, OutgoingTextMessage message, DateTime date) { var type = MessageTypes.BASE_OUTBOX_TYPE; if (message.IsKeyExchange) type |= MessageTypes.KEY_EXCHANGE_BIT; else if (message.IsSecureMessage) type |= MessageTypes.SECURE_MESSAGE_BIT; else if (message.IsEndSession) type |= MessageTypes.END_SESSION_BIT; var insert = new Message(); insert.Address = message.Recipients.PrimaryRecipient.Number; // PhoneNumberUtils.formatNumber(message.Recipients.getPrimaryRecipient().getNumber()); // TODO: insert.ThreadId = threadId; insert.Body = message.MessageBody; insert.DateReceived = TimeUtil.GetDateTimeMillis(); insert.DateSent = date; insert.Read = true; insert.Type = type; var tmp = new TextMessageRecord(insert); // TODO: debug conn.Insert(insert); long messageId = insert.MessageId; DatabaseFactory.getThreadDatabase().Update(threadId); notifyConversationListeners(threadId); //jobManager.add(new TrimThreadJob(context, threadId)); return messageId; }