mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -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
@ -831,7 +831,7 @@ public class Account implements Serializable
|
|||||||
}
|
}
|
||||||
return super.equals(o);
|
return super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
|
@ -26,14 +26,14 @@ public class K9Activity extends Activity
|
|||||||
|
|
||||||
private java.text.DateFormat mDateFormat;
|
private java.text.DateFormat mDateFormat;
|
||||||
private java.text.DateFormat mTimeFormat;
|
private java.text.DateFormat mTimeFormat;
|
||||||
|
|
||||||
private void setupFormats()
|
private void setupFormats()
|
||||||
{
|
{
|
||||||
|
|
||||||
mDateFormat = DateFormatter.getDateFormat(this);
|
mDateFormat = DateFormatter.getDateFormat(this);
|
||||||
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
|
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.text.DateFormat getTimeFormat()
|
public java.text.DateFormat getTimeFormat()
|
||||||
{
|
{
|
||||||
return mTimeFormat;
|
return mTimeFormat;
|
||||||
|
@ -15,7 +15,7 @@ public class K9ListActivity extends ListActivity
|
|||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
setupFormats();
|
setupFormats();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
@ -25,13 +25,13 @@ public class K9ListActivity extends ListActivity
|
|||||||
|
|
||||||
private java.text.DateFormat mDateFormat;
|
private java.text.DateFormat mDateFormat;
|
||||||
private java.text.DateFormat mTimeFormat;
|
private java.text.DateFormat mTimeFormat;
|
||||||
|
|
||||||
private void setupFormats()
|
private void setupFormats()
|
||||||
{
|
{
|
||||||
mDateFormat = DateFormatter.getDateFormat(this);
|
mDateFormat = DateFormatter.getDateFormat(this);
|
||||||
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
|
mTimeFormat = android.text.format.DateFormat.getTimeFormat(this); // 12/24 date format
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.text.DateFormat getTimeFormat()
|
public java.text.DateFormat getTimeFormat()
|
||||||
{
|
{
|
||||||
return mTimeFormat;
|
return mTimeFormat;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
@ -1892,7 +1892,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
PendingCommand command = new PendingCommand();
|
PendingCommand command = new PendingCommand();
|
||||||
command.command = PENDING_COMMAND_MOVE_OR_COPY_BULK;
|
command.command = PENDING_COMMAND_MOVE_OR_COPY_BULK;
|
||||||
|
|
||||||
int length = 3 + uids.length;
|
int length = 3 + uids.length;
|
||||||
command.arguments = new String[length];
|
command.arguments = new String[length];
|
||||||
command.arguments[0] = srcFolder;
|
command.arguments[0] = srcFolder;
|
||||||
@ -1927,7 +1927,7 @@ public class MessagingController implements Runnable
|
|||||||
String isCopyS = command.arguments[2];
|
String isCopyS = command.arguments[2];
|
||||||
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
||||||
remoteSrcFolder = remoteStore.getFolder(srcFolder);
|
remoteSrcFolder = remoteStore.getFolder(srcFolder);
|
||||||
|
|
||||||
List<Message> messages = new ArrayList<Message>();
|
List<Message> messages = new ArrayList<Message>();
|
||||||
for (int i = 3; i < command.arguments.length; i++)
|
for (int i = 3; i < command.arguments.length; i++)
|
||||||
{
|
{
|
||||||
@ -1937,13 +1937,13 @@ public class MessagingController implements Runnable
|
|||||||
messages.add(remoteSrcFolder.getMessage(uid));
|
messages.add(remoteSrcFolder.getMessage(uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isCopy = false;
|
boolean isCopy = false;
|
||||||
if (isCopyS != null)
|
if (isCopyS != null)
|
||||||
{
|
{
|
||||||
isCopy = Boolean.parseBoolean(isCopyS);
|
isCopy = Boolean.parseBoolean(isCopyS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remoteSrcFolder.exists())
|
if (!remoteSrcFolder.exists())
|
||||||
{
|
{
|
||||||
throw new MessagingException("processingPendingMoveOrCopy: remoteFolder " + srcFolder + " does not exist", true);
|
throw new MessagingException("processingPendingMoveOrCopy: remoteFolder " + srcFolder + " does not exist", true);
|
||||||
@ -1953,7 +1953,7 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteSrcFolder " + srcFolder + " read/write", true);
|
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteSrcFolder " + srcFolder + " read/write", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Email.DEBUG)
|
if (Email.DEBUG)
|
||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder
|
Log.d(Email.LOG_TAG, "processingPendingMoveOrCopy: source folder = " + srcFolder
|
||||||
@ -1970,13 +1970,13 @@ public class MessagingController implements Runnable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
remoteDestFolder = remoteStore.getFolder(destFolder);
|
remoteDestFolder = remoteStore.getFolder(destFolder);
|
||||||
|
|
||||||
remoteDestFolder.open(OpenMode.READ_WRITE);
|
remoteDestFolder.open(OpenMode.READ_WRITE);
|
||||||
if (remoteDestFolder.getMode() != OpenMode.READ_WRITE)
|
if (remoteDestFolder.getMode() != OpenMode.READ_WRITE)
|
||||||
{
|
{
|
||||||
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteDestFolder " + srcFolder + " read/write", true);
|
throw new MessagingException("processingPendingMoveOrCopy: could not open remoteDestFolder " + srcFolder + " read/write", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCopy)
|
if (isCopy)
|
||||||
{
|
{
|
||||||
remoteSrcFolder.copyMessages(messages.toArray(new Message[0]), remoteDestFolder);
|
remoteSrcFolder.copyMessages(messages.toArray(new Message[0]), remoteDestFolder);
|
||||||
@ -2002,7 +2002,7 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueSetFlag(Account account, String folderName, String newState, String flag, String[] uids)
|
private void queueSetFlag(Account account, String folderName, String newState, String flag, String[] uids)
|
||||||
{
|
{
|
||||||
PendingCommand command = new PendingCommand();
|
PendingCommand command = new PendingCommand();
|
||||||
@ -2061,7 +2061,7 @@ public class MessagingController implements Runnable
|
|||||||
messages.add(remoteFolder.getMessage(uid));
|
messages.add(remoteFolder.getMessage(uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messages.size() == 0)
|
if (messages.size() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -2074,9 +2074,9 @@ public class MessagingController implements Runnable
|
|||||||
{
|
{
|
||||||
remoteFolder.close(false);
|
remoteFolder.close(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
|
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
|
||||||
// Eventually, it should be removed
|
// Eventually, it should be removed
|
||||||
private void processPendingSetFlagOld(PendingCommand command, Account account)
|
private void processPendingSetFlagOld(PendingCommand command, Account account)
|
||||||
@ -2121,7 +2121,7 @@ public class MessagingController implements Runnable
|
|||||||
remoteMessage.setFlag(flag, newState);
|
remoteMessage.setFlag(flag, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
|
// TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1
|
||||||
// Eventually, it should be removed
|
// Eventually, it should be removed
|
||||||
private void processPendingMoveOrCopyOld(PendingCommand command, Account account)
|
private void processPendingMoveOrCopyOld(PendingCommand command, Account account)
|
||||||
@ -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()))
|
||||||
{
|
{
|
||||||
@ -2382,13 +2382,13 @@ public class MessagingController implements Runnable
|
|||||||
queuePendingCommand(account, command);
|
queuePendingCommand(account, command);
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
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++)
|
||||||
@ -2397,7 +2397,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
setFlag(account, folderName, uids, flag, newState);
|
setFlag(account, folderName, uids, flag, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlag(
|
public void setFlag(
|
||||||
final Account account,
|
final Account account,
|
||||||
final String folderName,
|
final String folderName,
|
||||||
@ -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))
|
||||||
@ -2426,9 +2426,9 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
messages[i] = localFolder.getMessage(uid);
|
messages[i] = localFolder.getMessage(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
localFolder.setFlags(messages, new Flag[] {flag}, newState);
|
localFolder.setFlags(messages, new Flag[] {flag}, newState);
|
||||||
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
@ -3199,7 +3199,7 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
putBackground("getAccountUnread:" + account.getDescription(), l, unreadRunnable);
|
putBackground("getAccountUnread:" + account.getDescription(), l, unreadRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
|
public int moveMessages(final Account account, final String srcFolder, final Message[] messages, final String destFolder,
|
||||||
final MessagingListener listener)
|
final MessagingListener listener)
|
||||||
{
|
{
|
||||||
@ -3280,9 +3280,9 @@ public class MessagingController implements Runnable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
@ -3358,7 +3358,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
queueMoveOrCopy(account, srcFolder, destFolder, isCopy, new String[] { origUid });
|
queueMoveOrCopy(account, srcFolder, destFolder, isCopy, new String[] { origUid });
|
||||||
|
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
catch (MessagingException me)
|
catch (MessagingException me)
|
||||||
@ -3370,13 +3370,13 @@ 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)
|
||||||
{
|
{
|
||||||
suppressMessage(account, folder, message);
|
suppressMessage(account, folder, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
put("deleteMessages", null, new Runnable()
|
put("deleteMessages", null, new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
@ -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;
|
||||||
@ -3430,7 +3430,7 @@ public class MessagingController implements Runnable
|
|||||||
listener.messageDeleted(account, folder, message);
|
listener.messageDeleted(account, folder, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MessagingListener l : getListeners())
|
for (MessagingListener l : getListeners())
|
||||||
{
|
{
|
||||||
l.folderStatusChanged(account, account.getTrashFolderName());
|
l.folderStatusChanged(account, account.getTrashFolderName());
|
||||||
@ -3499,7 +3499,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getUidsFromMessages(Message[] messages)
|
private String[] getUidsFromMessages(Message[] messages)
|
||||||
{
|
{
|
||||||
String[] uids = new String[messages.length];
|
String[] uids = new String[messages.length];
|
||||||
@ -3954,7 +3954,7 @@ public class MessagingController implements Runnable
|
|||||||
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
|
boolean isNotifyAccount = thisAccount.isNotifyNewMail();
|
||||||
if (isNotifyAccount)
|
if (isNotifyAccount)
|
||||||
{
|
{
|
||||||
|
|
||||||
NotificationManager notifMgr =
|
NotificationManager notifMgr =
|
||||||
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (newMailCount > 0 && unreadMessageCount > 0)
|
if (newMailCount > 0 && unreadMessageCount > 0)
|
||||||
@ -4185,11 +4185,11 @@ public class MessagingController implements Runnable
|
|||||||
Log.i(Email.LOG_TAG, "Starting pusher for " + account.getDescription() + ":" + folder.getName());
|
Log.i(Email.LOG_TAG, "Starting pusher for " + account.getDescription() + ":" + folder.getName());
|
||||||
names.add(folder.getName());
|
names.add(folder.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (names.size() > 0)
|
if (names.size() > 0)
|
||||||
{
|
{
|
||||||
PushReceiver receiver = new MessagingControllerPushReceiver(mApplication, account, this);
|
PushReceiver receiver = new MessagingControllerPushReceiver(mApplication, account, this);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Store store = Store.getInstance(account.getStoreUri(), mApplication);
|
Store store = Store.getInstance(account.getStoreUri(), mApplication);
|
||||||
@ -4218,7 +4218,7 @@ public class MessagingController implements Runnable
|
|||||||
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -22,124 +22,124 @@ public class MessagingControllerPushReceiver implements PushReceiver
|
|||||||
final Account account;
|
final Account account;
|
||||||
final MessagingController controller;
|
final MessagingController controller;
|
||||||
final Application mApplication;
|
final Application mApplication;
|
||||||
|
|
||||||
public MessagingControllerPushReceiver(Application nApplication, Account nAccount, MessagingController nController)
|
public MessagingControllerPushReceiver(Application nApplication, Account nAccount, MessagingController nController)
|
||||||
{
|
{
|
||||||
account = nAccount;
|
account = nAccount;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,30 +18,30 @@ public class DateFormatter
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
private final static Calendar SAMPLE_DATE = Calendar.getInstance();
|
private final static Calendar SAMPLE_DATE = Calendar.getInstance();
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
SAMPLE_DATE.set(SAMPLE_DATE.get(Calendar.YEAR), SAMPLE_DATE.getActualMaximum(Calendar.MONTH), SAMPLE_DATE.getActualMaximum(Calendar.DAY_OF_MONTH));
|
SAMPLE_DATE.set(SAMPLE_DATE.get(Calendar.YEAR), SAMPLE_DATE.getActualMaximum(Calendar.MONTH), SAMPLE_DATE.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String SHORT_FORMAT = "SHORT";
|
public static final String SHORT_FORMAT = "SHORT";
|
||||||
public static final String MEDIUM_FORMAT = "MEDIUM";
|
public static final String MEDIUM_FORMAT = "MEDIUM";
|
||||||
public static final String DEFAULT_FORMAT = SHORT_FORMAT;
|
public static final String DEFAULT_FORMAT = SHORT_FORMAT;
|
||||||
|
|
||||||
public static final String PREF_KEY = "dateFormat";
|
public static final String PREF_KEY = "dateFormat";
|
||||||
|
|
||||||
private static volatile String sChosenFormat = null;
|
private static volatile String sChosenFormat = null;
|
||||||
|
|
||||||
public static String getSampleDate(Context context, String formatString)
|
public static String getSampleDate(Context context, String formatString)
|
||||||
{
|
{
|
||||||
java.text.DateFormat formatter = getDateFormat(context, formatString);
|
java.text.DateFormat formatter = getDateFormat(context, formatString);
|
||||||
return formatter.format(SAMPLE_DATE.getTime());
|
return formatter.format(SAMPLE_DATE.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
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>>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -50,18 +50,18 @@ public class DateFormatter
|
|||||||
return new HashMap<String, DateFormat>();
|
return new HashMap<String, DateFormat>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static DateFormat getDateFormat(Context context, String formatString)
|
public static DateFormat getDateFormat(Context context, String formatString)
|
||||||
{
|
{
|
||||||
java.text.DateFormat dateFormat;
|
java.text.DateFormat dateFormat;
|
||||||
|
|
||||||
if (SHORT_FORMAT.equals(formatString))
|
if (SHORT_FORMAT.equals(formatString))
|
||||||
{
|
{
|
||||||
dateFormat = android.text.format.DateFormat.getDateFormat(context);
|
dateFormat = android.text.format.DateFormat.getDateFormat(context);
|
||||||
}
|
}
|
||||||
else if (MEDIUM_FORMAT.equals(formatString))
|
else if (MEDIUM_FORMAT.equals(formatString))
|
||||||
{
|
{
|
||||||
dateFormat = android.text.format.DateFormat.getMediumDateFormat(context);
|
dateFormat = android.text.format.DateFormat.getMediumDateFormat(context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -76,25 +76,25 @@ public class DateFormatter
|
|||||||
}
|
}
|
||||||
return dateFormat;
|
return dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDateFormat(Editor editor, String formatString)
|
public static void setDateFormat(Editor editor, String formatString)
|
||||||
{
|
{
|
||||||
sChosenFormat = formatString;
|
sChosenFormat = formatString;
|
||||||
editor.putString(PREF_KEY, formatString);
|
editor.putString(PREF_KEY, formatString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormat(Context context)
|
public static String getFormat(Context context)
|
||||||
{
|
{
|
||||||
if (sChosenFormat == null)
|
if (sChosenFormat == null)
|
||||||
{
|
{
|
||||||
Preferences prefs = Preferences.getPreferences(context);
|
Preferences prefs = Preferences.getPreferences(context);
|
||||||
String chosenFormat = prefs.getPreferences().getString(PREF_KEY, DEFAULT_FORMAT);
|
String chosenFormat = prefs.getPreferences().getString(PREF_KEY, DEFAULT_FORMAT);
|
||||||
|
|
||||||
sChosenFormat = chosenFormat;
|
sChosenFormat = chosenFormat;
|
||||||
}
|
}
|
||||||
return sChosenFormat;
|
return sChosenFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateFormat getDateFormat(Context context)
|
public static DateFormat getDateFormat(Context context)
|
||||||
{
|
{
|
||||||
String formatString = getFormat(context);
|
String formatString = getFormat(context);
|
||||||
|
@ -1366,7 +1366,7 @@ public class FolderList extends K9ListActivity
|
|||||||
this.unreadMessageCount = unreadCount;
|
this.unreadMessageCount = unreadCount;
|
||||||
|
|
||||||
folder.close(false);
|
folder.close(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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";
|
||||||
@ -971,7 +971,7 @@ public class MessageView extends K9Activity
|
|||||||
Toast.makeText(this, getString(R.string.end_of_folder), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getString(R.string.end_of_folder), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastDirection = PREVIOUS;
|
mLastDirection = PREVIOUS;
|
||||||
displayMessage(mPreviousMessageUid);
|
displayMessage(mPreviousMessageUid);
|
||||||
mTopView.startAnimation(inFromRightAnimation());
|
mTopView.startAnimation(inFromRightAnimation());
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class Prefs extends K9PreferenceActivity
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
|
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
|
||||||
String[] formats = DateFormatter.getFormats(this);
|
String[] formats = DateFormatter.getFormats(this);
|
||||||
CharSequence[] entries = new CharSequence[formats.length];
|
CharSequence[] entries = new CharSequence[formats.length];
|
||||||
@ -75,8 +75,8 @@ public class Prefs extends K9PreferenceActivity
|
|||||||
values[i] = format;
|
values[i] = format;
|
||||||
}
|
}
|
||||||
mDateFormat.setEntries(entries);
|
mDateFormat.setEntries(entries);
|
||||||
mDateFormat.setEntryValues(values);
|
mDateFormat.setEntryValues(values);
|
||||||
|
|
||||||
mDateFormat.setValue(DateFormatter.getFormat(this));
|
mDateFormat.setValue(DateFormatter.getFormat(this));
|
||||||
mDateFormat.setSummary(mDateFormat.getEntry());
|
mDateFormat.setSummary(mDateFormat.getEntry());
|
||||||
mDateFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
mDateFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||||
|
@ -102,7 +102,7 @@ public abstract class Folder
|
|||||||
public void copyMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
|
public void copyMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
|
||||||
|
|
||||||
public void moveMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
|
public void moveMessages(Message[] msgs, Folder folder) throws MessagingException {} ;
|
||||||
|
|
||||||
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
||||||
{
|
{
|
||||||
for (Message message : msgs)
|
for (Message message : msgs)
|
||||||
|
@ -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;
|
||||||
|
@ -100,7 +100,7 @@ public class ImapStore extends Store
|
|||||||
private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes
|
private static final int IDLE_REFRESH_INTERVAL = 20 * 60 * 1000; // 20 minutes
|
||||||
|
|
||||||
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN };
|
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN };
|
||||||
|
|
||||||
private static final String CAPABILITY_IDLE = "IDLE";
|
private static final String CAPABILITY_IDLE = "IDLE";
|
||||||
private static final String COMMAND_IDLE = "IDLE";
|
private static final String COMMAND_IDLE = "IDLE";
|
||||||
private static final String CAPABILITY_NAMESPACE = "NAMESPACE";
|
private static final String CAPABILITY_NAMESPACE = "NAMESPACE";
|
||||||
@ -264,7 +264,7 @@ public class ImapStore extends Store
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArrayList<Folder> folders = new ArrayList<Folder>();
|
ArrayList<Folder> folders = new ArrayList<Folder>();
|
||||||
|
|
||||||
List<ImapResponse> responses =
|
List<ImapResponse> responses =
|
||||||
connection.executeSimpleCommand(String.format("LIST \"\" \"%s*\"",
|
connection.executeSimpleCommand(String.format("LIST \"\" \"%s*\"",
|
||||||
getCombinedPrefix()));
|
getCombinedPrefix()));
|
||||||
@ -288,7 +288,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (getCombinedPrefix().length() > 0)
|
if (getCombinedPrefix().length() > 0)
|
||||||
{
|
{
|
||||||
if (folder.length() >= getCombinedPrefix().length())
|
if (folder.length() >= getCombinedPrefix().length())
|
||||||
@ -444,7 +444,7 @@ public class ImapStore extends Store
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ImapFolder extends Folder
|
class ImapFolder extends Folder
|
||||||
{
|
{
|
||||||
private String mName;
|
private String mName;
|
||||||
@ -525,7 +525,7 @@ public class ImapStore extends Store
|
|||||||
// 2 OK [READ-WRITE] Select completed.
|
// 2 OK [READ-WRITE] Select completed.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (mPathDelimeter == null)
|
if (mPathDelimeter == null)
|
||||||
{
|
{
|
||||||
List<ImapResponse> nameResponses =
|
List<ImapResponse> nameResponses =
|
||||||
@ -768,7 +768,7 @@ public class ImapStore extends Store
|
|||||||
copyMessages(messages, folder);
|
copyMessages(messages, folder);
|
||||||
setFlags(messages, new Flag[] { Flag.DELETED }, true);
|
setFlags(messages, new Flag[] { Flag.DELETED }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Message[] messages, String trashFolderName) throws MessagingException
|
public void delete(Message[] messages, String trashFolderName) throws MessagingException
|
||||||
{
|
{
|
||||||
if (getName().equals(trashFolderName))
|
if (getName().equals(trashFolderName))
|
||||||
@ -1238,7 +1238,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
return responses;
|
return responses;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handlePossibleUidNext(ImapResponse response)
|
protected void handlePossibleUidNext(ImapResponse response)
|
||||||
{
|
{
|
||||||
if (response.get(0).equals("OK") && response.size() > 1)
|
if (response.get(0).equals("OK") && response.size() > 1)
|
||||||
@ -1288,7 +1288,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handlePossibleUidNext(response);
|
handlePossibleUidNext(response);
|
||||||
|
|
||||||
if (response.get(1).equals("EXPUNGE") && mMessageCount > 0)
|
if (response.get(1).equals("EXPUNGE") && mMessageCount > 0)
|
||||||
{
|
{
|
||||||
mMessageCount--;
|
mMessageCount--;
|
||||||
@ -1951,8 +1951,8 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1969,7 +1969,7 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
Log.d(Email.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId());
|
Log.d(Email.LOG_TAG, "Got NAMESPACE response " + response + " on " + getLogId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Object personalNamespaces = response.get(1);
|
Object personalNamespaces = response.get(1);
|
||||||
if (personalNamespaces != null && personalNamespaces instanceof ImapList)
|
if (personalNamespaces != null && personalNamespaces instanceof ImapList)
|
||||||
{
|
{
|
||||||
@ -2003,7 +2003,7 @@ public class ImapStore extends Store
|
|||||||
Log.i(Email.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability");
|
Log.i(Email.LOG_TAG, "mPathPrefix is unset but server does not have NAMESPACE capability");
|
||||||
mPathPrefix = "";
|
mPathPrefix = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SSLException e)
|
catch (SSLException e)
|
||||||
{
|
{
|
||||||
@ -2055,7 +2055,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
return capabilities.contains(CAPABILITY_IDLE);
|
return capabilities.contains(CAPABILITY_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasCapability(String capability)
|
protected boolean hasCapability(String capability)
|
||||||
{
|
{
|
||||||
return capabilities.contains(capability);
|
return capabilities.contains(capability);
|
||||||
@ -2385,7 +2385,7 @@ public class ImapStore extends Store
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start()
|
public void start()
|
||||||
{
|
{
|
||||||
Runnable runner = new Runnable()
|
Runnable runner = new Runnable()
|
||||||
{
|
{
|
||||||
@ -2760,7 +2760,7 @@ public class ImapStore extends Store
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.e(Email.LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
Log.e(Email.LOG_TAG, "Exception while sending DONE for " + getLogId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2817,7 +2817,7 @@ public class ImapStore extends Store
|
|||||||
{
|
{
|
||||||
final ImapStore mStore;
|
final ImapStore mStore;
|
||||||
final PushReceiver mReceiver;
|
final PushReceiver mReceiver;
|
||||||
|
|
||||||
HashMap<String, ImapFolderPusher> folderPushers = new HashMap<String, ImapFolderPusher>();
|
HashMap<String, ImapFolderPusher> folderPushers = new HashMap<String, ImapFolderPusher>();
|
||||||
|
|
||||||
public ImapPusher(ImapStore store, PushReceiver receiver)
|
public ImapPusher(ImapStore store, PushReceiver receiver)
|
||||||
@ -2825,11 +2825,11 @@ public class ImapStore extends Store
|
|||||||
mStore = store;
|
mStore = store;
|
||||||
mReceiver = receiver;
|
mReceiver = receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
{
|
{
|
||||||
@ -2861,11 +2861,11 @@ 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);
|
||||||
@ -845,7 +845,7 @@ public class Pop3Store extends Store
|
|||||||
public void delete(boolean recurse) throws MessagingException
|
public void delete(boolean recurse) throws MessagingException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
||||||
{
|
{
|
||||||
setFlags(msgs, new Flag[] { Flag.DELETED }, true);
|
setFlags(msgs, new Flag[] { Flag.DELETED }, true);
|
||||||
|
@ -1262,7 +1262,7 @@ public class WebDavStore extends Store
|
|||||||
{
|
{
|
||||||
moveOrCopyMessages(messages, folder.getName(), true);
|
moveOrCopyMessages(messages, folder.getName(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
|
||||||
{
|
{
|
||||||
@ -1375,7 +1375,7 @@ public class WebDavStore extends Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(boolean expunge)
|
public void close(boolean expunge)
|
||||||
{
|
{
|
||||||
this.mMessageCount = 0;
|
this.mMessageCount = 0;
|
||||||
this.mUnreadMessageCount = 0;
|
this.mUnreadMessageCount = 0;
|
||||||
|
@ -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