[tuxdroid-svn] r5617 - software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/ka
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-10-09 10:10:58
|
Author: remi
Date: 2009-10-09 12:10:43 +0200 (Fri, 09 Oct 2009)
New Revision: 5617
Modified:
software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java
Log:
* Simplified code of "check" mode
Modified: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java
===================================================================
--- software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java 2009-10-09 09:15:09 UTC (rev 5616)
+++ software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java 2009-10-09 10:10:43 UTC (rev 5617)
@@ -83,7 +83,6 @@
*/
public void check() throws MessagingException, IOException, ClassNotFoundException, Exception
{
- boolean notify = false;
Message messages[] = connectToMailBox();
if (messages == null)
@@ -116,57 +115,12 @@
if (!stateAlert.getLastMessages().contains(subject))
{
newMessageAlert = true;
- break;
+ stateAlert.getLastMessages().add(subject);
}
}
}
}
- /* If new message */
- if (newMessageAlert)
- {
- /* Check for allowed messages. */
- for(int i = messages.length - 1; i >= 0; i--)
- {
- String subject;
- String mail;
- boolean seen;
-
- try
- {
- /* Get mail data */
- subject = messages[i].getSubject();
- mail = ((InternetAddress)messages[i].getFrom()[0]).getAddress();
- seen = messages[i].getFlags().contains(Flag.SEEN);
- /* Pass if mail is already seen */
- if (seen)
- {
- continue;
- }
- /* Pass if empty subject */
- if (subject == null)
- {
- continue;
- }
- /* Check if the mail already read */
- for (int j = 0; j < stateAlert.getLastMessages().size(); j++)
- {
- if (!subject.equals(stateAlert.getLastMessages().get(j)))
- {
- notify = true;
- break;
- }
- }
- /* Referencing the current mail */
- stateAlert.getLastMessages().add(subject);
- }
- catch (Exception e)
- {
- /* Prevent unhandled errors */
- ;
- }
- }
- }
- if((notify) && (!firstCheck))
+ if((newMessageAlert) && (!firstCheck))
{
throwResult(true);
throwMessage("You have a new message.");
|