mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -05:00
astyle
This commit is contained in:
parent
c49a856046
commit
9878b74379
@ -136,7 +136,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
private Button mDownloadRemainder;
|
private Button mDownloadRemainder;
|
||||||
|
|
||||||
|
|
||||||
private static Drawable answeredIcon;
|
private static Drawable answeredIcon;
|
||||||
|
|
||||||
|
|
||||||
View next;
|
View next;
|
||||||
|
@ -1739,7 +1739,8 @@ public class MessagingController implements Runnable
|
|||||||
public void messageStarted(String uid, int number, int ofTotal) {}
|
public void messageStarted(String uid, int number, int ofTotal) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messagesFinished(int total) {
|
public void messagesFinished(int total)
|
||||||
|
{
|
||||||
// FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!!
|
// FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3717,7 +3718,8 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (lastFailure == null) {
|
if (lastFailure == null)
|
||||||
|
{
|
||||||
cancelNotification(K9.SEND_FAILED_NOTIFICATION - account.getAccountNumber());
|
cancelNotification(K9.SEND_FAILED_NOTIFICATION - account.getAccountNumber());
|
||||||
}
|
}
|
||||||
closeFolder(localFolder);
|
closeFolder(localFolder);
|
||||||
|
@ -147,190 +147,190 @@ public class LocalStore extends Store implements Serializable
|
|||||||
@Override
|
@Override
|
||||||
public void doDbUpgrade(final SQLiteDatabase db)
|
public void doDbUpgrade(final SQLiteDatabase db)
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d",
|
Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d",
|
||||||
db.getVersion(), DB_VERSION));
|
db.getVersion(), DB_VERSION));
|
||||||
|
|
||||||
|
|
||||||
AttachmentProvider.clear(mApplication);
|
AttachmentProvider.clear(mApplication);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
|
||||||
// schema version 29 was when we moved to incremental updates
|
|
||||||
// in the case of a new db or a < v29 db, we blow away and start from scratch
|
|
||||||
if (db.getVersion() < 29)
|
|
||||||
{
|
{
|
||||||
|
// schema version 29 was when we moved to incremental updates
|
||||||
db.execSQL("DROP TABLE IF EXISTS folders");
|
// in the case of a new db or a < v29 db, we blow away and start from scratch
|
||||||
db.execSQL("CREATE TABLE folders (id INTEGER PRIMARY KEY, name TEXT, "
|
if (db.getVersion() < 29)
|
||||||
+ "last_updated INTEGER, unread_count INTEGER, visible_limit INTEGER, status TEXT, push_state TEXT, last_pushed INTEGER, flagged_count INTEGER default 0)");
|
|
||||||
|
|
||||||
db.execSQL("CREATE INDEX IF NOT EXISTS folder_name ON folders (name)");
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS messages");
|
|
||||||
db.execSQL("CREATE TABLE messages (id INTEGER PRIMARY KEY, deleted INTEGER default 0, folder_id INTEGER, uid TEXT, subject TEXT, "
|
|
||||||
+ "date INTEGER, flags TEXT, sender_list TEXT, to_list TEXT, cc_list TEXT, bcc_list TEXT, reply_to_list TEXT, "
|
|
||||||
+ "html_content TEXT, text_content TEXT, attachment_count INTEGER, internal_date INTEGER, message_id TEXT, preview TEXT)");
|
|
||||||
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS headers");
|
|
||||||
db.execSQL("CREATE TABLE headers (id INTEGER PRIMARY KEY, message_id INTEGER, name TEXT, value TEXT)");
|
|
||||||
db.execSQL("CREATE INDEX IF NOT EXISTS header_folder ON headers (message_id)");
|
|
||||||
|
|
||||||
db.execSQL("CREATE INDEX IF NOT EXISTS msg_uid ON messages (uid, folder_id)");
|
|
||||||
db.execSQL("DROP INDEX IF EXISTS msg_folder_id");
|
|
||||||
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
|
|
||||||
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS attachments");
|
|
||||||
db.execSQL("CREATE TABLE attachments (id INTEGER PRIMARY KEY, message_id INTEGER,"
|
|
||||||
+ "store_data TEXT, content_uri TEXT, size INTEGER, name TEXT,"
|
|
||||||
+ "mime_type TEXT, content_id TEXT, content_disposition TEXT)");
|
|
||||||
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS pending_commands");
|
|
||||||
db.execSQL("CREATE TABLE pending_commands " +
|
|
||||||
"(id INTEGER PRIMARY KEY, command TEXT, arguments TEXT)");
|
|
||||||
|
|
||||||
db.execSQL("DROP TRIGGER IF EXISTS delete_folder");
|
|
||||||
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;");
|
|
||||||
|
|
||||||
db.execSQL("DROP TRIGGER IF EXISTS delete_message");
|
|
||||||
db.execSQL("CREATE TRIGGER delete_message BEFORE DELETE ON messages BEGIN DELETE FROM attachments WHERE old.id = message_id; "
|
|
||||||
+ "DELETE FROM headers where old.id = message_id; END;");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// in the case that we're starting out at 29 or newer, run all the needed updates
|
|
||||||
|
|
||||||
if (db.getVersion() < 30)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
db.execSQL("ALTER TABLE messages ADD deleted INTEGER default 0");
|
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
if (! e.toString().startsWith("duplicate column name: deleted"))
|
|
||||||
{
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (db.getVersion() < 31)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS folders");
|
||||||
|
db.execSQL("CREATE TABLE folders (id INTEGER PRIMARY KEY, name TEXT, "
|
||||||
|
+ "last_updated INTEGER, unread_count INTEGER, visible_limit INTEGER, status TEXT, push_state TEXT, last_pushed INTEGER, flagged_count INTEGER default 0)");
|
||||||
|
|
||||||
|
db.execSQL("CREATE INDEX IF NOT EXISTS folder_name ON folders (name)");
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS messages");
|
||||||
|
db.execSQL("CREATE TABLE messages (id INTEGER PRIMARY KEY, deleted INTEGER default 0, folder_id INTEGER, uid TEXT, subject TEXT, "
|
||||||
|
+ "date INTEGER, flags TEXT, sender_list TEXT, to_list TEXT, cc_list TEXT, bcc_list TEXT, reply_to_list TEXT, "
|
||||||
|
+ "html_content TEXT, text_content TEXT, attachment_count INTEGER, internal_date INTEGER, message_id TEXT, preview TEXT)");
|
||||||
|
|
||||||
|
db.execSQL("DROP TABLE IF EXISTS headers");
|
||||||
|
db.execSQL("CREATE TABLE headers (id INTEGER PRIMARY KEY, message_id INTEGER, name TEXT, value TEXT)");
|
||||||
|
db.execSQL("CREATE INDEX IF NOT EXISTS header_folder ON headers (message_id)");
|
||||||
|
|
||||||
|
db.execSQL("CREATE INDEX IF NOT EXISTS msg_uid ON messages (uid, folder_id)");
|
||||||
|
db.execSQL("DROP INDEX IF EXISTS msg_folder_id");
|
||||||
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
|
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
|
||||||
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
|
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
|
||||||
}
|
db.execSQL("DROP TABLE IF EXISTS attachments");
|
||||||
if (db.getVersion() < 32)
|
db.execSQL("CREATE TABLE attachments (id INTEGER PRIMARY KEY, message_id INTEGER,"
|
||||||
{
|
+ "store_data TEXT, content_uri TEXT, size INTEGER, name TEXT,"
|
||||||
db.execSQL("UPDATE messages SET deleted = 1 WHERE flags LIKE '%DELETED%'");
|
+ "mime_type TEXT, content_id TEXT, content_disposition TEXT)");
|
||||||
}
|
|
||||||
if (db.getVersion() < 33)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
db.execSQL("DROP TABLE IF EXISTS pending_commands");
|
||||||
|
db.execSQL("CREATE TABLE pending_commands " +
|
||||||
|
"(id INTEGER PRIMARY KEY, command TEXT, arguments TEXT)");
|
||||||
|
|
||||||
|
db.execSQL("DROP TRIGGER IF EXISTS delete_folder");
|
||||||
|
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;");
|
||||||
|
|
||||||
|
db.execSQL("DROP TRIGGER IF EXISTS delete_message");
|
||||||
|
db.execSQL("CREATE TRIGGER delete_message BEFORE DELETE ON messages BEGIN DELETE FROM attachments WHERE old.id = message_id; "
|
||||||
|
+ "DELETE FROM headers where old.id = message_id; END;");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// in the case that we're starting out at 29 or newer, run all the needed updates
|
||||||
|
|
||||||
|
if (db.getVersion() < 30)
|
||||||
{
|
{
|
||||||
db.execSQL("ALTER TABLE messages ADD preview TEXT");
|
try
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
if (! e.toString().startsWith("duplicate column name: preview"))
|
|
||||||
{
|
{
|
||||||
throw e;
|
db.execSQL("ALTER TABLE messages ADD deleted INTEGER default 0");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
if (! e.toString().startsWith("duplicate column name: deleted"))
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 31)
|
||||||
|
{
|
||||||
|
db.execSQL("DROP INDEX IF EXISTS msg_folder_id_date");
|
||||||
|
db.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_deleted_date ON messages (folder_id,deleted,internal_date)");
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 32)
|
||||||
|
{
|
||||||
|
db.execSQL("UPDATE messages SET deleted = 1 WHERE flags LIKE '%DELETED%'");
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 33)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE messages ADD preview TEXT");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
if (! e.toString().startsWith("duplicate column name: preview"))
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 34)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE folders ADD flagged_count INTEGER default 0");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
if (! e.getMessage().startsWith("duplicate column name: flagged_count"))
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 35)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 36)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE attachments ADD content_id TEXT");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
Log.e(K9.LOG_TAG, "Unable to add content_id column to attachments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (db.getVersion() < 37)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db.execSQL("ALTER TABLE attachments ADD content_disposition TEXT");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
Log.e(K9.LOG_TAG, "Unable to add content_disposition column to attachments");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (db.getVersion() < 34)
|
// Database version 38 is solely to prune cached attachments now that we clear them better
|
||||||
{
|
if (db.getVersion() < 39)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
db.execSQL("ALTER TABLE folders ADD flagged_count INTEGER default 0");
|
try
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
if (! e.getMessage().startsWith("duplicate column name: flagged_count"))
|
|
||||||
{
|
{
|
||||||
throw e;
|
db.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (db.getVersion() < 35)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
db.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (db.getVersion() < 36)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
db.execSQL("ALTER TABLE attachments ADD content_id TEXT");
|
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
Log.e(K9.LOG_TAG, "Unable to add content_id column to attachments");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (db.getVersion() < 37)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
db.execSQL("ALTER TABLE attachments ADD content_disposition TEXT");
|
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
Log.e(K9.LOG_TAG, "Unable to add content_disposition column to attachments");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Database version 38 is solely to prune cached attachments now that we clear them better
|
|
||||||
if (db.getVersion() < 39)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
db.execSQL("DELETE FROM headers WHERE id in (SELECT headers.id FROM headers LEFT JOIN messages ON headers.message_id = messages.id WHERE messages.id IS NULL)");
|
|
||||||
}
|
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
Log.e(K9.LOG_TAG, "Unable to remove extra header data from the database");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (SQLiteException e)
|
||||||
|
{
|
||||||
|
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0");
|
||||||
|
db.setVersion(0);
|
||||||
|
throw new Error("Database upgrade failed! Resetting your DB version to 0 to force a full schema recreation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
db.setVersion(DB_VERSION);
|
||||||
|
|
||||||
|
if (db.getVersion() != DB_VERSION)
|
||||||
|
{
|
||||||
|
throw new Error("Database upgrade failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unless we're blowing away the whole data store, there's no reason to prune attachments
|
||||||
|
// every time the user upgrades. it'll just cost them money and pain.
|
||||||
|
// try
|
||||||
|
//{
|
||||||
|
// pruneCachedAttachments(true);
|
||||||
|
//}
|
||||||
|
//catch (Exception me)
|
||||||
|
//{
|
||||||
|
// Log.e(K9.LOG_TAG, "Exception while force pruning attachments during DB update", me);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
catch (SQLiteException e)
|
|
||||||
{
|
|
||||||
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0");
|
|
||||||
db.setVersion(0);
|
|
||||||
throw new Error("Database upgrade failed! Resetting your DB version to 0 to force a full schema recreation.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
db.setVersion(DB_VERSION);
|
|
||||||
|
|
||||||
if (db.getVersion() != DB_VERSION)
|
|
||||||
{
|
|
||||||
throw new Error("Database upgrade failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unless we're blowing away the whole data store, there's no reason to prune attachments
|
|
||||||
// every time the user upgrades. it'll just cost them money and pain.
|
|
||||||
// try
|
|
||||||
//{
|
|
||||||
// pruneCachedAttachments(true);
|
|
||||||
//}
|
|
||||||
//catch (Exception me)
|
|
||||||
//{
|
|
||||||
// Log.e(K9.LOG_TAG, "Exception while force pruning attachments during DB update", me);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSize() throws UnavailableStorageException
|
public long getSize() throws UnavailableStorageException
|
||||||
|
@ -600,22 +600,22 @@ public class Pop3Store extends Store
|
|||||||
// Ignore messages without a unique-id
|
// Ignore messages without a unique-id
|
||||||
if (uidParts.length >= 2)
|
if (uidParts.length >= 2)
|
||||||
{
|
{
|
||||||
Integer msgNum = Integer.valueOf(uidParts[0]);
|
Integer msgNum = Integer.valueOf(uidParts[0]);
|
||||||
String msgUid = uidParts[1];
|
String msgUid = uidParts[1];
|
||||||
if (unindexedUids.contains(msgUid))
|
if (unindexedUids.contains(msgUid))
|
||||||
{
|
{
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
|
if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
|
||||||
{
|
{
|
||||||
Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
|
Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pop3Message message = mUidToMsgMap.get(msgUid);
|
Pop3Message message = mUidToMsgMap.get(msgUid);
|
||||||
if (message == null)
|
if (message == null)
|
||||||
{
|
{
|
||||||
message = new Pop3Message(msgUid, this);
|
message = new Pop3Message(msgUid, this);
|
||||||
}
|
}
|
||||||
indexMessage(msgNum, message);
|
indexMessage(msgNum, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ public class WebDavStore extends Store
|
|||||||
buffer.append("SELECT \"DAV:visiblecount\"\r\n");
|
buffer.append("SELECT \"DAV:visiblecount\"\r\n");
|
||||||
buffer.append(" FROM \"\"\r\n");
|
buffer.append(" FROM \"\"\r\n");
|
||||||
buffer.append(" WHERE \"DAV:ishidden\"=False AND \"DAV:isfolder\"=False AND \"urn:schemas:httpmail:read\"=")
|
buffer.append(" WHERE \"DAV:ishidden\"=False AND \"DAV:isfolder\"=False AND \"urn:schemas:httpmail:read\"=")
|
||||||
.append(messageState).append("\r\n");
|
.append(messageState).append("\r\n");
|
||||||
buffer.append(" GROUP BY \"DAV:ishidden\"\r\n");
|
buffer.append(" GROUP BY \"DAV:ishidden\"\r\n");
|
||||||
buffer.append("</a:sql></a:searchrequest>\r\n");
|
buffer.append("</a:sql></a:searchrequest>\r\n");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
@ -544,7 +544,7 @@ public class WebDavStore extends Store
|
|||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
public boolean authenticate()
|
public boolean authenticate()
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -573,7 +573,7 @@ public class WebDavStore extends Store
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new MessagingException("Error with code " + response.getStatusLine().getStatusCode() +
|
throw new MessagingException("Error with code " + response.getStatusLine().getStatusCode() +
|
||||||
" during request processing: " + response.getStatusLine().toString());
|
" during request processing: " + response.getStatusLine().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (info.requiredAuthType == AUTH_TYPE_FORM_BASED)
|
else if (info.requiredAuthType == AUTH_TYPE_FORM_BASED)
|
||||||
@ -608,7 +608,7 @@ public class WebDavStore extends Store
|
|||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private ConnectionInfo doInitialConnection()
|
private ConnectionInfo doInitialConnection()
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
// For our initial connection we are sending an empty GET request to
|
// For our initial connection we are sending an empty GET request to
|
||||||
// the configured URL, which should be in the following form:
|
// the configured URL, which should be in the following form:
|
||||||
@ -639,8 +639,8 @@ public class WebDavStore extends Store
|
|||||||
info.requiredAuthType = AUTH_TYPE_BASIC;
|
info.requiredAuthType = AUTH_TYPE_BASIC;
|
||||||
}
|
}
|
||||||
else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success
|
else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success
|
||||||
(info.statusCode >= 300 && info.statusCode < 400) || // Redirect
|
(info.statusCode >= 300 && info.statusCode < 400) || // Redirect
|
||||||
(info.statusCode == 440)) // Unauthorized
|
(info.statusCode == 440)) // Unauthorized
|
||||||
|
|
||||||
{
|
{
|
||||||
// We will handle all 3 situations the same. First we take an educated
|
// We will handle all 3 situations the same. First we take an educated
|
||||||
@ -671,7 +671,7 @@ public class WebDavStore extends Store
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new IOException("Error with code " + info.statusCode + " during request processing: " +
|
throw new IOException("Error with code " + info.statusCode + " during request processing: " +
|
||||||
response.getStatusLine().toString());
|
response.getStatusLine().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ioe)
|
catch (IOException ioe)
|
||||||
@ -689,7 +689,7 @@ public class WebDavStore extends Store
|
|||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
public void doFBA(ConnectionInfo info)
|
public void doFBA(ConnectionInfo info)
|
||||||
throws IOException, MessagingException
|
throws IOException, MessagingException
|
||||||
{
|
{
|
||||||
// Clear out cookies from any previous authentication.
|
// Clear out cookies from any previous authentication.
|
||||||
mAuthCookies.clear();
|
mAuthCookies.clear();
|
||||||
@ -777,12 +777,12 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
// Reconstruct the login URL based on the original login URL and the form action.
|
// Reconstruct the login URL based on the original login URL and the form action.
|
||||||
URI finalUri = new URI(loginUri.getScheme(),
|
URI finalUri = new URI(loginUri.getScheme(),
|
||||||
loginUri.getUserInfo(),
|
loginUri.getUserInfo(),
|
||||||
loginUri.getHost(),
|
loginUri.getHost(),
|
||||||
loginUri.getPort(),
|
loginUri.getPort(),
|
||||||
urlPath,
|
urlPath,
|
||||||
null,
|
null,
|
||||||
null);
|
null);
|
||||||
loginUrl = finalUri.toString();
|
loginUrl = finalUri.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +817,7 @@ public class WebDavStore extends Store
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private String findFormAction(InputStream istream)
|
private String findFormAction(InputStream istream)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
String formAction = null;
|
String formAction = null;
|
||||||
|
|
||||||
@ -901,8 +901,8 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
private InputStream sendRequest(String url, String method, StringEntity messageBody,
|
private InputStream sendRequest(String url, String method, StringEntity messageBody,
|
||||||
HashMap<String, String> headers, boolean tryAuth)
|
HashMap<String, String> headers, boolean tryAuth)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
InputStream istream = null;
|
InputStream istream = null;
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ public class WebDavStore extends Store
|
|||||||
else if (statusCode < 200 || statusCode >= 300)
|
else if (statusCode < 200 || statusCode >= 300)
|
||||||
{
|
{
|
||||||
throw new IOException("Error with code " + statusCode + " during request processing: " +
|
throw new IOException("Error with code " + statusCode + " during request processing: " +
|
||||||
response.getStatusLine().toString());
|
response.getStatusLine().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
@ -1004,20 +1004,20 @@ public class WebDavStore extends Store
|
|||||||
* response.
|
* response.
|
||||||
*/
|
*/
|
||||||
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers)
|
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
return processRequest(url, method, messageBody, headers, true);
|
return processRequest(url, method, messageBody, headers, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers,
|
private DataSet processRequest(String url, String method, String messageBody, HashMap<String, String> headers,
|
||||||
boolean needsParsing)
|
boolean needsParsing)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
DataSet dataset = new DataSet();
|
DataSet dataset = new DataSet();
|
||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
|
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
|
Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
|
||||||
+ messageBody + "'");
|
+ messageBody + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url == null ||
|
if (url == null ||
|
||||||
@ -1061,7 +1061,7 @@ public class WebDavStore extends Store
|
|||||||
catch (ParserConfigurationException pce)
|
catch (ParserConfigurationException pce)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: "
|
Log.e(K9.LOG_TAG, "ParserConfigurationException in processRequest() " + pce + "\nTrace: "
|
||||||
+ processException(pce));
|
+ processException(pce));
|
||||||
throw new MessagingException("ParserConfigurationException in processRequest() ", pce);
|
throw new MessagingException("ParserConfigurationException in processRequest() ", pce);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void moveOrCopyMessages(Message[] messages, String folderName, boolean isMove)
|
private void moveOrCopyMessages(Message[] messages, String folderName, boolean isMove)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
String[] uids = new String[messages.length];
|
String[] uids = new String[messages.length];
|
||||||
|
|
||||||
@ -1373,7 +1373,7 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener)
|
public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
ArrayList<Message> messages = new ArrayList<Message>();
|
ArrayList<Message> messages = new ArrayList<Message>();
|
||||||
String[] uids;
|
String[] uids;
|
||||||
@ -1485,7 +1485,7 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener)
|
public void fetch(Message[] messages, FetchProfile fp, MessageRetrievalListener listener)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
if (messages == null ||
|
if (messages == null ||
|
||||||
messages.length == 0)
|
messages.length == 0)
|
||||||
@ -1522,7 +1522,7 @@ public class WebDavStore extends Store
|
|||||||
* Fetches the full messages or up to lines lines and passes them to the message parser.
|
* Fetches the full messages or up to lines lines and passes them to the message parser.
|
||||||
*/
|
*/
|
||||||
private void fetchMessages(Message[] messages, MessageRetrievalListener listener, int lines)
|
private void fetchMessages(Message[] messages, MessageRetrievalListener listener, int lines)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
WebDavHttpClient httpclient;
|
WebDavHttpClient httpclient;
|
||||||
httpclient = getHttpClient();
|
httpclient = getHttpClient();
|
||||||
@ -1555,7 +1555,7 @@ public class WebDavStore extends Store
|
|||||||
{
|
{
|
||||||
wdMessage.setUrl(getMessageUrls(new String[] { wdMessage.getUid() }).get(wdMessage.getUid()));
|
wdMessage.setUrl(getMessageUrls(new String[] { wdMessage.getUid() }).get(wdMessage.getUid()));
|
||||||
Log.i(K9.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
Log.i(K9.LOG_TAG, "Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||||
+ wdMessage.getUrl() + "'");
|
+ wdMessage.getUrl() + "'");
|
||||||
if (wdMessage.getUrl().equals(""))
|
if (wdMessage.getUrl().equals(""))
|
||||||
{
|
{
|
||||||
throw new MessagingException("Unable to get URL for message");
|
throw new MessagingException("Unable to get URL for message");
|
||||||
@ -1565,7 +1565,7 @@ public class WebDavStore extends Store
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log.i(K9.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
Log.i(K9.LOG_TAG, "Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||||
+ wdMessage.getUrl() + "'");
|
+ wdMessage.getUrl() + "'");
|
||||||
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
|
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
|
||||||
HttpResponse response;
|
HttpResponse response;
|
||||||
HttpEntity entity;
|
HttpEntity entity;
|
||||||
@ -1585,7 +1585,7 @@ public class WebDavStore extends Store
|
|||||||
statusCode > 300)
|
statusCode > 300)
|
||||||
{
|
{
|
||||||
throw new IOException("Error during with code " + statusCode + " during fetch: "
|
throw new IOException("Error during with code " + statusCode + " during fetch: "
|
||||||
+ response.getStatusLine().toString());
|
+ response.getStatusLine().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
@ -1632,8 +1632,8 @@ public class WebDavStore extends Store
|
|||||||
catch (IOException ioe)
|
catch (IOException ioe)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "Non-success response code loading message, response code was " + statusCode
|
Log.e(K9.LOG_TAG, "Non-success response code loading message, response code was " + statusCode
|
||||||
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
|
+ "\nURL: " + wdMessage.getUrl() + "\nError: " + ioe.getMessage() + "\nTrace: "
|
||||||
+ processException(ioe));
|
+ processException(ioe));
|
||||||
throw new MessagingException("Failure code " + statusCode, ioe);
|
throw new MessagingException("Failure code " + statusCode, ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1731,7 +1731,7 @@ public class WebDavStore extends Store
|
|||||||
* Call it a happy balance
|
* Call it a happy balance
|
||||||
*/
|
*/
|
||||||
private void fetchEnvelope(Message[] startMessages, MessageRetrievalListener listener)
|
private void fetchEnvelope(Message[] startMessages, MessageRetrievalListener listener)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
HashMap<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
|
HashMap<String, ParsedMessageEnvelope> envelopes = new HashMap<String, ParsedMessageEnvelope>();
|
||||||
HashMap<String, String> headers = new HashMap<String, String>();
|
HashMap<String, String> headers = new HashMap<String, String>();
|
||||||
@ -1813,7 +1813,7 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlags(Message[] messages, Flag[] flags, boolean value)
|
public void setFlags(Message[] messages, Flag[] flags, boolean value)
|
||||||
throws MessagingException
|
throws MessagingException
|
||||||
{
|
{
|
||||||
String[] uids = new String[messages.length];
|
String[] uids = new String[messages.length];
|
||||||
|
|
||||||
@ -1918,7 +1918,7 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
open(OpenMode.READ_WRITE);
|
open(OpenMode.READ_WRITE);
|
||||||
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
|
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
|
||||||
new BufferedOutputStream(out, 1024));
|
new BufferedOutputStream(out, 1024));
|
||||||
message.writeTo(msgOut);
|
message.writeTo(msgOut);
|
||||||
msgOut.flush();
|
msgOut.flush();
|
||||||
|
|
||||||
@ -1952,8 +1952,8 @@ public class WebDavStore extends Store
|
|||||||
statusCode > 300)
|
statusCode > 300)
|
||||||
{
|
{
|
||||||
throw new IOException("Error with status code " + statusCode
|
throw new IOException("Error with status code " + statusCode
|
||||||
+ " while sending/appending message. Response = "
|
+ " while sending/appending message. Response = "
|
||||||
+ response.getStatusLine().toString() + " for message " + messageURL);
|
+ response.getStatusLine().toString() + " for message " + messageURL);
|
||||||
}
|
}
|
||||||
WebDavMessage retMessage = new WebDavMessage(message.getUid(), this);
|
WebDavMessage retMessage = new WebDavMessage(message.getUid(), this);
|
||||||
|
|
||||||
@ -1984,8 +1984,8 @@ public class WebDavStore extends Store
|
|||||||
public String getUidFromMessageId(Message message) throws MessagingException
|
public String getUidFromMessageId(Message message) throws MessagingException
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG,
|
Log.e(K9.LOG_TAG,
|
||||||
"Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
|
"Unimplemented method getUidFromMessageId in WebDavStore.WebDavFolder could lead to duplicate messages "
|
||||||
+ " being uploaded to the Sent folder");
|
+ " being uploaded to the Sent folder");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1993,7 +1993,7 @@ public class WebDavStore extends Store
|
|||||||
public void setFlags(Flag[] flags, boolean value) throws MessagingException
|
public void setFlags(Flag[] flags, boolean value) throws MessagingException
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG,
|
Log.e(K9.LOG_TAG,
|
||||||
"Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
"Unimplemented method setFlags(Flag[], boolean) breaks markAllMessagesAsRead and EmptyTrash");
|
||||||
// Try to make this efficient by not retrieving all of the messages
|
// Try to make this efficient by not retrieving all of the messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2043,12 +2043,12 @@ public class WebDavStore extends Store
|
|||||||
catch (UnsupportedEncodingException uee)
|
catch (UnsupportedEncodingException uee)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in setUrl: " + uee + "\nTrace: "
|
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in setUrl: " + uee + "\nTrace: "
|
||||||
+ processException(uee));
|
+ processException(uee));
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException iae)
|
catch (IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in setUrl: " + iae + "\nTrace: "
|
||||||
+ processException(iae));
|
+ processException(iae));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length - 1; i++)
|
for (int i = 0; i < length - 1; i++)
|
||||||
@ -2154,7 +2154,7 @@ public class WebDavStore extends Store
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String namespaceURI, String localName,
|
public void startElement(String namespaceURI, String localName,
|
||||||
String qName, Attributes atts) throws SAXException
|
String qName, Attributes atts) throws SAXException
|
||||||
{
|
{
|
||||||
mOpenTags.push(localName);
|
mOpenTags.push(localName);
|
||||||
}
|
}
|
||||||
@ -2190,7 +2190,7 @@ public class WebDavStore extends Store
|
|||||||
* Holds the mappings from the name returned from Exchange to the MIME format header name
|
* Holds the mappings from the name returned from Exchange to the MIME format header name
|
||||||
*/
|
*/
|
||||||
private final HashMap<String, String> mHeaderMappings = new HashMap<String, String>()
|
private final HashMap<String, String> mHeaderMappings = new HashMap<String, String>()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
put("mime-version", "MIME-Version");
|
put("mime-version", "MIME-Version");
|
||||||
put("content-type", "Content-Type");
|
put("content-type", "Content-Type");
|
||||||
@ -2518,12 +2518,12 @@ public class WebDavStore extends Store
|
|||||||
catch (UnsupportedEncodingException uee)
|
catch (UnsupportedEncodingException uee)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in HttpGeneric(String uri): " + uee
|
Log.e(K9.LOG_TAG, "UnsupportedEncodingException caught in HttpGeneric(String uri): " + uee
|
||||||
+ "\nTrace: " + processException(uee));
|
+ "\nTrace: " + processException(uee));
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException iae)
|
catch (IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
|
Log.e(K9.LOG_TAG, "IllegalArgumentException caught in HttpGeneric(String uri): " + iae + "\nTrace: "
|
||||||
+ processException(iae));
|
+ processException(iae));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length - 1; i++)
|
for (int i = 0; i < length - 1; i++)
|
||||||
@ -2540,7 +2540,7 @@ public class WebDavStore extends Store
|
|||||||
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
|
if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
|
||||||
{
|
{
|
||||||
Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length()
|
Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length()
|
||||||
+ ", end = '" + end + "' length = " + end.length());
|
+ ", end = '" + end + "' length = " + end.length());
|
||||||
}
|
}
|
||||||
url = url + "/" + end;
|
url = url + "/" + end;
|
||||||
|
|
||||||
@ -2584,7 +2584,7 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static InputStream getUngzippedContent(HttpEntity entity)
|
public static InputStream getUngzippedContent(HttpEntity entity)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
InputStream responseStream = entity.getContent();
|
InputStream responseStream = entity.getContent();
|
||||||
if (responseStream == null)
|
if (responseStream == null)
|
||||||
@ -2604,7 +2604,7 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse executeOverride(HttpUriRequest request, HttpContext context)
|
public HttpResponse executeOverride(HttpUriRequest request, HttpContext context)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
modifyRequestToAcceptGzipResponse(request);
|
modifyRequestToAcceptGzipResponse(request);
|
||||||
return super.execute(request, context);
|
return super.execute(request, context);
|
||||||
|
@ -57,8 +57,11 @@ public class Editor implements android.content.SharedPreferences.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO Android 2.3 provides a sexy new "apply" method we need to implement
|
// TODO Android 2.3 provides a sexy new "apply" method we need to implement
|
||||||
public void apply() { commit(); }
|
public void apply()
|
||||||
|
{
|
||||||
|
commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,7 +245,8 @@ public class AttachmentProvider extends ContentProvider
|
|||||||
|
|
||||||
// Versions of K-9 before 3.400 had a database name here, not an
|
// Versions of K-9 before 3.400 had a database name here, not an
|
||||||
// account UID, so implement a bit of backcompat
|
// account UID, so implement a bit of backcompat
|
||||||
if (dbName.endsWith(".db")) {
|
if (dbName.endsWith(".db"))
|
||||||
|
{
|
||||||
dbName = dbName.substring(0, dbName.length()-3);
|
dbName = dbName.substring(0, dbName.length()-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user