Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6209d01d authored by Ashwini Munigala's avatar Ashwini Munigala Committed by Linux Build Service Account
Browse files

MAP: Fix email parseBody and SMS MNS event issue

Handle Email pushMessage complete body parsing issue
for possible multiple occurencs of END:MSG in body.
Get index for last occurence of END:MSG in BMessage
pushed through MCE .

Allow SMS/MMS MNS sendingSucess event as always local
initiated.

Change-Id: I7d56279cd42683da4d7325030df3a74cbb4c59d2
CRs-fixed: 748338
parent c91559f3
Loading
Loading
Loading
Loading
+11 −19
Original line number Diff line number Diff line
@@ -343,25 +343,17 @@ public class BluetoothMapContentObserver {
        Log.d(TAG, "msgHandle is "+msgHandle);
        location = findLocationMceInitiatedOperation(Long.toString(evt.handle));
        Log.d(TAG, "location is "+location);
        if(evt.eventType.equalsIgnoreCase("SendingSuccess")) {
           if(location != -1) {
        // 'SendingSuccess' is triggered only for MCE initiated case
        if(location == -1 || evt.eventType.equalsIgnoreCase("SendingSuccess")) {
            try {
                mMnsClient.sendEvent(evt.encode(), mMasId);
            } catch (UnsupportedEncodingException ex) {
                Log.w(TAG, ex);
            }
        } else {
                  Log.d(TAG, "not sending success event");
            Log.d(TAG, "Not MCE initiated operation" +location);
            return;
        }
        } else if (location == -1) {
           try {
               Log.d(TAG, "sending mns event");
               mMnsClient.sendEvent(evt.encode(), mMasId);
           } catch (UnsupportedEncodingException ex) {
               Log.w(TAG, ex);
           }
        }
    }

    private void initMsgList() {
@@ -499,7 +491,7 @@ public class BluetoothMapContentObserver {
                            sendEvent(evt);
                            msg.type = type;

                            // SendingSuccess for MMS ONLY when local initiated
                            // Trigger 'SendingSuccess' for MMS ONLY when local initiated
                            int loc = findLocationMceInitiatedOperation(Long.toString(id));
                            if (folderMms[type].equals("sent")&& loc != -1) {
                                evt = new Event("SendingSuccess", id,
+2 −2
Original line number Diff line number Diff line
@@ -749,7 +749,7 @@ public class BluetoothMapbMessageMmsEmail extends BluetoothMapbMessage {
               if (beginMsg == -1) {
                   throw new IllegalArgumentException("Ill-formatted bMessage, no BEGIN:MSG");
               }
               int endMsg = body.indexOf("END:MSG", beginMsg);
               int endMsg = body.lastIndexOf("END:MSG", beginMsg);
               if (endMsg == -1) {
                   throw new IllegalArgumentException("Ill-formatted bMessage, no END:MSG");
               }
@@ -764,7 +764,7 @@ public class BluetoothMapbMessageMmsEmail extends BluetoothMapbMessage {
       int endVersionPos;
       if(rfc822Flag == 0){
          if(mimeFlag == 0) {
             endVersionPos = body.indexOf("END:MSG", beginVersionPos) ;
             endVersionPos = body.lastIndexOf("END:MSG", beginVersionPos) ;
             if (endVersionPos != -1) {
                 setEmailBody(body.substring(beginVersionPos, (endVersionPos - CRLF.length())));
             } else {