1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-02 00:25:10 -04:00

Aggressively get rid of obsolete Flag X_NO_SEEN_INFO. It was

interfering with "unread" searches on POP3 accounts.

Flags really should be normalized in the database to eliminate the use
of LIKE while searching by Flags.
This commit is contained in:
Daniel Applebaum 2010-04-25 06:17:15 +00:00
parent c7d679f773
commit 6cfcfb953f
3 changed files with 23 additions and 11 deletions

View File

@ -19,10 +19,6 @@ public enum Flag
* these flags and Strings to represent user defined flags. At that point the below
* flags should become user defined flags.
*/
/*
* For POP3 to indicate that the message does not have SEEN info
*/
X_NO_SEEN_INFO,
/**
* Delete and remove from the LocalStore immediately.
*/

View File

@ -34,7 +34,7 @@ import java.util.regex.Matcher;
*/
public class LocalStore extends Store implements Serializable
{
private static final int DB_VERSION = 34;
private static final int DB_VERSION = 35;
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN, Flag.FLAGGED };
private String mPath;
@ -215,6 +215,17 @@ public class LocalStore extends Store implements Serializable
}
}
}
if (mDb.getVersion() < 35)
{
try
{
mDb.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')");
}
catch (SQLiteException e)
{
Log.e(K9.LOG_TAG, "Unable to get rid of obsolete flag X_NO_SEEN_INFO", e);
}
}
}
@ -2357,15 +2368,21 @@ public class LocalStore extends Store implements Serializable
if (flagList != null && flagList.length() > 0)
{
String[] flags = flagList.split(",");
try
{
for (String flag : flags)
{
try
{
this.setFlagInternal(Flag.valueOf(flag), true);
}
}
catch (Exception e)
{
if ("X_BAD_FLAG".equals(flag) == false)
{
Log.w(K9.LOG_TAG, "Unable to parse flag " + flag);
}
}
}
}
this.mId = cursor.getLong(5);

View File

@ -1094,7 +1094,6 @@ public class Pop3Store extends Store
mUid = uid;
mFolder = folder;
mSize = -1;
mFlags.add(Flag.X_NO_SEEN_INFO);
}
public void setSize(int size)