/** M: Create a message for test purposes */
  public static Message setupMessage(
      String name,
      long accountId,
      long mailboxId,
      String msgInfo,
      boolean addBody,
      boolean saveIt,
      Context context,
      boolean starred,
      boolean read) {
    Message message = new Message();

    message.mDisplayName = name;
    message.mMailboxKey = mailboxId;
    message.mAccountKey = accountId;
    message.mFlagRead = read;
    message.mFlagLoaded = Message.FLAG_LOADED_UNLOADED;
    message.mFlagFavorite = starred;
    message.mServerId = "serverid " + name;
    message.mMeetingInfo = msgInfo;
    message.mFlags |= Message.FLAG_TYPE_REPLY;

    if (addBody) {
      message.mText = "body text " + name;
      message.mHtml = "body html " + name;
    }

    if (saveIt) {
      message.save(context);
    }
    return message;
  }
Beispiel #2
0
 private boolean parseResult(EasEmailSyncParser parser, ArrayList<ContentProviderOperation> ops)
     throws IOException {
   // Get an email sync parser for our incoming message data
   boolean res = false;
   Message msg = new Message();
   while (nextTag(Tags.SEARCH_RESULT) != END) {
     if (tag == Tags.SYNC_CLASS) {
       getValue();
     } else if (tag == Tags.SYNC_COLLECTION_ID) {
       getValue();
     } else if (tag == Tags.SEARCH_LONG_ID) {
       msg.mProtocolSearchInfo = getValue();
     } else if (tag == Tags.SEARCH_PROPERTIES) {
       msg.mAccountKey = mService.mAccount.mId;
       msg.mMailboxKey = mService.mMailbox.mId;
       msg.mFlagLoaded = Message.FLAG_LOADED_COMPLETE;
       parser.pushTag(tag);
       parser.addData(msg, tag);
       if (msg.mHtml != null) {
         msg.mHtml = TextUtilities.highlightTermsInHtml(msg.mHtml, mQuery);
       }
       msg.addSaveOps(ops);
     } else {
       skipTag();
     }
   }
   return res;
 }