kopia lustrzana https://github.com/ryukoposting/Signal-Android
rodzic
0bd9606666
commit
989ea4042c
|
@ -519,7 +519,8 @@ public class MmsDatabase extends MessagingDatabase {
|
||||||
cursor = rawQuery(RAW_ID_WHERE, new String[] {String.valueOf(messageId)});
|
cursor = rawQuery(RAW_ID_WHERE, new String[] {String.valueOf(messageId)});
|
||||||
|
|
||||||
if (cursor != null && cursor.moveToNext()) {
|
if (cursor != null && cursor.moveToNext()) {
|
||||||
return Optional.of(new MmsNotificationInfo(cursor.getString(cursor.getColumnIndexOrThrow(CONTENT_LOCATION)),
|
return Optional.of(new MmsNotificationInfo(cursor.getString(cursor.getColumnIndexOrThrow(ADDRESS)),
|
||||||
|
cursor.getString(cursor.getColumnIndexOrThrow(CONTENT_LOCATION)),
|
||||||
cursor.getString(cursor.getColumnIndexOrThrow(TRANSACTION_ID)),
|
cursor.getString(cursor.getColumnIndexOrThrow(TRANSACTION_ID)),
|
||||||
cursor.getInt(cursor.getColumnIndexOrThrow(SUBSCRIPTION_ID))));
|
cursor.getInt(cursor.getColumnIndexOrThrow(SUBSCRIPTION_ID))));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1002,11 +1003,13 @@ public class MmsDatabase extends MessagingDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MmsNotificationInfo {
|
public static class MmsNotificationInfo {
|
||||||
private final String contentLocation;
|
private final Address from;
|
||||||
private final String transactionId;
|
private final String contentLocation;
|
||||||
private final int subscriptionId;
|
private final String transactionId;
|
||||||
|
private final int subscriptionId;
|
||||||
|
|
||||||
public MmsNotificationInfo(String contentLocation, String transactionId, int subscriptionId) {
|
MmsNotificationInfo(@Nullable String from, String contentLocation, String transactionId, int subscriptionId) {
|
||||||
|
this.from = from == null ? null : Address.fromSerialized(from);
|
||||||
this.contentLocation = contentLocation;
|
this.contentLocation = contentLocation;
|
||||||
this.transactionId = transactionId;
|
this.transactionId = transactionId;
|
||||||
this.subscriptionId = subscriptionId;
|
this.subscriptionId = subscriptionId;
|
||||||
|
@ -1023,6 +1026,10 @@ public class MmsDatabase extends MessagingDatabase {
|
||||||
public int getSubscriptionId() {
|
public int getSubscriptionId() {
|
||||||
return subscriptionId;
|
return subscriptionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @Nullable Address getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OutgoingMessageReader {
|
public class OutgoingMessageReader {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.jobs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.mms.pdu_alt.CharacterSets;
|
import com.google.android.mms.pdu_alt.CharacterSets;
|
||||||
|
@ -115,7 +116,7 @@ public class MmsDownloadJob extends MasterSecretJob {
|
||||||
throw new MmsException("RetrieveConf was null");
|
throw new MmsException("RetrieveConf was null");
|
||||||
}
|
}
|
||||||
|
|
||||||
storeRetrievedMms(masterSecret, contentLocation, messageId, threadId, retrieveConf, notification.get().getSubscriptionId());
|
storeRetrievedMms(masterSecret, contentLocation, messageId, threadId, retrieveConf, notification.get().getSubscriptionId(), notification.get().getFrom());
|
||||||
} catch (ApnUnavailableException e) {
|
} catch (ApnUnavailableException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
handleDownloadError(masterSecret, messageId, threadId, MmsDatabase.Status.DOWNLOAD_APN_UNAVAILABLE,
|
handleDownloadError(masterSecret, messageId, threadId, MmsDatabase.Status.DOWNLOAD_APN_UNAVAILABLE,
|
||||||
|
@ -163,7 +164,7 @@ public class MmsDownloadJob extends MasterSecretJob {
|
||||||
|
|
||||||
private void storeRetrievedMms(MasterSecret masterSecret, String contentLocation,
|
private void storeRetrievedMms(MasterSecret masterSecret, String contentLocation,
|
||||||
long messageId, long threadId, RetrieveConf retrieved,
|
long messageId, long threadId, RetrieveConf retrieved,
|
||||||
int subscriptionId)
|
int subscriptionId, @Nullable Address notificationFrom)
|
||||||
throws MmsException, NoSessionException, DuplicateMessageException, InvalidMessageException,
|
throws MmsException, NoSessionException, DuplicateMessageException, InvalidMessageException,
|
||||||
LegacyMessageException
|
LegacyMessageException
|
||||||
{
|
{
|
||||||
|
@ -178,6 +179,8 @@ public class MmsDownloadJob extends MasterSecretJob {
|
||||||
|
|
||||||
if (retrieved.getFrom() != null) {
|
if (retrieved.getFrom() != null) {
|
||||||
from = Address.fromExternal(context, Util.toIsoString(retrieved.getFrom().getTextString()));
|
from = Address.fromExternal(context, Util.toIsoString(retrieved.getFrom().getTextString()));
|
||||||
|
} else if (notificationFrom != null) {
|
||||||
|
from = notificationFrom;
|
||||||
} else {
|
} else {
|
||||||
from = Address.UNKNOWN;
|
from = Address.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +197,7 @@ public class MmsDownloadJob extends MasterSecretJob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
members.add(from);
|
||||||
members.add(Address.fromExternal(context, TextSecurePreferences.getLocalNumber(context)));
|
members.add(Address.fromExternal(context, TextSecurePreferences.getLocalNumber(context)));
|
||||||
|
|
||||||
if (retrieved.getBody() != null) {
|
if (retrieved.getBody() != null) {
|
||||||
|
|
Ładowanie…
Reference in New Issue