mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Merge pull request #994 from ceokot/message-request-response
Add profile data to message request responses
This commit is contained in:
commit
2711a6dd5f
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.database
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import org.session.libsession.avatars.AvatarHelper
|
||||
import org.session.libsession.database.StorageProtocol
|
||||
import org.session.libsession.messaging.BlindedIdMapping
|
||||
import org.session.libsession.messaging.calls.CallMessageType
|
||||
@ -12,6 +13,7 @@ import org.session.libsession.messaging.messages.control.ConfigurationMessage
|
||||
import org.session.libsession.messaging.messages.control.MessageRequestResponse
|
||||
import org.session.libsession.messaging.messages.signal.*
|
||||
import org.session.libsession.messaging.messages.visible.Attachment
|
||||
import org.session.libsession.messaging.messages.visible.Profile
|
||||
import org.session.libsession.messaging.messages.visible.Reaction
|
||||
import org.session.libsession.messaging.messages.visible.VisibleMessage
|
||||
import org.session.libsession.messaging.open_groups.GroupMember
|
||||
@ -28,6 +30,11 @@ import org.session.libsession.messaging.utilities.UpdateMessageData
|
||||
import org.session.libsession.snode.OnionRequestAPI
|
||||
import org.session.libsession.utilities.*
|
||||
import org.session.libsession.utilities.Address.Companion.fromSerialized
|
||||
import org.session.libsession.utilities.GroupRecord
|
||||
import org.session.libsession.utilities.GroupUtil
|
||||
import org.session.libsession.utilities.ProfileKeyUtil
|
||||
import org.session.libsession.utilities.SSKEnvironment
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||
import org.session.libsignal.messages.SignalServiceAttachmentPointer
|
||||
@ -44,6 +51,7 @@ import org.thoughtcrime.securesms.groups.OpenGroupManager
|
||||
import org.thoughtcrime.securesms.jobs.RetrieveProfileAvatarJob
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority
|
||||
import org.thoughtcrime.securesms.util.SessionMetaProtocol
|
||||
import java.security.MessageDigest
|
||||
|
||||
class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), StorageProtocol {
|
||||
|
||||
@ -55,16 +63,11 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
return DatabaseComponent.get(context).lokiAPIDatabase().getUserX25519KeyPair()
|
||||
}
|
||||
|
||||
override fun getUserDisplayName(): String? {
|
||||
return TextSecurePreferences.getProfileName(context)
|
||||
}
|
||||
|
||||
override fun getUserProfileKey(): ByteArray? {
|
||||
return ProfileKeyUtil.getProfileKey(context)
|
||||
}
|
||||
|
||||
override fun getUserProfilePictureURL(): String? {
|
||||
return TextSecurePreferences.getProfilePictureURL(context)
|
||||
override fun getUserProfile(): Profile {
|
||||
val displayName = TextSecurePreferences.getProfileName(context)!!
|
||||
val profileKey = ProfileKeyUtil.getProfileKey(context)
|
||||
val profilePictureUrl = TextSecurePreferences.getProfilePictureURL(context)
|
||||
return Profile(displayName, profileKey, profilePictureUrl)
|
||||
}
|
||||
|
||||
override fun setUserProfilePictureURL(newValue: String) {
|
||||
@ -754,6 +757,25 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
val smsDb = DatabaseComponent.get(context).smsDatabase()
|
||||
val sender = Recipient.from(context, fromSerialized(senderPublicKey), false)
|
||||
val threadId = threadDB.getOrCreateThreadIdFor(sender)
|
||||
val profile = response.profile
|
||||
if (profile != null) {
|
||||
val profileManager = SSKEnvironment.shared.profileManager
|
||||
val name = profile.displayName!!
|
||||
if (name.isNotEmpty()) {
|
||||
profileManager.setName(context, sender, name)
|
||||
}
|
||||
val newProfileKey = profile.profileKey
|
||||
|
||||
val needsProfilePicture = !AvatarHelper.avatarFileExists(context, sender.address)
|
||||
val profileKeyValid = newProfileKey?.isNotEmpty() == true && (newProfileKey.size == 16 || newProfileKey.size == 32) && profile.profilePictureURL?.isNotEmpty() == true
|
||||
val profileKeyChanged = (sender.profileKey == null || !MessageDigest.isEqual(sender.profileKey, newProfileKey))
|
||||
|
||||
if ((profileKeyValid && profileKeyChanged) || (profileKeyValid && needsProfilePicture)) {
|
||||
profileManager.setProfileKey(context, sender, newProfileKey!!)
|
||||
profileManager.setUnidentifiedAccessMode(context, sender, Recipient.UnidentifiedAccessMode.UNKNOWN)
|
||||
profileManager.setProfilePictureURL(context, sender, profile.profilePictureURL!!)
|
||||
}
|
||||
}
|
||||
threadDB.setHasSent(threadId, true)
|
||||
val mappingDb = DatabaseComponent.get(context).blindedIdMappingDatabase()
|
||||
val mappings = mutableMapOf<String, BlindedIdMapping>()
|
||||
|
@ -12,6 +12,7 @@ import org.session.libsession.messaging.messages.Message
|
||||
import org.session.libsession.messaging.messages.control.ConfigurationMessage
|
||||
import org.session.libsession.messaging.messages.control.MessageRequestResponse
|
||||
import org.session.libsession.messaging.messages.visible.Attachment
|
||||
import org.session.libsession.messaging.messages.visible.Profile
|
||||
import org.session.libsession.messaging.messages.visible.Reaction
|
||||
import org.session.libsession.messaging.messages.visible.VisibleMessage
|
||||
import org.session.libsession.messaging.open_groups.GroupMember
|
||||
@ -35,9 +36,7 @@ interface StorageProtocol {
|
||||
// General
|
||||
fun getUserPublicKey(): String?
|
||||
fun getUserX25519KeyPair(): ECKeyPair
|
||||
fun getUserDisplayName(): String?
|
||||
fun getUserProfileKey(): ByteArray?
|
||||
fun getUserProfilePictureURL(): String?
|
||||
fun getUserProfile(): Profile
|
||||
fun setUserProfilePictureURL(newProfilePicture: String)
|
||||
// Signal
|
||||
fun getOrGenerateRegistrationID(): Int
|
||||
|
@ -1,15 +1,22 @@
|
||||
package org.session.libsession.messaging.messages.control
|
||||
|
||||
import com.google.protobuf.ByteString
|
||||
import org.session.libsession.messaging.messages.visible.Profile
|
||||
import org.session.libsignal.protos.SignalServiceProtos
|
||||
import org.session.libsignal.utilities.Log
|
||||
|
||||
class MessageRequestResponse(val isApproved: Boolean) : ControlMessage() {
|
||||
class MessageRequestResponse(val isApproved: Boolean, var profile: Profile? = null) : ControlMessage() {
|
||||
|
||||
override val isSelfSendValid: Boolean = true
|
||||
|
||||
override fun toProto(): SignalServiceProtos.Content? {
|
||||
val profileProto = SignalServiceProtos.DataMessage.LokiProfile.newBuilder()
|
||||
profile?.displayName?.let { profileProto.displayName = it }
|
||||
profile?.profilePictureURL?.let { profileProto.profilePicture = it }
|
||||
val messageRequestResponseProto = SignalServiceProtos.MessageRequestResponse.newBuilder()
|
||||
.setIsApproved(isApproved)
|
||||
.setProfile(profileProto.build())
|
||||
profile?.profileKey?.let { messageRequestResponseProto.profileKey = ByteString.copyFrom(it) }
|
||||
return try {
|
||||
SignalServiceProtos.Content.newBuilder()
|
||||
.setMessageRequestResponse(messageRequestResponseProto.build())
|
||||
@ -26,7 +33,13 @@ class MessageRequestResponse(val isApproved: Boolean) : ControlMessage() {
|
||||
fun fromProto(proto: SignalServiceProtos.Content): MessageRequestResponse? {
|
||||
val messageRequestResponseProto = if (proto.hasMessageRequestResponse()) proto.messageRequestResponse else return null
|
||||
val isApproved = messageRequestResponseProto.isApproved
|
||||
return MessageRequestResponse(isApproved)
|
||||
val profileProto = messageRequestResponseProto.profile
|
||||
val profile = Profile().apply {
|
||||
displayName = profileProto.displayName
|
||||
profileKey = if (messageRequestResponseProto.hasProfileKey()) messageRequestResponseProto.profileKey.toByteArray() else null
|
||||
profilePictureURL = profileProto.profilePicture
|
||||
}
|
||||
return MessageRequestResponse(isApproved, profile)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Profile() {
|
||||
}
|
||||
}
|
||||
|
||||
internal constructor(displayName: String, profileKey: ByteArray? = null, profilePictureURL: String? = null) : this() {
|
||||
constructor(displayName: String, profileKey: ByteArray? = null, profilePictureURL: String? = null) : this() {
|
||||
this.displayName = displayName
|
||||
this.profileKey = profileKey
|
||||
this.profilePictureURL = profilePictureURL
|
||||
|
@ -8,9 +8,13 @@ import org.session.libsession.messaging.jobs.MessageSendJob
|
||||
import org.session.libsession.messaging.jobs.NotifyPNServerJob
|
||||
import org.session.libsession.messaging.messages.Destination
|
||||
import org.session.libsession.messaging.messages.Message
|
||||
import org.session.libsession.messaging.messages.control.*
|
||||
import org.session.libsession.messaging.messages.control.CallMessage
|
||||
import org.session.libsession.messaging.messages.control.ClosedGroupControlMessage
|
||||
import org.session.libsession.messaging.messages.control.ConfigurationMessage
|
||||
import org.session.libsession.messaging.messages.control.ExpirationTimerUpdate
|
||||
import org.session.libsession.messaging.messages.control.MessageRequestResponse
|
||||
import org.session.libsession.messaging.messages.control.UnsendRequest
|
||||
import org.session.libsession.messaging.messages.visible.LinkPreview
|
||||
import org.session.libsession.messaging.messages.visible.Profile
|
||||
import org.session.libsession.messaging.messages.visible.Quote
|
||||
import org.session.libsession.messaging.messages.visible.VisibleMessage
|
||||
import org.session.libsession.messaging.open_groups.OpenGroupApi
|
||||
@ -109,14 +113,10 @@ object MessageSender {
|
||||
}
|
||||
// Attach the user's profile if needed
|
||||
if (message is VisibleMessage) {
|
||||
val displayName = storage.getUserDisplayName()!!
|
||||
val profileKey = storage.getUserProfileKey()
|
||||
val profilePictureUrl = storage.getUserProfilePictureURL()
|
||||
if (profileKey != null && profilePictureUrl != null) {
|
||||
message.profile = Profile(displayName, profileKey, profilePictureUrl)
|
||||
} else {
|
||||
message.profile = Profile(displayName)
|
||||
}
|
||||
message.profile = storage.getUserProfile()
|
||||
}
|
||||
if (message is MessageRequestResponse) {
|
||||
message.profile = storage.getUserProfile()
|
||||
}
|
||||
// Convert it to protobuf
|
||||
val proto = message.toProto() ?: throw Error.ProtoConversionFailed
|
||||
@ -248,14 +248,7 @@ object MessageSender {
|
||||
try {
|
||||
// Attach the user's profile if needed
|
||||
if (message is VisibleMessage) {
|
||||
val displayName = storage.getUserDisplayName()!!
|
||||
val profileKey = storage.getUserProfileKey()
|
||||
val profilePictureUrl = storage.getUserProfilePictureURL()
|
||||
if (profileKey != null && profilePictureUrl != null) {
|
||||
message.profile = Profile(displayName, profileKey, profilePictureUrl)
|
||||
} else {
|
||||
message.profile = Profile(displayName)
|
||||
}
|
||||
message.profile = storage.getUserProfile()
|
||||
}
|
||||
when (destination) {
|
||||
is Destination.OpenGroup -> {
|
||||
|
@ -233,7 +233,9 @@ message ConfigurationMessage {
|
||||
|
||||
message MessageRequestResponse {
|
||||
// @required
|
||||
required bool isApproved = 1; // Whether the request was approved
|
||||
required bool isApproved = 1;
|
||||
optional bytes profileKey = 2;
|
||||
optional DataMessage.LokiProfile profile = 3;
|
||||
}
|
||||
|
||||
message ReceiptMessage {
|
||||
|
@ -21504,6 +21504,30 @@ public final class SignalServiceProtos {
|
||||
* </pre>
|
||||
*/
|
||||
boolean getIsApproved();
|
||||
|
||||
// optional bytes profileKey = 2;
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
boolean hasProfileKey();
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
com.google.protobuf.ByteString getProfileKey();
|
||||
|
||||
// optional .signalservice.DataMessage.LokiProfile profile = 3;
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
boolean hasProfile();
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile getProfile();
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder getProfileOrBuilder();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code signalservice.MessageRequestResponse}
|
||||
@ -21561,6 +21585,24 @@ public final class SignalServiceProtos {
|
||||
isApproved_ = input.readBool();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
bitField0_ |= 0x00000002;
|
||||
profileKey_ = input.readBytes();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
subBuilder = profile_.toBuilder();
|
||||
}
|
||||
profile_ = input.readMessage(org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(profile_);
|
||||
profile_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
@ -21625,8 +21667,48 @@ public final class SignalServiceProtos {
|
||||
return isApproved_;
|
||||
}
|
||||
|
||||
// optional bytes profileKey = 2;
|
||||
public static final int PROFILEKEY_FIELD_NUMBER = 2;
|
||||
private com.google.protobuf.ByteString profileKey_;
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public boolean hasProfileKey() {
|
||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||
}
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getProfileKey() {
|
||||
return profileKey_;
|
||||
}
|
||||
|
||||
// optional .signalservice.DataMessage.LokiProfile profile = 3;
|
||||
public static final int PROFILE_FIELD_NUMBER = 3;
|
||||
private org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile profile_;
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public boolean hasProfile() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile getProfile() {
|
||||
return profile_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder getProfileOrBuilder() {
|
||||
return profile_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
isApproved_ = false;
|
||||
profileKey_ = com.google.protobuf.ByteString.EMPTY;
|
||||
profile_ = org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.getDefaultInstance();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@ -21647,6 +21729,12 @@ public final class SignalServiceProtos {
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
output.writeBool(1, isApproved_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
output.writeBytes(2, profileKey_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
output.writeMessage(3, profile_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@ -21660,6 +21748,14 @@ public final class SignalServiceProtos {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBoolSize(1, isApproved_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBytesSize(2, profileKey_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(3, profile_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@ -21768,6 +21864,7 @@ public final class SignalServiceProtos {
|
||||
}
|
||||
private void maybeForceBuilderInitialization() {
|
||||
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
|
||||
getProfileFieldBuilder();
|
||||
}
|
||||
}
|
||||
private static Builder create() {
|
||||
@ -21778,6 +21875,14 @@ public final class SignalServiceProtos {
|
||||
super.clear();
|
||||
isApproved_ = false;
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
profileKey_ = com.google.protobuf.ByteString.EMPTY;
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
if (profileBuilder_ == null) {
|
||||
profile_ = org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.getDefaultInstance();
|
||||
} else {
|
||||
profileBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -21810,6 +21915,18 @@ public final class SignalServiceProtos {
|
||||
to_bitField0_ |= 0x00000001;
|
||||
}
|
||||
result.isApproved_ = isApproved_;
|
||||
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
to_bitField0_ |= 0x00000002;
|
||||
}
|
||||
result.profileKey_ = profileKey_;
|
||||
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
to_bitField0_ |= 0x00000004;
|
||||
}
|
||||
if (profileBuilder_ == null) {
|
||||
result.profile_ = profile_;
|
||||
} else {
|
||||
result.profile_ = profileBuilder_.build();
|
||||
}
|
||||
result.bitField0_ = to_bitField0_;
|
||||
onBuilt();
|
||||
return result;
|
||||
@ -21829,6 +21946,12 @@ public final class SignalServiceProtos {
|
||||
if (other.hasIsApproved()) {
|
||||
setIsApproved(other.getIsApproved());
|
||||
}
|
||||
if (other.hasProfileKey()) {
|
||||
setProfileKey(other.getProfileKey());
|
||||
}
|
||||
if (other.hasProfile()) {
|
||||
mergeProfile(other.getProfile());
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
@ -21909,6 +22032,159 @@ public final class SignalServiceProtos {
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional bytes profileKey = 2;
|
||||
private com.google.protobuf.ByteString profileKey_ = com.google.protobuf.ByteString.EMPTY;
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public boolean hasProfileKey() {
|
||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||
}
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public com.google.protobuf.ByteString getProfileKey() {
|
||||
return profileKey_;
|
||||
}
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public Builder setProfileKey(com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000002;
|
||||
profileKey_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional bytes profileKey = 2;</code>
|
||||
*/
|
||||
public Builder clearProfileKey() {
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
profileKey_ = getDefaultInstance().getProfileKey();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .signalservice.DataMessage.LokiProfile profile = 3;
|
||||
private org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile profile_ = org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.getDefaultInstance();
|
||||
private com.google.protobuf.SingleFieldBuilder<
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder> profileBuilder_;
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public boolean hasProfile() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile getProfile() {
|
||||
if (profileBuilder_ == null) {
|
||||
return profile_;
|
||||
} else {
|
||||
return profileBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public Builder setProfile(org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile value) {
|
||||
if (profileBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
profile_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
profileBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public Builder setProfile(
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder builderForValue) {
|
||||
if (profileBuilder_ == null) {
|
||||
profile_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
profileBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public Builder mergeProfile(org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile value) {
|
||||
if (profileBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004) &&
|
||||
profile_ != org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.getDefaultInstance()) {
|
||||
profile_ =
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.newBuilder(profile_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
profile_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
profileBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public Builder clearProfile() {
|
||||
if (profileBuilder_ == null) {
|
||||
profile_ = org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
profileBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder getProfileBuilder() {
|
||||
bitField0_ |= 0x00000004;
|
||||
onChanged();
|
||||
return getProfileFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
public org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder getProfileOrBuilder() {
|
||||
if (profileBuilder_ != null) {
|
||||
return profileBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return profile_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .signalservice.DataMessage.LokiProfile profile = 3;</code>
|
||||
*/
|
||||
private com.google.protobuf.SingleFieldBuilder<
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder>
|
||||
getProfileFieldBuilder() {
|
||||
if (profileBuilder_ == null) {
|
||||
profileBuilder_ = new com.google.protobuf.SingleFieldBuilder<
|
||||
org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfile.Builder, org.session.libsignal.protos.SignalServiceProtos.DataMessage.LokiProfileOrBuilder>(
|
||||
profile_,
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
profile_ = null;
|
||||
}
|
||||
return profileBuilder_;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:signalservice.MessageRequestResponse)
|
||||
}
|
||||
|
||||
@ -25921,24 +26197,26 @@ public final class SignalServiceProtos {
|
||||
"\001 \002(\014\022\014\n\004name\030\002 \002(\t\022\026\n\016profilePicture\030\003 ",
|
||||
"\001(\t\022\022\n\nprofileKey\030\004 \001(\014\022\022\n\nisApproved\030\005 " +
|
||||
"\001(\010\022\021\n\tisBlocked\030\006 \001(\010\022\024\n\014didApproveMe\030\007" +
|
||||
" \001(\010\",\n\026MessageRequestResponse\022\022\n\nisAppr" +
|
||||
"oved\030\001 \002(\010\"u\n\016ReceiptMessage\0220\n\004type\030\001 \002" +
|
||||
"(\0162\".signalservice.ReceiptMessage.Type\022\021" +
|
||||
"\n\ttimestamp\030\002 \003(\004\"\036\n\004Type\022\014\n\010DELIVERY\020\000\022" +
|
||||
"\010\n\004READ\020\001\"\354\001\n\021AttachmentPointer\022\n\n\002id\030\001 " +
|
||||
"\002(\006\022\023\n\013contentType\030\002 \001(\t\022\013\n\003key\030\003 \001(\014\022\014\n" +
|
||||
"\004size\030\004 \001(\r\022\021\n\tthumbnail\030\005 \001(\014\022\016\n\006digest" +
|
||||
"\030\006 \001(\014\022\020\n\010fileName\030\007 \001(\t\022\r\n\005flags\030\010 \001(\r\022",
|
||||
"\r\n\005width\030\t \001(\r\022\016\n\006height\030\n \001(\r\022\017\n\007captio" +
|
||||
"n\030\013 \001(\t\022\013\n\003url\030e \001(\t\"\032\n\005Flags\022\021\n\rVOICE_M" +
|
||||
"ESSAGE\020\001\"\365\001\n\014GroupContext\022\n\n\002id\030\001 \001(\014\022.\n" +
|
||||
"\004type\030\002 \001(\0162 .signalservice.GroupContext" +
|
||||
".Type\022\014\n\004name\030\003 \001(\t\022\017\n\007members\030\004 \003(\t\0220\n\006" +
|
||||
"avatar\030\005 \001(\0132 .signalservice.AttachmentP" +
|
||||
"ointer\022\016\n\006admins\030\006 \003(\t\"H\n\004Type\022\013\n\007UNKNOW" +
|
||||
"N\020\000\022\n\n\006UPDATE\020\001\022\013\n\007DELIVER\020\002\022\010\n\004QUIT\020\003\022\020" +
|
||||
"\n\014REQUEST_INFO\020\004B3\n\034org.session.libsigna" +
|
||||
"l.protosB\023SignalServiceProtos"
|
||||
" \001(\010\"y\n\026MessageRequestResponse\022\022\n\nisAppr" +
|
||||
"oved\030\001 \002(\010\022\022\n\nprofileKey\030\002 \001(\014\0227\n\007profil" +
|
||||
"e\030\003 \001(\0132&.signalservice.DataMessage.Loki" +
|
||||
"Profile\"u\n\016ReceiptMessage\0220\n\004type\030\001 \002(\0162" +
|
||||
"\".signalservice.ReceiptMessage.Type\022\021\n\tt" +
|
||||
"imestamp\030\002 \003(\004\"\036\n\004Type\022\014\n\010DELIVERY\020\000\022\010\n\004" +
|
||||
"READ\020\001\"\354\001\n\021AttachmentPointer\022\n\n\002id\030\001 \002(\006" +
|
||||
"\022\023\n\013contentType\030\002 \001(\t\022\013\n\003key\030\003 \001(\014\022\014\n\004si",
|
||||
"ze\030\004 \001(\r\022\021\n\tthumbnail\030\005 \001(\014\022\016\n\006digest\030\006 " +
|
||||
"\001(\014\022\020\n\010fileName\030\007 \001(\t\022\r\n\005flags\030\010 \001(\r\022\r\n\005" +
|
||||
"width\030\t \001(\r\022\016\n\006height\030\n \001(\r\022\017\n\007caption\030\013" +
|
||||
" \001(\t\022\013\n\003url\030e \001(\t\"\032\n\005Flags\022\021\n\rVOICE_MESS" +
|
||||
"AGE\020\001\"\365\001\n\014GroupContext\022\n\n\002id\030\001 \001(\014\022.\n\004ty" +
|
||||
"pe\030\002 \001(\0162 .signalservice.GroupContext.Ty" +
|
||||
"pe\022\014\n\004name\030\003 \001(\t\022\017\n\007members\030\004 \003(\t\0220\n\006ava" +
|
||||
"tar\030\005 \001(\0132 .signalservice.AttachmentPoin" +
|
||||
"ter\022\016\n\006admins\030\006 \003(\t\"H\n\004Type\022\013\n\007UNKNOWN\020\000" +
|
||||
"\022\n\n\006UPDATE\020\001\022\013\n\007DELIVER\020\002\022\010\n\004QUIT\020\003\022\020\n\014R",
|
||||
"EQUEST_INFO\020\004B3\n\034org.session.libsignal.p" +
|
||||
"rotosB\023SignalServiceProtos"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
@ -26064,7 +26342,7 @@ public final class SignalServiceProtos {
|
||||
internal_static_signalservice_MessageRequestResponse_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_signalservice_MessageRequestResponse_descriptor,
|
||||
new java.lang.String[] { "IsApproved", });
|
||||
new java.lang.String[] { "IsApproved", "ProfileKey", "Profile", });
|
||||
internal_static_signalservice_ReceiptMessage_descriptor =
|
||||
getDescriptor().getMessageTypes().get(10);
|
||||
internal_static_signalservice_ReceiptMessage_fieldAccessorTable = new
|
||||
|
Loading…
Reference in New Issue
Block a user