That fuck shit the fascists are using
1package org.tm.archive.database
2
3import org.tm.archive.database.model.ParentStoryId
4import org.tm.archive.database.model.StoryType
5import org.tm.archive.database.model.databaseprotos.GiftBadge
6import org.tm.archive.mms.IncomingMessage
7import org.tm.archive.mms.OutgoingMessage
8import org.tm.archive.recipients.Recipient
9import java.util.Optional
10
11/**
12 * Helper methods for inserting an MMS message into the MMS table.
13 */
14object MmsHelper {
15
16 fun insert(
17 recipient: Recipient = Recipient.UNKNOWN,
18 body: String = "body",
19 sentTimeMillis: Long = System.currentTimeMillis(),
20 expiresIn: Long = 0,
21 viewOnce: Boolean = false,
22 distributionType: Int = ThreadTable.DistributionTypes.DEFAULT,
23 threadId: Long = SignalDatabase.threads.getOrCreateThreadIdFor(recipient, distributionType),
24 storyType: StoryType = StoryType.NONE,
25 parentStoryId: ParentStoryId? = null,
26 isStoryReaction: Boolean = false,
27 giftBadge: GiftBadge? = null,
28 secure: Boolean = true
29 ): Long {
30 val message = OutgoingMessage(
31 recipient = recipient,
32 body = body,
33 timestamp = sentTimeMillis,
34 expiresIn = expiresIn,
35 viewOnce = viewOnce,
36 distributionType = distributionType,
37 storyType = storyType,
38 parentStoryId = parentStoryId,
39 isStoryReaction = isStoryReaction,
40 giftBadge = giftBadge,
41 isSecure = secure
42 )
43
44 return insert(
45 message = message,
46 threadId = threadId
47 )
48 }
49
50 fun insert(
51 message: OutgoingMessage,
52 threadId: Long
53 ): Long {
54 return SignalDatabase.messages.insertMessageOutbox(message, threadId, false, GroupReceiptTable.STATUS_UNKNOWN, null)
55 }
56
57 fun insert(
58 message: IncomingMessage,
59 threadId: Long
60 ): Optional<MessageTable.InsertResult> {
61 return SignalDatabase.messages.insertMessageInbox(message, threadId)
62 }
63}