diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f353d4a2a9..33a908ed3b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -470,16 +470,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java
index 4d448c2257..58727424ba 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationActivity.java
@@ -170,7 +170,6 @@ import org.session.libsession.messaging.threads.recipients.RecipientModifiedList
import org.thoughtcrime.securesms.search.model.MessageResult;
import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.sms.OutgoingEncryptedMessage;
-import org.thoughtcrime.securesms.sms.OutgoingEndSessionMessage;
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
import org.thoughtcrime.securesms.util.BitmapUtil;
import org.thoughtcrime.securesms.util.DateUtils;
@@ -893,36 +892,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
startActivityForResult(intent, SMS_DEFAULT);
}
- private void handleResetSecureSession() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.ConversationActivity_reset_secure_session_question);
- builder.setIconAttribute(R.attr.dialog_alert_icon);
- builder.setCancelable(true);
- builder.setMessage(R.string.ConversationActivity_this_may_help_if_youre_having_encryption_problems);
- builder.setPositiveButton(R.string.ConversationActivity_reset, (dialog, which) -> {
- if (isSingleConversation()) {
- final Context context = getApplicationContext();
-
- OutgoingEndSessionMessage endSessionMessage =
- new OutgoingEndSessionMessage(new OutgoingTextMessage(getRecipient(), "TERMINATE", 0, -1));
-
- new AsyncTask() {
- @Override
- protected Long doInBackground(OutgoingEndSessionMessage... messages) {
- return MessageSender.send(context, messages[0], threadId, false, null);
- }
-
- @Override
- protected void onPostExecute(Long result) {
- sendComplete(result);
- }
- }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, endSessionMessage);
- }
- });
- builder.setNegativeButton(android.R.string.cancel, null);
- builder.show();
- }
-
private void handleBlock() {
int titleRes = R.string.RecipientPreferenceActivity_block_this_contact_question;
int bodyRes = R.string.RecipientPreferenceActivity_you_will_no_longer_receive_messages_and_calls_from_this_contact;
diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java
index a24878eea4..36b86023e6 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsColumns.java
@@ -48,7 +48,6 @@ public interface MmsSmsColumns {
OUTGOING_CALL_TYPE};
// Message attributes
- protected static final long MESSAGE_ATTRIBUTE_MASK = 0xE0;
protected static final long MESSAGE_FORCE_SMS_BIT = 0x40;
// Key Exchange Information
diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabase.java
index b552d4ead2..20ebbac6b7 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabase.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/database/SmsDatabase.java
@@ -167,22 +167,10 @@ public class SmsDatabase extends MessagingDatabase {
return 0;
}
- public void markAsEndSession(long id) {
- updateTypeBitmask(id, Types.KEY_EXCHANGE_MASK, Types.END_SESSION_BIT);
- }
-
- public void markAsPush(long id) {
- updateTypeBitmask(id, 0, Types.PUSH_MESSAGE_BIT);
- }
-
public void markAsDecryptFailed(long id) {
updateTypeBitmask(id, Types.ENCRYPTION_MASK, Types.ENCRYPTION_REMOTE_FAILED_BIT);
}
- public void markAsPendingInsecureSmsFallback(long id) {
- updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_PENDING_INSECURE_SMS_FALLBACK);
- }
-
@Override
public void markAsSent(long id, boolean isSecure) {
updateTypeBitmask(id, Types.BASE_TYPE_MASK, Types.BASE_SENT_TYPE | (isSecure ? Types.PUSH_MESSAGE_BIT | Types.SECURE_MESSAGE_BIT : 0));
@@ -358,27 +346,15 @@ public class SmsDatabase extends MessagingDatabase {
}
protected Optional insertMessageInbox(IncomingTextMessage message, long type, long serverTimestamp) {
- if (message.isJoined()) {
- type = (type & (Types.TOTAL_MASK - Types.BASE_TYPE_MASK)) | Types.JOINED_TYPE;
- } else if (message.isPreKeyBundle()) {
- type |= Types.KEY_EXCHANGE_BIT | Types.KEY_EXCHANGE_BUNDLE_BIT;
- } else if (message.isSecureMessage()) {
+ if (message.isSecureMessage()) {
type |= Types.SECURE_MESSAGE_BIT;
} else if (message.isGroup()) {
type |= Types.SECURE_MESSAGE_BIT;
if (((IncomingGroupMessage)message).isUpdate()) type |= Types.GROUP_UPDATE_BIT;
else if (((IncomingGroupMessage)message).isQuit()) type |= Types.GROUP_QUIT_BIT;
- } else if (message.isEndSession()) {
- type |= Types.SECURE_MESSAGE_BIT;
- type |= Types.END_SESSION_BIT;
}
if (message.isPush()) type |= Types.PUSH_MESSAGE_BIT;
- if (message.isIdentityUpdate()) type |= Types.KEY_EXCHANGE_IDENTITY_UPDATE_BIT;
- if (message.isContentPreKeyBundle()) type |= Types.KEY_EXCHANGE_CONTENT_FORMAT;
-
- if (message.isIdentityVerified()) type |= Types.KEY_EXCHANGE_IDENTITY_VERIFIED_BIT;
- else if (message.isIdentityDefault()) type |= Types.KEY_EXCHANGE_IDENTITY_DEFAULT_BIT;
Recipient recipient = Recipient.from(context, message.getSender(), true);
@@ -391,8 +367,7 @@ public class SmsDatabase extends MessagingDatabase {
}
boolean unread = (Util.isDefaultSmsProvider(context) ||
- message.isSecureMessage() || message.isGroup() || message.isPreKeyBundle()) &&
- !message.isIdentityUpdate() && !message.isIdentityDefault() && !message.isIdentityVerified();
+ message.isSecureMessage() || message.isGroup());
long threadId;
@@ -433,9 +408,7 @@ public class SmsDatabase extends MessagingDatabase {
DatabaseFactory.getThreadDatabase(context).incrementUnread(threadId, 1);
}
- if (!message.isIdentityUpdate() && !message.isIdentityVerified() && !message.isIdentityDefault()) {
- DatabaseFactory.getThreadDatabase(context).update(threadId, true);
- }
+ DatabaseFactory.getThreadDatabase(context).update(threadId, true);
if (message.getSubscriptionId() != -1) {
DatabaseFactory.getRecipientDatabase(context).setDefaultSubscriptionId(recipient, message.getSubscriptionId());
@@ -443,9 +416,7 @@ public class SmsDatabase extends MessagingDatabase {
notifyConversationListeners(threadId);
- if (!message.isIdentityUpdate() && !message.isIdentityVerified() && !message.isIdentityDefault()) {
- ApplicationContext.getInstance(context).getJobManager().add(new TrimThreadJob(threadId));
- }
+ ApplicationContext.getInstance(context).getJobManager().add(new TrimThreadJob(threadId));
return Optional.of(new InsertResult(messageId, threadId));
}
@@ -476,14 +447,9 @@ public class SmsDatabase extends MessagingDatabase {
{
long type = Types.BASE_SENDING_TYPE;
- if (message.isKeyExchange()) type |= Types.KEY_EXCHANGE_BIT;
- else if (message.isSecureMessage()) type |= (Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT);
- else if (message.isEndSession()) type |= Types.END_SESSION_BIT;
+ if (message.isSecureMessage()) type |= (Types.SECURE_MESSAGE_BIT | Types.PUSH_MESSAGE_BIT);
if (forceSms) type |= Types.MESSAGE_FORCE_SMS_BIT;
- if (message.isIdentityVerified()) type |= Types.KEY_EXCHANGE_IDENTITY_VERIFIED_BIT;
- else if (message.isIdentityDefault()) type |= Types.KEY_EXCHANGE_IDENTITY_DEFAULT_BIT;
-
Address address = message.getRecipient().getAddress();
Map earlyDeliveryReceipts = earlyDeliveryReceiptCache.remove(date);
Map earlyReadReceipts = earlyReadReceiptCache.remove(date);
@@ -507,18 +473,14 @@ public class SmsDatabase extends MessagingDatabase {
insertListener.onComplete();
}
- if (!message.isIdentityVerified() && !message.isIdentityDefault()) {
- DatabaseFactory.getThreadDatabase(context).update(threadId, true);
- DatabaseFactory.getThreadDatabase(context).setLastSeen(threadId);
- }
+ DatabaseFactory.getThreadDatabase(context).update(threadId, true);
+ DatabaseFactory.getThreadDatabase(context).setLastSeen(threadId);
DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
notifyConversationListeners(threadId);
- if (!message.isIdentityVerified() && !message.isIdentityDefault()) {
- ApplicationContext.getInstance(context).getJobManager().add(new TrimThreadJob(threadId));
- }
+ ApplicationContext.getInstance(context).getJobManager().add(new TrimThreadJob(threadId));
return messageId;
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java b/app/src/main/java/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java
deleted file mode 100644
index 4a38a3c7b7..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/service/AccountVerificationTimeoutException.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.thoughtcrime.securesms.service;
-
-public class AccountVerificationTimeoutException extends Exception {
- public AccountVerificationTimeoutException() {
- }
-
- public AccountVerificationTimeoutException(String detailMessage) {
- super(detailMessage);
- }
-
- public AccountVerificationTimeoutException(String detailMessage, Throwable throwable) {
- super(detailMessage, throwable);
- }
-
- public AccountVerificationTimeoutException(Throwable throwable) {
- super(throwable);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java
index 40d800a0ef..046004aa46 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java
@@ -60,12 +60,10 @@ public class KeyCachingService extends Service {
public static final int SERVICE_RUNNING_ID = 4141;
public static final String KEY_PERMISSION = "network.loki.messenger.ACCESS_SESSION_SECRETS";
-// public static final String NEW_KEY_EVENT = "org.thoughtcrime.securesms.service.action.NEW_KEY_EVENT";
public static final String CLEAR_KEY_EVENT = "org.thoughtcrime.securesms.service.action.CLEAR_KEY_EVENT";
public static final String LOCK_TOGGLED_EVENT = "org.thoughtcrime.securesms.service.action.LOCK_ENABLED_EVENT";
private static final String PASSPHRASE_EXPIRED_EVENT = "org.thoughtcrime.securesms.service.action.PASSPHRASE_EXPIRED_EVENT";
public static final String CLEAR_KEY_ACTION = "org.thoughtcrime.securesms.service.action.CLEAR_KEY";
-// public static final String DISABLE_ACTION = "org.thoughtcrime.securesms.service.action.DISABLE";
private final IBinder binder = new KeySetBinder();
@@ -111,14 +109,6 @@ public class KeyCachingService extends Service {
}
public static synchronized @Nullable Object getMasterSecret(Context context) {
-// if (masterSecret == null && (TextSecurePreferences.isPasswordDisabled(context) && !TextSecurePreferences.isScreenLockEnabled(context))) {
-// try {
-// return MasterSecretUtil.getMasterSecret(context, MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
-// } catch (InvalidPassphraseException e) {
-// Log.w("KeyCachingService", e);
-// }
-// }
-
return masterSecret;
}
@@ -128,7 +118,6 @@ public class KeyCachingService extends Service {
KeyCachingService.masterSecret = masterSecret;
foregroundService();
-// broadcastNewSecret();
startTimeoutIfAppropriate(this);
new AsyncTask() {
@@ -152,7 +141,6 @@ public class KeyCachingService extends Service {
switch (intent.getAction()) {
case CLEAR_KEY_ACTION: handleClearKey(); break;
case PASSPHRASE_EXPIRED_EVENT: handleClearKey(); break;
-// case DISABLE_ACTION: handleDisableService(); break;
case LOCK_TOGGLED_EVENT: handleLockToggled(); break;
}
}
@@ -166,12 +154,7 @@ public class KeyCachingService extends Service {
super.onCreate();
if (TextSecurePreferences.isPasswordDisabled(this) && !TextSecurePreferences.isScreenLockEnabled(this)) {
-// try {
-// MasterSecret masterSecret = MasterSecretUtil.getMasterSecret(this, MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
setMasterSecret(new Object());
-// } catch (InvalidPassphraseException e) {
-// Log.w("KeyCachingService", e);
-// }
}
}
@@ -215,21 +198,7 @@ public class KeyCachingService extends Service {
private void handleLockToggled() {
stopForeground(true);
-
-// try {
-// MasterSecret masterSecret = MasterSecretUtil.getMasterSecret(this, MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
- setMasterSecret(masterSecret);
-// } catch (InvalidPassphraseException e) {
-// Log.w(TAG, e);
-// }
- }
-
- private void handleDisableService() {
- if (TextSecurePreferences.isPasswordDisabled(this) &&
- !TextSecurePreferences.isScreenLockEnabled(this))
- {
- stopForeground(true);
- }
+ setMasterSecret(masterSecret);
}
private static void startTimeoutIfAppropriate(@NonNull Context context) {
@@ -283,15 +252,6 @@ public class KeyCachingService extends Service {
startForeground(SERVICE_RUNNING_ID, builder.build());
}
-// private void broadcastNewSecret() {
-// Log.i(TAG, "Broadcasting new secret...");
-//
-// Intent intent = new Intent(NEW_KEY_EVENT);
-// intent.setPackage(getApplicationContext().getPackageName());
-//
-// sendBroadcast(intent, KEY_PERMISSION);
-// }
-
private PendingIntent buildLockIntent() {
Intent intent = new Intent(this, KeyCachingService.class);
intent.setAction(PASSPHRASE_EXPIRED_EVENT);
diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/VerificationCodeParser.java b/app/src/main/java/org/thoughtcrime/securesms/service/VerificationCodeParser.java
deleted file mode 100644
index 4a7d1038b2..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/service/VerificationCodeParser.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (C) 2011 Whisper Systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.thoughtcrime.securesms.service;
-
-import android.content.Context;
-
-import org.session.libsession.utilities.TextSecurePreferences;
-import org.session.libsignal.libsignal.util.guava.Optional;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class VerificationCodeParser {
-
- private static final Pattern CHALLENGE_PATTERN = Pattern.compile(".*Your (Signal|TextSecure) verification code:? ([0-9]{3,4})-([0-9]{3,4}).*", Pattern.DOTALL);
-
- public static Optional parse(Context context, String messageBody) {
- if (messageBody == null) {
- return Optional.absent();
- }
-
- Matcher challengeMatcher = CHALLENGE_PATTERN.matcher(messageBody);
-
- if (!challengeMatcher.matches() || !TextSecurePreferences.isVerifying(context)) {
- return Optional.absent();
- }
-
- return Optional.of(challengeMatcher.group(2) + challengeMatcher.group(3));
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java
index 684329fc77..66586a68b9 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEncryptedMessage.java
@@ -6,7 +6,7 @@ public class IncomingEncryptedMessage extends IncomingTextMessage {
super(base, newBody);
}
- @Override
+ @Override
public boolean isSecureMessage() {
return true;
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java
deleted file mode 100644
index f5b7b5e402..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingEndSessionMessage.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-public class IncomingEndSessionMessage extends IncomingTextMessage {
-
- public IncomingEndSessionMessage(IncomingTextMessage base) {
- this(base, base.getMessageBody());
- }
-
- public IncomingEndSessionMessage(IncomingTextMessage base, String newBody) {
- super(base, newBody);
- }
-
- @Override
- public boolean isEndSession() {
- return true;
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityDefaultMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityDefaultMessage.java
deleted file mode 100644
index fc9c75e752..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityDefaultMessage.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-
-public class IncomingIdentityDefaultMessage extends IncomingTextMessage {
-
- public IncomingIdentityDefaultMessage(IncomingTextMessage base) {
- super(base, "");
- }
-
- @Override
- public boolean isIdentityDefault() {
- return true;
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityUpdateMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityUpdateMessage.java
deleted file mode 100644
index c1f1d79e19..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityUpdateMessage.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-public class IncomingIdentityUpdateMessage extends IncomingTextMessage {
-
- public IncomingIdentityUpdateMessage(IncomingTextMessage base) {
- super(base, "");
- }
-
- @Override
- public boolean isIdentityUpdate() {
- return true;
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityVerifiedMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityVerifiedMessage.java
deleted file mode 100644
index 23a5d51900..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingIdentityVerifiedMessage.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-
-public class IncomingIdentityVerifiedMessage extends IncomingTextMessage {
-
- public IncomingIdentityVerifiedMessage(IncomingTextMessage base) {
- super(base, "");
- }
-
- @Override
- public boolean isIdentityVerified() {
- return true;
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java
deleted file mode 100644
index 163c10cc92..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingJoinedMessage.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-import org.session.libsession.messaging.threads.Address;
-import org.session.libsignal.libsignal.util.guava.Optional;
-import org.session.libsignal.service.api.messages.SignalServiceGroup;
-
-public class IncomingJoinedMessage extends IncomingTextMessage {
-
- public IncomingJoinedMessage(Address sender) {
- super(sender, 1, System.currentTimeMillis(), null, Optional.absent(), 0, false);
- }
-
- @Override
- public boolean isJoined() {
- return true;
- }
-
- @Override
- public boolean isSecureMessage() {
- return true;
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java
deleted file mode 100644
index 39f75a5da0..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingPreKeyBundleMessage.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-public class IncomingPreKeyBundleMessage extends IncomingTextMessage {
-
- private final boolean legacy;
-
- public IncomingPreKeyBundleMessage(IncomingTextMessage base, String newBody, boolean legacy) {
- super(base, newBody);
- this.legacy = legacy;
- }
-
- @Override
- public boolean isLegacyPreKeyBundle() {
- return legacy;
- }
-
- @Override
- public boolean isContentPreKeyBundle() {
- return !legacy;
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingTextMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
index b46afef9f3..0acf91c242 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/sms/IncomingTextMessage.java
@@ -45,22 +45,6 @@ public class IncomingTextMessage implements Parcelable {
private final long expiresInMillis;
private final boolean unidentified;
- public IncomingTextMessage(@NonNull Context context, @NonNull SmsMessage message, int subscriptionId) {
- this.message = message.getDisplayMessageBody();
- this.sender = Address.fromSerialized(message.getDisplayOriginatingAddress());
- this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
- this.protocol = message.getProtocolIdentifier();
- this.serviceCenterAddress = message.getServiceCenterAddress();
- this.replyPathPresent = message.isReplyPathPresent();
- this.pseudoSubject = message.getPseudoSubject();
- this.sentTimestampMillis = message.getTimestampMillis();
- this.subscriptionId = subscriptionId;
- this.expiresInMillis = 0;
- this.groupId = null;
- this.push = false;
- this.unidentified = false;
- }
-
public IncomingTextMessage(Address sender, int senderDeviceId, long sentTimestampMillis,
String encodedBody, Optional group,
long expiresInMillis, boolean unidentified)
@@ -117,45 +101,6 @@ public class IncomingTextMessage implements Parcelable {
this.unidentified = base.isUnidentified();
}
- public IncomingTextMessage(List fragments) {
- StringBuilder body = new StringBuilder();
-
- for (IncomingTextMessage message : fragments) {
- body.append(message.getMessageBody());
- }
-
- this.message = body.toString();
- this.sender = fragments.get(0).getSender();
- this.senderDeviceId = fragments.get(0).getSenderDeviceId();
- this.protocol = fragments.get(0).getProtocol();
- this.serviceCenterAddress = fragments.get(0).getServiceCenterAddress();
- this.replyPathPresent = fragments.get(0).isReplyPathPresent();
- this.pseudoSubject = fragments.get(0).getPseudoSubject();
- this.sentTimestampMillis = fragments.get(0).getSentTimestampMillis();
- this.groupId = fragments.get(0).getGroupId();
- this.push = fragments.get(0).isPush();
- this.subscriptionId = fragments.get(0).getSubscriptionId();
- this.expiresInMillis = fragments.get(0).getExpiresIn();
- this.unidentified = fragments.get(0).isUnidentified();
- }
-
- protected IncomingTextMessage(@NonNull Address sender, @Nullable Address groupId)
- {
- this.message = "";
- this.sender = sender;
- this.senderDeviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
- this.protocol = 31338;
- this.serviceCenterAddress = "Outgoing";
- this.replyPathPresent = true;
- this.pseudoSubject = "";
- this.sentTimestampMillis = System.currentTimeMillis();
- this.groupId = groupId;
- this.push = true;
- this.subscriptionId = -1;
- this.expiresInMillis = 0;
- this.unidentified = false;
- }
-
public static IncomingTextMessage from(VisibleMessage message,
Address sender,
Optional group,
@@ -208,22 +153,6 @@ public class IncomingTextMessage implements Parcelable {
return false;
}
- public boolean isPreKeyBundle() {
- return isLegacyPreKeyBundle() || isContentPreKeyBundle();
- }
-
- public boolean isLegacyPreKeyBundle() {
- return false;
- }
-
- public boolean isContentPreKeyBundle() {
- return false;
- }
-
- public boolean isEndSession() {
- return false;
- }
-
public boolean isPush() {
return push;
}
@@ -236,22 +165,6 @@ public class IncomingTextMessage implements Parcelable {
return false;
}
- public boolean isJoined() {
- return false;
- }
-
- public boolean isIdentityUpdate() {
- return false;
- }
-
- public boolean isIdentityVerified() {
- return false;
- }
-
- public boolean isIdentityDefault() {
- return false;
- }
-
public boolean isUnidentified() {
return unidentified;
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/MessageSender.java b/app/src/main/java/org/thoughtcrime/securesms/sms/MessageSender.java
index cc526313a7..a1ff5dcd79 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/MessageSender.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/sms/MessageSender.java
@@ -55,7 +55,6 @@ public class MessageSender {
{
SmsDatabase database = DatabaseFactory.getSmsDatabase(context);
Recipient recipient = message.getRecipient();
- boolean keyExchange = message.isKeyExchange();
long allocatedThreadId;
@@ -67,7 +66,7 @@ public class MessageSender {
long messageId = database.insertMessageOutbox(allocatedThreadId, message, forceSms, System.currentTimeMillis(), insertListener);
- sendTextMessage(context, recipient, forceSms, keyExchange, messageId);
+ sendTextMessage(context, recipient, forceSms, messageId);
return allocatedThreadId;
}
@@ -104,14 +103,13 @@ public class MessageSender {
public static void resend(Context context, MessageRecord messageRecord) {
long messageId = messageRecord.getId();
boolean forceSms = messageRecord.isForcedSms();
- boolean keyExchange = messageRecord.isKeyExchange();
long expiresIn = messageRecord.getExpiresIn();
Recipient recipient = messageRecord.getRecipient();
if (messageRecord.isMms()) {
sendMediaMessage(context, recipient, forceSms, messageId, expiresIn);
} else {
- sendTextMessage(context, recipient, forceSms, keyExchange, messageId);
+ sendTextMessage(context, recipient, forceSms, messageId);
}
}
@@ -127,8 +125,7 @@ public class MessageSender {
}
private static void sendTextMessage(Context context, Recipient recipient,
- boolean forceSms, boolean keyExchange,
- long messageId)
+ boolean forceSms, long messageId)
{
if (isLocalSelfSend(context, recipient, forceSms)) {
sendLocalTextSelf(context, messageId);
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEncryptedMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEncryptedMessage.java
index 21c3a61868..6d64c7140e 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEncryptedMessage.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEncryptedMessage.java
@@ -8,17 +8,8 @@ public class OutgoingEncryptedMessage extends OutgoingTextMessage {
super(recipient, body, expiresIn, -1);
}
- private OutgoingEncryptedMessage(OutgoingEncryptedMessage base, String body) {
- super(base, body);
- }
-
@Override
public boolean isSecureMessage() {
return true;
}
-
- @Override
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingEncryptedMessage(this, body);
- }
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEndSessionMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEndSessionMessage.java
deleted file mode 100644
index cbba047507..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingEndSessionMessage.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-public class OutgoingEndSessionMessage extends OutgoingTextMessage {
-
- public OutgoingEndSessionMessage(OutgoingTextMessage base) {
- this(base, base.getMessageBody());
- }
-
- public OutgoingEndSessionMessage(OutgoingTextMessage message, String body) {
- super(message, body);
- }
-
- @Override
- public boolean isEndSession() {
- return true;
- }
-
- @Override
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingEndSessionMessage(this, body);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityDefaultMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityDefaultMessage.java
deleted file mode 100644
index 14531ef24b..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityDefaultMessage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-
-import org.session.libsession.messaging.threads.recipients.Recipient;
-
-public class OutgoingIdentityDefaultMessage extends OutgoingTextMessage {
-
- public OutgoingIdentityDefaultMessage(Recipient recipient) {
- this(recipient, "");
- }
-
- private OutgoingIdentityDefaultMessage(Recipient recipient, String body) {
- super(recipient, body, -1);
- }
-
- @Override
- public boolean isIdentityDefault() {
- return true;
- }
-
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingIdentityDefaultMessage(getRecipient());
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityVerifiedMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityVerifiedMessage.java
deleted file mode 100644
index a0a580674b..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingIdentityVerifiedMessage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-
-import org.session.libsession.messaging.threads.recipients.Recipient;
-
-public class OutgoingIdentityVerifiedMessage extends OutgoingTextMessage {
-
- public OutgoingIdentityVerifiedMessage(Recipient recipient) {
- this(recipient, "");
- }
-
- private OutgoingIdentityVerifiedMessage(Recipient recipient, String body) {
- super(recipient, body, -1);
- }
-
- @Override
- public boolean isIdentityVerified() {
- return true;
- }
-
- @Override
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingIdentityVerifiedMessage(getRecipient(), body);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingKeyExchangeMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingKeyExchangeMessage.java
deleted file mode 100644
index 9737866a97..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingKeyExchangeMessage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-import org.session.libsession.messaging.threads.recipients.Recipient;
-
-public class OutgoingKeyExchangeMessage extends OutgoingTextMessage {
-
- public OutgoingKeyExchangeMessage(Recipient recipient, String message) {
- super(recipient, message, -1);
- }
-
- private OutgoingKeyExchangeMessage(OutgoingKeyExchangeMessage base, String body) {
- super(base, body);
- }
-
- @Override
- public boolean isKeyExchange() {
- return true;
- }
-
- @Override
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingKeyExchangeMessage(this, body);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java
deleted file mode 100644
index ae7f9329a4..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingPrekeyBundleMessage.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.thoughtcrime.securesms.sms;
-
-
-public class OutgoingPrekeyBundleMessage extends OutgoingTextMessage {
-
- public OutgoingPrekeyBundleMessage(OutgoingTextMessage message, String body) {
- super(message, body);
- }
-
- @Override
- public boolean isPreKeyBundle() {
- return true;
- }
-
- @Override
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingPrekeyBundleMessage(this, body);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingTextMessage.java b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingTextMessage.java
index c09b426472..dca0af749e 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingTextMessage.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/sms/OutgoingTextMessage.java
@@ -11,10 +11,6 @@ public class OutgoingTextMessage {
private final int subscriptionId;
private final long expiresIn;
- public OutgoingTextMessage(Recipient recipient, String message, int subscriptionId) {
- this(recipient, message, 0, subscriptionId);
- }
-
public OutgoingTextMessage(Recipient recipient, String message, long expiresIn, int subscriptionId) {
this.recipient = recipient;
this.message = message;
@@ -22,13 +18,6 @@ public class OutgoingTextMessage {
this.subscriptionId = subscriptionId;
}
- protected OutgoingTextMessage(OutgoingTextMessage base, String body) {
- this.recipient = base.getRecipient();
- this.subscriptionId = base.getSubscriptionId();
- this.expiresIn = base.getExpiresIn();
- this.message = body;
- }
-
public static OutgoingTextMessage from(VisibleMessage message, Recipient recipient) {
return new OutgoingTextMessage(recipient, message.getText(), recipient.getExpireMessages() * 1000, -1);
}
@@ -49,43 +38,15 @@ public class OutgoingTextMessage {
return recipient;
}
- public boolean isKeyExchange() {
- return false;
- }
-
public boolean isSecureMessage() {
return false;
}
- public boolean isEndSession() {
- return false;
- }
-
- public boolean isPreKeyBundle() {
- return false;
- }
-
- public boolean isIdentityVerified() {
- return false;
- }
-
- public boolean isIdentityDefault() {
- return false;
- }
-
public static OutgoingTextMessage from(SmsMessageRecord record) {
if (record.isSecure()) {
return new OutgoingEncryptedMessage(record.getRecipient(), record.getBody(), record.getExpiresIn());
- } else if (record.isKeyExchange()) {
- return new OutgoingKeyExchangeMessage(record.getRecipient(), record.getBody());
- } else if (record.isEndSession()) {
- return new OutgoingEndSessionMessage(new OutgoingTextMessage(record.getRecipient(), record.getBody(), 0, -1));
} else {
return new OutgoingTextMessage(record.getRecipient(), record.getBody(), record.getExpiresIn(), record.getSubscriptionId());
}
}
-
- public OutgoingTextMessage withBody(String body) {
- return new OutgoingTextMessage(this, body);
- }
}