Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plaintext Export sets wrong "status" attribute in XML #503

Closed
milux opened this issue Dec 23, 2013 · 3 comments
Closed

Plaintext Export sets wrong "status" attribute in XML #503

milux opened this issue Dec 23, 2013 · 3 comments

Comments

@milux
Copy link

milux commented Dec 23, 2013

When using the plaintext export and import the XML with "SMS Backup And Restore", all restored messages in the "SMS/MMS" app have the green tick icon which says that the receiver got the message (even the ones sent by oneself).
This happens always, even if no delivery report has ever been requested for a particular SMS.
This occurs because the exporter sets the attribute "status" to "0" instead of "-1", which seems to be the right one here.

[System: CyanogenMod 10.2.0 stable on I9505]

@payload
Copy link

payload commented Jul 13, 2014

I doubt on the correctness on this and investigate it. PlaintextBackupExporter is writing a 1 into "read" field of XmlBackupItem. I guess this is the one which ultimately triggers the tick icon.

@payload
Copy link

payload commented Jul 13, 2014

Ah, this mismatch resulted from a disconnection between
status codes as defined in MessageRecord and
the status codes in SmsDatabase.

  // SmsDatabase
  public static class Status {
    public static final int STATUS_NONE     = -1;
    public static final int STATUS_COMPLETE  = 0;
    public static final int STATUS_PENDING   = 0x20;
    public static final int STATUS_FAILED    = 0x40;
  }

  // MessageRecord
  public static final int DELIVERY_STATUS_NONE     = 0;
  public static final int DELIVERY_STATUS_RECEIVED = 1;
  public static final int DELIVERY_STATUS_PENDING  = 2;
  public static final int DELIVERY_STATUS_FAILED   = 3;

  // SmsMessageRecord
  private static int getGenericDeliveryStatus(int status) {
    if (status == SmsDatabase.Status.STATUS_NONE) {
      return MessageRecord.DELIVERY_STATUS_NONE;
    } else if (status >= SmsDatabase.Status.STATUS_FAILED) {
      return MessageRecord.DELIVERY_STATUS_FAILED;
    } else if (status >= SmsDatabase.Status.STATUS_PENDING) {
      return MessageRecord.DELIVERY_STATUS_PENDING;
    } else {
      return MessageRecord.DELIVERY_STATUS_RECEIVED;
    }
  }

@rhodey rhodey added the bug label Mar 16, 2015
@automated-signal
Copy link

GitHub Issue Cleanup:
See #7598 for more information.

@signalapp signalapp locked and limited conversation to collaborators Apr 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants