mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 17:18:50 -05:00
Cleaned up style drift using astyle 1.23
find src/com/android/email/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren
This commit is contained in:
parent
a9283ad435
commit
244bad1115
@ -1214,12 +1214,12 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
localFolder.setPushState(newPushState);
|
localFolder.setPushState(newPushState);
|
||||||
}
|
}
|
||||||
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))
|
||||||
{
|
{
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid()
|
Log.v(Email.LOG_TAG, "Message with uid " + message.getUid()
|
||||||
+ " is not downloaded, even partially; trying again");
|
+ " is not downloaded, even partially; trying again");
|
||||||
}
|
}
|
||||||
unsyncedMessages.add(message);
|
unsyncedMessages.add(message);
|
||||||
}
|
}
|
||||||
@ -2170,7 +2170,7 @@ public class MessagingController implements Runnable
|
|||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder
|
Log.d(Email.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder
|
||||||
+ ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
|
+ ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy);
|
||||||
}
|
}
|
||||||
if (isCopy == false && destFolder.equals(account.getTrashFolderName()))
|
if (isCopy == false && destFolder.equals(account.getTrashFolderName()))
|
||||||
{
|
{
|
||||||
@ -2384,11 +2384,11 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFlag(
|
public void setFlag(
|
||||||
final Account account,
|
final Account account,
|
||||||
final String folderName,
|
final String folderName,
|
||||||
final Message[] messages,
|
final Message[] messages,
|
||||||
final Flag flag,
|
final Flag flag,
|
||||||
final boolean newState)
|
final boolean newState)
|
||||||
{
|
{
|
||||||
String[] uids = new String[messages.length];
|
String[] uids = new String[messages.length];
|
||||||
for (int i = 0; i < messages.length; i++)
|
for (int i = 0; i < messages.length; i++)
|
||||||
@ -2417,7 +2417,7 @@ public class MessagingController implements Runnable
|
|||||||
for (int i = 0; i < uids.length; i++)
|
for (int i = 0; i < uids.length; i++)
|
||||||
{
|
{
|
||||||
String uid = uids[i];
|
String uid = uids[i];
|
||||||
// Allows for re-allowing sending of messages that could not be sent
|
// Allows for re-allowing sending of messages that could not be sent
|
||||||
if (flag == Flag.FLAGGED && newState == false
|
if (flag == Flag.FLAGGED && newState == false
|
||||||
&& uid != null
|
&& uid != null
|
||||||
&& account.getOutboxFolderName().equals(folderName))
|
&& account.getOutboxFolderName().equals(folderName))
|
||||||
@ -3282,7 +3282,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
|
public int copyMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
|
||||||
final MessagingListener listener)
|
final MessagingListener listener)
|
||||||
{
|
{
|
||||||
int messagesCopied = 0;
|
int messagesCopied = 0;
|
||||||
for (Message message : messages)
|
for (Message message : messages)
|
||||||
@ -3370,7 +3370,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteMessages(final Account account, final String folder, final Message[] messages,
|
public void deleteMessages(final Account account, final String folder, final Message[] messages,
|
||||||
final MessagingListener listener)
|
final MessagingListener listener)
|
||||||
{
|
{
|
||||||
for (Message message : messages)
|
for (Message message : messages)
|
||||||
{
|
{
|
||||||
@ -3387,7 +3387,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages,
|
private void deleteMessagesSynchronous(final Account account, final String folder, final Message[] messages,
|
||||||
MessagingListener listener)
|
MessagingListener listener)
|
||||||
{
|
{
|
||||||
Folder localFolder = null;
|
Folder localFolder = null;
|
||||||
Folder localTrashFolder = null;
|
Folder localTrashFolder = null;
|
||||||
|
@ -29,117 +29,117 @@ public class MessagingControllerPushReceiver implements PushReceiver
|
|||||||
controller = nController;
|
controller = nController;
|
||||||
mApplication = nApplication;
|
mApplication = nApplication;
|
||||||
}
|
}
|
||||||
ThreadLocal<WakeLock> threadWakeLock = new ThreadLocal<WakeLock>();
|
ThreadLocal<WakeLock> threadWakeLock = new ThreadLocal<WakeLock>();
|
||||||
public void acquireWakeLock()
|
public void acquireWakeLock()
|
||||||
|
{
|
||||||
|
WakeLock wakeLock = threadWakeLock.get();
|
||||||
|
if (wakeLock == null)
|
||||||
{
|
{
|
||||||
WakeLock wakeLock = threadWakeLock.get();
|
PowerManager pm = (PowerManager) mApplication.getSystemService(Context.POWER_SERVICE);
|
||||||
if (wakeLock == null)
|
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
|
||||||
{
|
wakeLock.setReferenceCounted(false);
|
||||||
PowerManager pm = (PowerManager) mApplication.getSystemService(Context.POWER_SERVICE);
|
threadWakeLock.set(wakeLock);
|
||||||
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Email");
|
|
||||||
wakeLock.setReferenceCounted(false);
|
|
||||||
threadWakeLock.set(wakeLock);
|
|
||||||
}
|
|
||||||
wakeLock.acquire(Email.PUSH_WAKE_LOCK_TIMEOUT);
|
|
||||||
if (Email.DEBUG)
|
|
||||||
{
|
|
||||||
Log.d(Email.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
wakeLock.acquire(Email.PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
public void releaseWakeLock()
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
|
Log.d(Email.LOG_TAG, "Acquired WakeLock for Pushing for thread " + Thread.currentThread().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void releaseWakeLock()
|
||||||
|
{
|
||||||
|
if (Email.DEBUG)
|
||||||
|
{
|
||||||
|
Log.d(Email.LOG_TAG, "Considering releasing WakeLock for Pushing");
|
||||||
|
}
|
||||||
|
WakeLock wakeLock = threadWakeLock.get();
|
||||||
|
if (wakeLock != null)
|
||||||
|
{
|
||||||
|
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "Considering releasing WakeLock for Pushing");
|
Log.d(Email.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName());
|
||||||
}
|
}
|
||||||
WakeLock wakeLock = threadWakeLock.get();
|
wakeLock.release();
|
||||||
if (wakeLock != null)
|
}
|
||||||
{
|
else
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Email.DEBUG)
|
public void messagesFlagsChanged(Folder folder,
|
||||||
|
List<Message> messages)
|
||||||
|
{
|
||||||
|
controller.messagesArrived(account, folder, messages, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void messagesArrived(Folder folder, List<Message> messages)
|
||||||
|
{
|
||||||
|
controller.messagesArrived(account, folder, messages, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sleep(long millis)
|
||||||
|
{
|
||||||
|
SleepService.sleep(mApplication, millis, threadWakeLock.get(), Email.PUSH_WAKE_LOCK_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pushError(String errorMessage, Exception e)
|
||||||
|
{
|
||||||
|
String errMess = errorMessage;
|
||||||
|
String body = null;
|
||||||
|
|
||||||
|
if (errMess == null && e != null)
|
||||||
|
{
|
||||||
|
errMess = e.getMessage();
|
||||||
|
}
|
||||||
|
body = errMess;
|
||||||
|
if (e != null)
|
||||||
|
{
|
||||||
|
body = e.toString();
|
||||||
|
}
|
||||||
|
controller.addErrorMessage(account, errMess, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPushState(String folderName)
|
||||||
|
{
|
||||||
|
LocalFolder localFolder = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
|
||||||
|
localFolder= (LocalFolder) localStore.getFolder(folderName);
|
||||||
|
localFolder.open(OpenMode.READ_WRITE);
|
||||||
|
return localFolder.getPushState();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Unable to get push state from account " + account.getDescription()
|
||||||
|
+ ", folder " + folderName, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (localFolder != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "Releasing WakeLock for Pushing for thread " + Thread.currentThread().getName());
|
localFolder.close(false);
|
||||||
}
|
}
|
||||||
wakeLock.release();
|
catch (Exception e)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "No WakeLock waiting to be released for thread " + Thread.currentThread().getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void messagesFlagsChanged(Folder folder,
|
|
||||||
List<Message> messages)
|
|
||||||
{
|
|
||||||
controller.messagesArrived(account, folder, messages, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
public void messagesArrived(Folder folder, List<Message> messages)
|
|
||||||
{
|
|
||||||
controller.messagesArrived(account, folder, messages, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sleep(long millis)
|
|
||||||
{
|
|
||||||
SleepService.sleep(mApplication, millis, threadWakeLock.get(), Email.PUSH_WAKE_LOCK_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void pushError(String errorMessage, Exception e)
|
|
||||||
{
|
|
||||||
String errMess = errorMessage;
|
|
||||||
String body = null;
|
|
||||||
|
|
||||||
if (errMess == null && e != null)
|
|
||||||
{
|
|
||||||
errMess = e.getMessage();
|
|
||||||
}
|
|
||||||
body = errMess;
|
|
||||||
if (e != null)
|
|
||||||
{
|
|
||||||
body = e.toString();
|
|
||||||
}
|
|
||||||
controller.addErrorMessage(account, errMess, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPushState(String folderName)
|
|
||||||
{
|
|
||||||
LocalFolder localFolder = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
|
|
||||||
localFolder= (LocalFolder) localStore.getFolder(folderName);
|
|
||||||
localFolder.open(OpenMode.READ_WRITE);
|
|
||||||
return localFolder.getPushState();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Unable to get push state from account " + account.getDescription()
|
|
||||||
+ ", folder " + folderName, e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (localFolder != null)
|
|
||||||
{
|
{
|
||||||
try
|
Log.e(Email.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e);
|
||||||
{
|
|
||||||
localFolder.close(false);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Log.e(Email.LOG_TAG, "Unable to close folder '" + folderName + "' in account " + account.getDescription(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setPushActive(String folderName, boolean enabled)
|
public void setPushActive(String folderName, boolean enabled)
|
||||||
|
{
|
||||||
|
for (MessagingListener l : controller.getListeners())
|
||||||
{
|
{
|
||||||
for (MessagingListener l : controller.getListeners())
|
l.setPushActive(account, folderName, enabled);
|
||||||
{
|
|
||||||
l.setPushActive(account, folderName, enabled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class DateFormatter
|
|||||||
|
|
||||||
public static String[] getFormats(Context context)
|
public static String[] getFormats(Context context)
|
||||||
{
|
{
|
||||||
return context.getResources().getStringArray(R.array.date_formats);
|
return context.getResources().getStringArray(R.array.date_formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ThreadLocal<Map<String, DateFormat>> storedFormats = new ThreadLocal<Map<String, DateFormat>>()
|
private static ThreadLocal<Map<String, DateFormat>> storedFormats = new ThreadLocal<Map<String, DateFormat>>()
|
||||||
|
@ -71,8 +71,8 @@ import com.android.email.mail.store.LocalStore.LocalMessage;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class MessageList
|
public class MessageList
|
||||||
extends K9Activity
|
extends K9Activity
|
||||||
implements OnClickListener, AdapterView.OnItemClickListener
|
implements OnClickListener, AdapterView.OnItemClickListener
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final int DIALOG_MARK_ALL_AS_READ = 1;
|
private static final int DIALOG_MARK_ALL_AS_READ = 1;
|
||||||
@ -2101,7 +2101,7 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MessageViewHolder
|
class MessageViewHolder
|
||||||
implements OnCheckedChangeListener
|
implements OnCheckedChangeListener
|
||||||
{
|
{
|
||||||
public TextView subject;
|
public TextView subject;
|
||||||
public TextView preview;
|
public TextView preview;
|
||||||
@ -2252,13 +2252,15 @@ public class MessageList
|
|||||||
}
|
}
|
||||||
else if (v == mBatchFlagButton)
|
else if (v == mBatchFlagButton)
|
||||||
{
|
{
|
||||||
if (!holder.flagged) {
|
if (!holder.flagged)
|
||||||
|
{
|
||||||
newState = true;
|
newState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (v == mBatchReadButton)
|
else if (v == mBatchReadButton)
|
||||||
{
|
{
|
||||||
if (!holder.read) {
|
if (!holder.read)
|
||||||
|
{
|
||||||
newState = true;
|
newState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MessageView extends K9Activity
|
public class MessageView extends K9Activity
|
||||||
implements UrlInterceptHandler, OnClickListener
|
implements UrlInterceptHandler, OnClickListener
|
||||||
{
|
{
|
||||||
private static final String EXTRA_ACCOUNT = "com.android.email.MessageView_account";
|
private static final String EXTRA_ACCOUNT = "com.android.email.MessageView_account";
|
||||||
private static final String EXTRA_FOLDER = "com.android.email.MessageView_folder";
|
private static final String EXTRA_FOLDER = "com.android.email.MessageView_folder";
|
||||||
|
@ -42,7 +42,7 @@ import com.android.email.Utility;
|
|||||||
* AccountSetupAccountType activity.
|
* AccountSetupAccountType activity.
|
||||||
*/
|
*/
|
||||||
public class AccountSetupBasics extends K9Activity
|
public class AccountSetupBasics extends K9Activity
|
||||||
implements OnClickListener, TextWatcher
|
implements OnClickListener, TextWatcher
|
||||||
{
|
{
|
||||||
private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account";
|
private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account";
|
||||||
private final static int DIALOG_NOTE = 1;
|
private final static int DIALOG_NOTE = 1;
|
||||||
|
@ -32,7 +32,7 @@ import com.android.email.R;
|
|||||||
import com.android.email.Utility;
|
import com.android.email.Utility;
|
||||||
|
|
||||||
public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
||||||
OnCheckedChangeListener
|
OnCheckedChangeListener
|
||||||
{
|
{
|
||||||
private static final String EXTRA_ACCOUNT = "account";
|
private static final String EXTRA_ACCOUNT = "account";
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ public abstract class Message implements Part, Body
|
|||||||
public void setRecipient(RecipientType type, Address address) throws MessagingException
|
public void setRecipient(RecipientType type, Address address) throws MessagingException
|
||||||
{
|
{
|
||||||
setRecipients(type, new Address[]
|
setRecipients(type, new Address[]
|
||||||
{
|
{
|
||||||
address
|
address
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Address[] getFrom() throws MessagingException;
|
public abstract Address[] getFrom() throws MessagingException;
|
||||||
|
@ -1952,7 +1952,7 @@ public class ImapStore extends Store
|
|||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
|
Log.d(Email.LOG_TAG, "NAMESPACE = " + hasCapability(CAPABILITY_NAMESPACE)
|
||||||
+ ", mPathPrefix = " + mPathPrefix);
|
+ ", mPathPrefix = " + mPathPrefix);
|
||||||
}
|
}
|
||||||
if (mPathPrefix == null)
|
if (mPathPrefix == null)
|
||||||
{
|
{
|
||||||
@ -2829,7 +2829,7 @@ public class ImapStore extends Store
|
|||||||
public void start(List<String> folderNames)
|
public void start(List<String> folderNames)
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
synchronized(folderPushers)
|
synchronized (folderPushers)
|
||||||
{
|
{
|
||||||
for (String folderName : folderNames)
|
for (String folderName : folderNames)
|
||||||
{
|
{
|
||||||
@ -2846,7 +2846,7 @@ public class ImapStore extends Store
|
|||||||
|
|
||||||
public void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
synchronized(folderPushers)
|
synchronized (folderPushers)
|
||||||
{
|
{
|
||||||
for (ImapFolderPusher folderPusher : folderPushers.values())
|
for (ImapFolderPusher folderPusher : folderPushers.values())
|
||||||
{
|
{
|
||||||
@ -2865,7 +2865,7 @@ public class ImapStore extends Store
|
|||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
Log.i(Email.LOG_TAG, "Requested stop of IMAP pusher");
|
Log.i(Email.LOG_TAG, "Requested stop of IMAP pusher");
|
||||||
synchronized(folderPushers)
|
synchronized (folderPushers)
|
||||||
{
|
{
|
||||||
for (ImapFolderPusher folderPusher : folderPushers.values())
|
for (ImapFolderPusher folderPusher : folderPushers.values())
|
||||||
{
|
{
|
||||||
|
@ -630,9 +630,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status, push_state, last_pushed FROM folders "
|
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status, push_state, last_pushed FROM folders "
|
||||||
+ "where folders.name = ?",
|
+ "where folders.name = ?",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
mName
|
mName
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cursor.moveToFirst())
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
@ -725,10 +725,10 @@ public class LocalStore extends Store implements Serializable
|
|||||||
throw new MessagingException("Folder " + mName + " already exists.");
|
throw new MessagingException("Folder " + mName + " already exists.");
|
||||||
}
|
}
|
||||||
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
|
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
|
||||||
{
|
{
|
||||||
mName,
|
mName,
|
||||||
Email.DEFAULT_VISIBLE_LIMIT
|
Email.DEFAULT_VISIBLE_LIMIT
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,10 +739,10 @@ public class LocalStore extends Store implements Serializable
|
|||||||
throw new MessagingException("Folder " + mName + " already exists.");
|
throw new MessagingException("Folder " + mName + " already exists.");
|
||||||
}
|
}
|
||||||
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
|
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[]
|
||||||
{
|
{
|
||||||
mName,
|
mName,
|
||||||
visibleLimit
|
visibleLimit
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,9 +772,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
{
|
{
|
||||||
cursor = mDb.rawQuery("SELECT COUNT(*) FROM messages WHERE messages.folder_id = ?",
|
cursor = mDb.rawQuery("SELECT COUNT(*) FROM messages WHERE messages.folder_id = ?",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
Long.toString(mFolderId)
|
Long.toString(mFolderId)
|
||||||
});
|
});
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
int messageCount = cursor.getInt(0);
|
int messageCount = cursor.getInt(0);
|
||||||
return messageCount;
|
return messageCount;
|
||||||
@ -1102,19 +1102,19 @@ public class LocalStore extends Store implements Serializable
|
|||||||
cursor = mDb.query(
|
cursor = mDb.query(
|
||||||
"attachments",
|
"attachments",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"id",
|
"id",
|
||||||
"size",
|
"size",
|
||||||
"name",
|
"name",
|
||||||
"mime_type",
|
"mime_type",
|
||||||
"store_data",
|
"store_data",
|
||||||
"content_uri"
|
"content_uri"
|
||||||
},
|
},
|
||||||
"message_id = ?",
|
"message_id = ?",
|
||||||
new String[] { Long.toString(localMessage.mId) },
|
new String[] { Long.toString(localMessage.mId) },
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
while (cursor.moveToNext())
|
while (cursor.moveToNext())
|
||||||
{
|
{
|
||||||
@ -1270,9 +1270,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id "
|
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id "
|
||||||
+ "FROM messages " + "WHERE uid = ? " + "AND folder_id = ?",
|
+ "FROM messages " + "WHERE uid = ? " + "AND folder_id = ?",
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
message.getUid(), Long.toString(mFolderId)
|
message.getUid(), Long.toString(mFolderId)
|
||||||
});
|
});
|
||||||
if (!cursor.moveToNext())
|
if (!cursor.moveToNext())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -1315,9 +1315,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
+ (includeDeleted ? "" : "deleted = 0 AND ")
|
+ (includeDeleted ? "" : "deleted = 0 AND ")
|
||||||
+ " folder_id = ? ORDER BY date DESC"
|
+ " folder_id = ? ORDER BY date DESC"
|
||||||
, new String[]
|
, new String[]
|
||||||
{
|
{
|
||||||
Long.toString(mFolderId)
|
Long.toString(mFolderId)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -1412,11 +1412,11 @@ public class LocalStore extends Store implements Serializable
|
|||||||
message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
|
message.setUid(Email.LOCAL_UID_PREFIX + UUID.randomUUID().toString());
|
||||||
|
|
||||||
mDb.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[]
|
mDb.execSQL("UPDATE messages " + "SET folder_id = ?, uid = ? " + "WHERE id = ?", new Object[]
|
||||||
{
|
{
|
||||||
lDestFolder.getId(),
|
lDestFolder.getId(),
|
||||||
message.getUid(),
|
message.getUid(),
|
||||||
lMessage.getId()
|
lMessage.getId()
|
||||||
});
|
});
|
||||||
|
|
||||||
LocalMessage placeHolder = new LocalMessage(oldUID, this);
|
LocalMessage placeHolder = new LocalMessage(oldUID, this);
|
||||||
placeHolder.setFlagInternal(Flag.DELETED, true);
|
placeHolder.setFlagInternal(Flag.DELETED, true);
|
||||||
@ -1605,27 +1605,27 @@ public class LocalStore extends Store implements Serializable
|
|||||||
+ "html_content = ?, text_content = ?, reply_to_list = ?, "
|
+ "html_content = ?, text_content = ?, reply_to_list = ?, "
|
||||||
+ "attachment_count = ? WHERE id = ?",
|
+ "attachment_count = ? WHERE id = ?",
|
||||||
new Object[]
|
new Object[]
|
||||||
{
|
{
|
||||||
message.getUid(),
|
message.getUid(),
|
||||||
message.getSubject(),
|
message.getSubject(),
|
||||||
Address.pack(message.getFrom()),
|
Address.pack(message.getFrom()),
|
||||||
message.getSentDate() == null ? System
|
message.getSentDate() == null ? System
|
||||||
.currentTimeMillis() : message.getSentDate()
|
.currentTimeMillis() : message.getSentDate()
|
||||||
.getTime(),
|
.getTime(),
|
||||||
Utility.combine(message.getFlags(), ',').toUpperCase(),
|
Utility.combine(message.getFlags(), ',').toUpperCase(),
|
||||||
mFolderId,
|
mFolderId,
|
||||||
Address.pack(message
|
Address.pack(message
|
||||||
.getRecipients(RecipientType.TO)),
|
.getRecipients(RecipientType.TO)),
|
||||||
Address.pack(message
|
Address.pack(message
|
||||||
.getRecipients(RecipientType.CC)),
|
.getRecipients(RecipientType.CC)),
|
||||||
Address.pack(message
|
Address.pack(message
|
||||||
.getRecipients(RecipientType.BCC)),
|
.getRecipients(RecipientType.BCC)),
|
||||||
html.length() > 0 ? html : null,
|
html.length() > 0 ? html : null,
|
||||||
text.length() > 0 ? text : null,
|
text.length() > 0 ? text : null,
|
||||||
Address.pack(message.getReplyTo()),
|
Address.pack(message.getReplyTo()),
|
||||||
attachments.size(),
|
attachments.size(),
|
||||||
message.mId
|
message.mId
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0, count = attachments.size(); i < count; i++)
|
for (int i = 0, count = attachments.size(); i < count; i++)
|
||||||
{
|
{
|
||||||
@ -1665,9 +1665,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
{
|
{
|
||||||
mDb.execSQL("DELETE FROM headers WHERE id = ?",
|
mDb.execSQL("DELETE FROM headers WHERE id = ?",
|
||||||
new Object[]
|
new Object[]
|
||||||
{
|
{
|
||||||
id
|
id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1846,9 +1846,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
{
|
{
|
||||||
open(OpenMode.READ_ONLY);
|
open(OpenMode.READ_ONLY);
|
||||||
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
|
mDb.execSQL("DELETE FROM messages WHERE folder_id = ? and date < ?", new Object[]
|
||||||
{
|
{
|
||||||
Long.toString(mFolderId), new Long(cutoff)
|
Long.toString(mFolderId), new Long(cutoff)
|
||||||
});
|
});
|
||||||
resetUnreadCount();
|
resetUnreadCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1884,9 +1884,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
deleteAttachments(message.getUid());
|
deleteAttachments(message.getUid());
|
||||||
}
|
}
|
||||||
mDb.execSQL("DELETE FROM folders WHERE id = ?", new Object[]
|
mDb.execSQL("DELETE FROM folders WHERE id = ?", new Object[]
|
||||||
{
|
{
|
||||||
Long.toString(mFolderId),
|
Long.toString(mFolderId),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2233,18 +2233,18 @@ public class LocalStore extends Store implements Serializable
|
|||||||
"reply_to_list = NULL " +
|
"reply_to_list = NULL " +
|
||||||
"WHERE id = ?",
|
"WHERE id = ?",
|
||||||
new Object[]
|
new Object[]
|
||||||
{
|
{
|
||||||
mId
|
mId
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete all of the messages' attachments to save space.
|
* Delete all of the messages' attachments to save space.
|
||||||
*/
|
*/
|
||||||
mDb.execSQL("DELETE FROM attachments WHERE id = ?",
|
mDb.execSQL("DELETE FROM attachments WHERE id = ?",
|
||||||
new Object[]
|
new Object[]
|
||||||
{
|
{
|
||||||
mId
|
mId
|
||||||
});
|
});
|
||||||
|
|
||||||
((LocalFolder)mFolder).deleteHeaders(mId);
|
((LocalFolder)mFolder).deleteHeaders(mId);
|
||||||
|
|
||||||
@ -2288,9 +2288,9 @@ public class LocalStore extends Store implements Serializable
|
|||||||
* Set the flags on the message.
|
* Set the flags on the message.
|
||||||
*/
|
*/
|
||||||
mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
|
mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
|
||||||
{
|
{
|
||||||
Utility.combine(getFlags(), ',').toUpperCase(), mId
|
Utility.combine(getFlags(), ',').toUpperCase(), mId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +167,9 @@ public class Pop3Store extends Store
|
|||||||
public Folder[] getPersonalNamespaces() throws MessagingException
|
public Folder[] getPersonalNamespaces() throws MessagingException
|
||||||
{
|
{
|
||||||
return new Folder[]
|
return new Folder[]
|
||||||
{
|
{
|
||||||
getFolder("INBOX"),
|
getFolder("INBOX"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -236,9 +236,9 @@ public class Pop3Store extends Store
|
|||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
final boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
|
final boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
|
||||||
sslContext.init(null, new TrustManager[]
|
sslContext.init(null, new TrustManager[]
|
||||||
{
|
{
|
||||||
TrustManagerFactory.get(mHost, secure)
|
TrustManagerFactory.get(mHost, secure)
|
||||||
}, new SecureRandom());
|
}, new SecureRandom());
|
||||||
mSocket = sslContext.getSocketFactory().createSocket();
|
mSocket = sslContext.getSocketFactory().createSocket();
|
||||||
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
|
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
|
||||||
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
||||||
@ -273,9 +273,9 @@ public class Pop3Store extends Store
|
|||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
|
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
|
||||||
sslContext.init(null, new TrustManager[]
|
sslContext.init(null, new TrustManager[]
|
||||||
{
|
{
|
||||||
TrustManagerFactory.get(mHost, secure)
|
TrustManagerFactory.get(mHost, secure)
|
||||||
}, new SecureRandom());
|
}, new SecureRandom());
|
||||||
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
|
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
|
||||||
true);
|
true);
|
||||||
mSocket.setSoTimeout(Store.SOCKET_READ_TIMEOUT);
|
mSocket.setSoTimeout(Store.SOCKET_READ_TIMEOUT);
|
||||||
|
@ -147,9 +147,9 @@ public class SmtpTransport extends Transport
|
|||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
|
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
|
||||||
sslContext.init(null, new TrustManager[]
|
sslContext.init(null, new TrustManager[]
|
||||||
{
|
{
|
||||||
TrustManagerFactory.get(mHost, secure)
|
TrustManagerFactory.get(mHost, secure)
|
||||||
}, new SecureRandom());
|
}, new SecureRandom());
|
||||||
mSocket = sslContext.getSocketFactory().createSocket();
|
mSocket = sslContext.getSocketFactory().createSocket();
|
||||||
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
|
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
|
||||||
mSecure = true;
|
mSecure = true;
|
||||||
@ -210,9 +210,9 @@ public class SmtpTransport extends Transport
|
|||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
|
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED;
|
||||||
sslContext.init(null, new TrustManager[]
|
sslContext.init(null, new TrustManager[]
|
||||||
{
|
{
|
||||||
TrustManagerFactory.get(mHost, secure)
|
TrustManagerFactory.get(mHost, secure)
|
||||||
}, new SecureRandom());
|
}, new SecureRandom());
|
||||||
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
|
mSocket = sslContext.getSocketFactory().createSocket(mSocket, mHost, mPort,
|
||||||
true);
|
true);
|
||||||
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(),
|
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(),
|
||||||
|
@ -28,9 +28,9 @@ public class TrustedSocketFactory implements LayeredSocketFactory
|
|||||||
{
|
{
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
sslContext.init(null, new TrustManager[]
|
sslContext.init(null, new TrustManager[]
|
||||||
{
|
{
|
||||||
TrustManagerFactory.get(host, secure)
|
TrustManagerFactory.get(host, secure)
|
||||||
}, new SecureRandom());
|
}, new SecureRandom());
|
||||||
mSocketFactory = sslContext.getSocketFactory();
|
mSocketFactory = sslContext.getSocketFactory();
|
||||||
mSchemeSocketFactory = org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory();
|
mSchemeSocketFactory = org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory();
|
||||||
mSchemeSocketFactory.setHostnameVerifier(
|
mSchemeSocketFactory.setHostnameVerifier(
|
||||||
|
Loading…
Reference in New Issue
Block a user