mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 09:52:16 -05:00
commit
80fa468ec2
@ -36,27 +36,27 @@ public class MessageReferenceTest {
|
||||
public void parseIdentityStringWithoutFlag() throws MessagingException {
|
||||
MessageReference messageReference = new MessageReference("!:byBoYWkh:Zm9sZGVy:MTAxMDEwMTA=");
|
||||
|
||||
assertEquals("o hai!", messageReference.accountUuid);
|
||||
assertEquals("folder", messageReference.folderName);
|
||||
assertEquals("10101010", messageReference.uid);
|
||||
assertNull(messageReference.flag);
|
||||
assertEquals("o hai!", messageReference.getAccountUuid());
|
||||
assertEquals("folder", messageReference.getFolderName());
|
||||
assertEquals("10101010", messageReference.getUid());
|
||||
assertNull(messageReference.getFlag());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseIdentityStringWithFlag() throws MessagingException {
|
||||
MessageReference messageReference = new MessageReference("!:byBoYWkh:Zm9sZGVy:MTAxMDEwMTA=:ANSWERED");
|
||||
|
||||
assertEquals("o hai!", messageReference.accountUuid);
|
||||
assertEquals("folder", messageReference.folderName);
|
||||
assertEquals("10101010", messageReference.uid);
|
||||
assertEquals(Flag.ANSWERED, messageReference.flag);
|
||||
assertEquals("o hai!", messageReference.getAccountUuid());
|
||||
assertEquals("folder", messageReference.getFolderName());
|
||||
assertEquals("10101010", messageReference.getUid());
|
||||
assertEquals(Flag.ANSWERED, messageReference.getFlag());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseIdentityStringContainingBadVersionNumber() throws MessagingException {
|
||||
MessageReference messageReference = new MessageReference("@:byBoYWkh:Zm9sZGVy:MTAxMDEwMTA=:ANSWERED");
|
||||
|
||||
assertNull(messageReference.accountUuid);
|
||||
assertNull(messageReference.getAccountUuid());
|
||||
}
|
||||
|
||||
@Test(expected = MessagingException.class)
|
||||
@ -71,7 +71,7 @@ public class MessageReferenceTest {
|
||||
|
||||
@Test
|
||||
public void equalsWithAnObjectShouldReturnFalse() {
|
||||
MessageReference messageReference = new MessageReference();
|
||||
MessageReference messageReference = new MessageReference(null, null, null, null);
|
||||
Object object = new Object();
|
||||
|
||||
assertFalse(messageReference.equals(object));
|
||||
@ -125,21 +125,14 @@ public class MessageReferenceTest {
|
||||
}
|
||||
|
||||
private MessageReference createMessageReference(String accountUuid, String folderName, String uid) {
|
||||
MessageReference messageReference = new MessageReference();
|
||||
messageReference.accountUuid = accountUuid;
|
||||
messageReference.folderName = folderName;
|
||||
messageReference.uid = uid;
|
||||
MessageReference messageReference = new MessageReference(accountUuid, folderName, uid, null);
|
||||
|
||||
return messageReference;
|
||||
}
|
||||
|
||||
private MessageReference createMessageReferenceWithFlag(String accountUuid, String folderName, String uid,
|
||||
Flag flag) {
|
||||
MessageReference messageReference = new MessageReference();
|
||||
messageReference.accountUuid = accountUuid;
|
||||
messageReference.folderName = folderName;
|
||||
messageReference.uid = uid;
|
||||
messageReference.flag = flag;
|
||||
MessageReference messageReference = new MessageReference(accountUuid, folderName, uid, flag);
|
||||
|
||||
return messageReference;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
final String accountUuid = (mMessageReference != null) ?
|
||||
mMessageReference.accountUuid :
|
||||
mMessageReference.getAccountUuid() :
|
||||
intent.getStringExtra(EXTRA_ACCOUNT);
|
||||
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
@ -715,9 +715,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
*/
|
||||
MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
||||
final String folderName = mMessageReference.folderName;
|
||||
final String sourceMessageUid = mMessageReference.uid;
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
|
||||
final String folderName = mMessageReference.getFolderName();
|
||||
final String sourceMessageUid = mMessageReference.getUid();
|
||||
MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null);
|
||||
}
|
||||
|
||||
@ -727,7 +727,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
if (mAction == Action.REPLY || mAction == Action.REPLY_ALL) {
|
||||
mMessageReference.flag = Flag.ANSWERED;
|
||||
mMessageReference = mMessageReference.withModifiedFlag(Flag.ANSWERED);
|
||||
}
|
||||
|
||||
if (mAction == Action.REPLY || mAction == Action.REPLY_ALL ||
|
||||
@ -740,7 +740,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
if (mAction == Action.FORWARD) {
|
||||
mMessageReference.flag = Flag.FORWARDED;
|
||||
mMessageReference = mMessageReference.withModifiedFlag(Flag.FORWARDED);
|
||||
}
|
||||
|
||||
final View mEncryptLayout = findViewById(R.id.layout_encrypt);
|
||||
@ -1317,15 +1317,15 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
sendMessage();
|
||||
|
||||
if (mMessageReference != null && mMessageReference.flag != null) {
|
||||
if (mMessageReference != null && mMessageReference.getFlag() != null) {
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Setting referenced message (" + mMessageReference.folderName + ", " + mMessageReference.uid + ") flag to " + mMessageReference.flag);
|
||||
Log.d(K9.LOG_TAG, "Setting referenced message (" + mMessageReference.getFolderName() + ", " + mMessageReference.getUid() + ") flag to " + mMessageReference.getFlag());
|
||||
}
|
||||
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
||||
final String folderName = mMessageReference.folderName;
|
||||
final String sourceMessageUid = mMessageReference.uid;
|
||||
MessagingController.getInstance(getApplication()).setFlag(account, folderName, sourceMessageUid, mMessageReference.flag, true);
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
|
||||
final String folderName = mMessageReference.getFolderName();
|
||||
final String sourceMessageUid = mMessageReference.getUid();
|
||||
MessagingController.getInstance(getApplication()).setFlag(account, folderName, sourceMessageUid, mMessageReference.getFlag(), true);
|
||||
}
|
||||
|
||||
mDraftNeedsSaving = false;
|
||||
@ -1888,9 +1888,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
if (mMessageReference != null) { // shouldn't happen...
|
||||
// TODO - Should we check if mSourceMessageBody is already present and bypass the MessagingController call?
|
||||
MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
||||
final String folderName = mMessageReference.folderName;
|
||||
final String sourceMessageUid = mMessageReference.uid;
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
|
||||
final String folderName = mMessageReference.getFolderName();
|
||||
final String sourceMessageUid = mMessageReference.getUid();
|
||||
MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null);
|
||||
}
|
||||
break;
|
||||
@ -2415,7 +2415,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
|
||||
// Check if this is a valid account in our database
|
||||
Preferences prefs = Preferences.getPreferences(getApplicationContext());
|
||||
Account account = prefs.getAccount(messageReference.accountUuid);
|
||||
Account account = prefs.getAccount(messageReference.getAccountUuid());
|
||||
if (account != null) {
|
||||
mMessageReference = messageReference;
|
||||
}
|
||||
@ -2931,7 +2931,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
class Listener extends MessagingListener {
|
||||
@Override
|
||||
public void loadMessageForViewStarted(Account account, String folder, String uid) {
|
||||
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) {
|
||||
if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2940,7 +2940,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void loadMessageForViewFinished(Account account, String folder, String uid, LocalMessage message) {
|
||||
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) {
|
||||
if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2949,7 +2949,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, final Message message) {
|
||||
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) {
|
||||
if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2980,7 +2980,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void loadMessageForViewFailed(Account account, String folder, String uid, Throwable t) {
|
||||
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) {
|
||||
if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
|
||||
return;
|
||||
}
|
||||
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
|
||||
@ -2991,13 +2991,13 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
|
||||
// Track UID changes of the source message
|
||||
if (mMessageReference != null) {
|
||||
final Account sourceAccount = Preferences.getPreferences(MessageCompose.this).getAccount(mMessageReference.accountUuid);
|
||||
final String sourceFolder = mMessageReference.folderName;
|
||||
final String sourceMessageUid = mMessageReference.uid;
|
||||
final Account sourceAccount = Preferences.getPreferences(MessageCompose.this).getAccount(mMessageReference.getAccountUuid());
|
||||
final String sourceFolder = mMessageReference.getFolderName();
|
||||
final String sourceMessageUid = mMessageReference.getUid();
|
||||
|
||||
if (account.equals(sourceAccount) && (folder.equals(sourceFolder))) {
|
||||
if (oldUid.equals(sourceMessageUid)) {
|
||||
mMessageReference.uid = newUid;
|
||||
mMessageReference = mMessageReference.withModifiedUid(newUid);
|
||||
}
|
||||
if ((mSourceMessage != null) && (oldUid.equals(mSourceMessage.getUid()))) {
|
||||
mSourceMessage.setUid(newUid);
|
||||
@ -3141,7 +3141,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
* to the old message's uid.
|
||||
*/
|
||||
if (mMessageReference != null) {
|
||||
message.setUid(mMessageReference.uid);
|
||||
message.setUid(mMessageReference.getUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,10 +379,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
Collection<Account> accounts = Preferences.getPreferences(this).getAvailableAccounts();
|
||||
for (Account account : accounts) {
|
||||
if (String.valueOf(account.getAccountNumber()).equals(accountId)) {
|
||||
mMessageReference = new MessageReference();
|
||||
mMessageReference.accountUuid = account.getUuid();
|
||||
mMessageReference.folderName = segmentList.get(1);
|
||||
mMessageReference.uid = segmentList.get(2);
|
||||
String folderName = segmentList.get(1);
|
||||
String messageUid = segmentList.get(2);
|
||||
mMessageReference = new MessageReference(account.getUuid(), folderName, messageUid, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -431,8 +430,8 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
|
||||
if (mMessageReference != null) {
|
||||
mSearch = new LocalSearch();
|
||||
mSearch.addAccountUuid(mMessageReference.accountUuid);
|
||||
mSearch.addAllowedFolder(mMessageReference.folderName);
|
||||
mSearch.addAccountUuid(mMessageReference.getAccountUuid());
|
||||
mSearch.addAllowedFolder(mMessageReference.getFolderName());
|
||||
}
|
||||
|
||||
if (mSearch == null) {
|
||||
@ -1168,8 +1167,8 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
@Override
|
||||
public void openMessage(MessageReference messageReference) {
|
||||
Preferences prefs = Preferences.getPreferences(getApplicationContext());
|
||||
Account account = prefs.getAccount(messageReference.accountUuid);
|
||||
String folderName = messageReference.folderName;
|
||||
Account account = prefs.getAccount(messageReference.getAccountUuid());
|
||||
String folderName = messageReference.getFolderName();
|
||||
|
||||
if (folderName.equals(account.getDraftsFolderName())) {
|
||||
MessageCompose.actionEditDraft(this, messageReference);
|
||||
|
@ -17,15 +17,20 @@ import com.fsck.k9.mail.filter.Base64;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class MessageReference implements Parcelable {
|
||||
public String accountUuid;
|
||||
public String folderName;
|
||||
public String uid;
|
||||
public Flag flag = null;
|
||||
private final String accountUuid;
|
||||
private final String folderName;
|
||||
private final String uid;
|
||||
private final Flag flag;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize an empty MessageReference.
|
||||
* Initialize a new MessageReference.
|
||||
*/
|
||||
public MessageReference() {
|
||||
public MessageReference(String accountUuid, String folderName, String uid, Flag flag) {
|
||||
this.accountUuid = accountUuid;
|
||||
this.folderName = folderName;
|
||||
this.uid = uid;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
// Version identifier for use when serializing. This will allow us to introduce future versions
|
||||
@ -34,7 +39,7 @@ public class MessageReference implements Parcelable {
|
||||
private static final String IDENTITY_SEPARATOR = ":";
|
||||
|
||||
/**
|
||||
* Initialize a MessageReference from a seraialized identity.
|
||||
* Initialize a MessageReference from a serialized identity.
|
||||
* @param identity Serialized identity.
|
||||
* @throws MessagingException On missing or corrupted identity.
|
||||
*/
|
||||
@ -44,6 +49,10 @@ public class MessageReference implements Parcelable {
|
||||
throw new MessagingException("Null or truncated MessageReference identity.");
|
||||
}
|
||||
|
||||
String accountUuid = null;
|
||||
String folderName = null;
|
||||
String uid = null;
|
||||
Flag flag = null;
|
||||
// Version check.
|
||||
if (identity.charAt(0) == IDENTITY_VERSION_1.charAt(0)) {
|
||||
// Split the identity, stripping away the first two characters representing the version and delimiter.
|
||||
@ -62,12 +71,17 @@ public class MessageReference implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Thawed " + toString());
|
||||
}
|
||||
} else {
|
||||
throw new MessagingException("Invalid MessageReference in " + identity + " identity.");
|
||||
}
|
||||
}
|
||||
this.accountUuid = accountUuid;
|
||||
this.folderName = folderName;
|
||||
this.uid = uid;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,12 +170,16 @@ public class MessageReference implements Parcelable {
|
||||
public static final Creator<MessageReference> CREATOR = new Creator<MessageReference>() {
|
||||
@Override
|
||||
public MessageReference createFromParcel(Parcel source) {
|
||||
MessageReference ref = new MessageReference();
|
||||
ref.uid = source.readString();
|
||||
ref.accountUuid = source.readString();
|
||||
ref.folderName = source.readString();
|
||||
MessageReference ref;
|
||||
String uid = source.readString();
|
||||
String accountUuid = source.readString();
|
||||
String folderName = source.readString();
|
||||
String flag = source.readString();
|
||||
if (flag != null) ref.flag = Flag.valueOf(flag);
|
||||
if (flag != null) {
|
||||
ref = new MessageReference(uid, accountUuid, folderName, Flag.valueOf(flag));
|
||||
} else {
|
||||
ref = new MessageReference(uid, accountUuid, folderName, null);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -183,4 +201,28 @@ public class MessageReference implements Parcelable {
|
||||
dest.writeString(folderName);
|
||||
dest.writeString(flag == null ? null : flag.name());
|
||||
}
|
||||
|
||||
public String getAccountUuid() {
|
||||
return accountUuid;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return folderName;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public Flag getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public MessageReference withModifiedUid(String newUid) {
|
||||
return new MessageReference(accountUuid, folderName, newUid, flag);
|
||||
}
|
||||
|
||||
public MessageReference withModifiedFlag(Flag newFlag) {
|
||||
return new MessageReference(accountUuid, folderName, uid, newFlag);
|
||||
}
|
||||
}
|
||||
|
@ -4908,7 +4908,7 @@ public class MessagingController implements Runnable {
|
||||
String initialFolder = message.getFolder().getName();
|
||||
/* only go to folder if all messages are in the same folder, else go to folder list */
|
||||
for (MessageReference ref : allRefs) {
|
||||
if (!TextUtils.equals(initialFolder, ref.folderName)) {
|
||||
if (!TextUtils.equals(initialFolder, ref.getFolderName())) {
|
||||
initialFolder = null;
|
||||
break;
|
||||
}
|
||||
@ -4980,8 +4980,8 @@ public class MessagingController implements Runnable {
|
||||
}
|
||||
|
||||
private TaskStackBuilder buildMessageViewBackStack(Context context, MessageReference message) {
|
||||
Account account = Preferences.getPreferences(context).getAccount(message.accountUuid);
|
||||
TaskStackBuilder stack = buildMessageListBackStack(context, account, message.folderName);
|
||||
Account account = Preferences.getPreferences(context).getAccount(message.getAccountUuid());
|
||||
TaskStackBuilder stack = buildMessageListBackStack(context, account, message.getFolderName());
|
||||
stack.addNextIntent(MessageList.actionDisplayMessageIntent(context, message));
|
||||
return stack;
|
||||
}
|
||||
|
@ -2007,9 +2007,9 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
String uid = cursor.getString(UID_COLUMN);
|
||||
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
|
||||
if (account.getUuid().equals(mActiveMessage.accountUuid) &&
|
||||
folderName.equals(mActiveMessage.folderName) &&
|
||||
uid.equals(mActiveMessage.uid)) {
|
||||
if (account.getUuid().equals(mActiveMessage.getAccountUuid()) &&
|
||||
folderName.equals(mActiveMessage.getFolderName()) &&
|
||||
uid.equals(mActiveMessage.getUid())) {
|
||||
int res = R.attr.messageListActiveItemBackgroundColor;
|
||||
|
||||
TypedValue outValue = new TypedValue();
|
||||
@ -2992,10 +2992,10 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
for (int i = 0, len = mAdapter.getCount(); i < len; i++) {
|
||||
Cursor cursor = (Cursor) mAdapter.getItem(i);
|
||||
|
||||
MessageReference ref = new MessageReference();
|
||||
ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
|
||||
ref.folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
ref.uid = cursor.getString(UID_COLUMN);
|
||||
String accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
|
||||
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
String messageUid = cursor.getString(UID_COLUMN);
|
||||
MessageReference ref = new MessageReference(accountUuid, folderName, messageUid, null);
|
||||
|
||||
messageRefs.add(ref);
|
||||
}
|
||||
@ -3058,12 +3058,11 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
|
||||
private MessageReference getReferenceForPosition(int position) {
|
||||
Cursor cursor = (Cursor) mAdapter.getItem(position);
|
||||
MessageReference ref = new MessageReference();
|
||||
ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
|
||||
ref.folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
ref.uid = cursor.getString(UID_COLUMN);
|
||||
|
||||
return ref;
|
||||
String accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
|
||||
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
String messageUid = cursor.getString(UID_COLUMN);
|
||||
return new MessageReference(accountUuid, folderName, messageUid, null);
|
||||
}
|
||||
|
||||
private void openMessageAtPosition(int position) {
|
||||
@ -3091,9 +3090,9 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||
String uid = cursor.getString(UID_COLUMN);
|
||||
|
||||
if (accountUuid.equals(messageReference.accountUuid) &&
|
||||
folderName.equals(messageReference.folderName) &&
|
||||
uid.equals(messageReference.uid)) {
|
||||
if (accountUuid.equals(messageReference.getAccountUuid()) &&
|
||||
folderName.equals(messageReference.getFolderName()) &&
|
||||
uid.equals(messageReference.getUid())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -3330,12 +3329,12 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
StringBuilder query = new StringBuilder();
|
||||
List<String> queryArgs = new ArrayList<String>();
|
||||
if (needConditions) {
|
||||
boolean selectActive = mActiveMessage != null && mActiveMessage.accountUuid.equals(accountUuid);
|
||||
boolean selectActive = mActiveMessage != null && mActiveMessage.getAccountUuid().equals(accountUuid);
|
||||
|
||||
if (selectActive) {
|
||||
query.append("(" + MessageColumns.UID + " = ? AND " + SpecialColumns.FOLDER_NAME + " = ?) OR (");
|
||||
queryArgs.add(mActiveMessage.uid);
|
||||
queryArgs.add(mActiveMessage.folderName);
|
||||
queryArgs.add(mActiveMessage.getUid());
|
||||
queryArgs.add(mActiveMessage.getFolderName());
|
||||
}
|
||||
|
||||
SqlQueryBuilder.buildWhereClause(account, mSearch.getConditions(), query, queryArgs);
|
||||
|
@ -509,10 +509,7 @@ public class LocalMessage extends MimeMessage {
|
||||
|
||||
public MessageReference makeMessageReference() {
|
||||
if (mReference == null) {
|
||||
mReference = new MessageReference();
|
||||
mReference.folderName = getFolder().getName();
|
||||
mReference.uid = mUid;
|
||||
mReference.accountUuid = getFolder().getAccountUuid();
|
||||
mReference = new MessageReference(getFolder().getAccountUuid(), getFolder().getName(), mUid, null);
|
||||
}
|
||||
return mReference;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class NotificationActionService extends CoreService {
|
||||
List<MessageReference> refs =
|
||||
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
|
||||
for (MessageReference ref : refs) {
|
||||
controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true);
|
||||
controller.setFlag(account, ref.getFolderName(), ref.getUid(), Flag.SEEN, true);
|
||||
}
|
||||
} else if (DELETE_ALL_ACTION.equals(action)) {
|
||||
if (K9.DEBUG)
|
||||
|
@ -55,6 +55,6 @@ public class LocalMessageLoader extends AsyncTaskLoader<LocalMessage> {
|
||||
}
|
||||
|
||||
private LocalMessage loadMessageFromDatabase() throws MessagingException {
|
||||
return controller.loadMessage(account, messageReference.folderName, messageReference.uid);
|
||||
return controller.loadMessage(account, messageReference.getFolderName(), messageReference.getUid());
|
||||
}
|
||||
}
|
||||
|
@ -197,9 +197,8 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
}
|
||||
|
||||
Context appContext = getActivity().getApplicationContext();
|
||||
mAccount = Preferences.getPreferences(appContext).getAccount(mMessageReference.accountUuid);
|
||||
mAccount = Preferences.getPreferences(appContext).getAccount(mMessageReference.getAccountUuid());
|
||||
messageCryptoHelper = new MessageCryptoHelper(getActivity(), mAccount, this);
|
||||
|
||||
if (resetPgpData) {
|
||||
// start with fresh, empty PGP data
|
||||
mPgpData = new PgpData();
|
||||
@ -346,7 +345,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
}
|
||||
|
||||
private void refileMessage(String dstFolder) {
|
||||
String srcFolder = mMessageReference.folderName;
|
||||
String srcFolder = mMessageReference.getFolderName();
|
||||
LocalMessage messageToMove = mMessage;
|
||||
mFragmentListener.showNextMessageOrReturn();
|
||||
mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
|
||||
@ -424,7 +423,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
private void startRefileActivity(int activity) {
|
||||
Intent intent = new Intent(getActivity(), ChooseFolder.class);
|
||||
intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
|
||||
intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.folderName);
|
||||
intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.getFolderName());
|
||||
intent.putExtra(ChooseFolder.EXTRA_SEL_FOLDER, mAccount.getLastSelectedFolderName());
|
||||
intent.putExtra(ChooseFolder.EXTRA_MESSAGE, mMessageReference);
|
||||
startActivityForResult(intent, activity);
|
||||
@ -499,8 +498,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
return;
|
||||
}
|
||||
mMessageView.disableDownloadButton();
|
||||
|
||||
mController.loadMessageForViewRemote(mAccount, mMessageReference.folderName, mMessageReference.uid,
|
||||
mController.loadMessageForViewRemote(mAccount, mMessageReference.getFolderName(), mMessageReference.getUid(),
|
||||
downloadMessageListener);
|
||||
}
|
||||
|
||||
@ -526,12 +524,12 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
}
|
||||
|
||||
public void moveMessage(MessageReference reference, String destFolderName) {
|
||||
mController.moveMessage(mAccount, mMessageReference.folderName, mMessage,
|
||||
mController.moveMessage(mAccount, mMessageReference.getFolderName(), mMessage,
|
||||
destFolderName, null);
|
||||
}
|
||||
|
||||
public void copyMessage(MessageReference reference, String destFolderName) {
|
||||
mController.copyMessage(mAccount, mMessageReference.folderName, mMessage,
|
||||
mController.copyMessage(mAccount, mMessageReference.getFolderName(), mMessage,
|
||||
destFolderName, null);
|
||||
}
|
||||
|
||||
@ -644,12 +642,12 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
}
|
||||
|
||||
public boolean canMessageBeArchived() {
|
||||
return (!mMessageReference.folderName.equals(mAccount.getArchiveFolderName())
|
||||
return (!mMessageReference.getFolderName().equals(mAccount.getArchiveFolderName())
|
||||
&& mAccount.hasArchiveFolder());
|
||||
}
|
||||
|
||||
public boolean canMessageBeMovedToSpam() {
|
||||
return (!mMessageReference.folderName.equals(mAccount.getSpamFolderName())
|
||||
return (!mMessageReference.getFolderName().equals(mAccount.getSpamFolderName())
|
||||
&& mAccount.hasSpamFolder());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user