*/
public void messagesAdded(FolderEvent e) {
StaticDataHelper.log("[LOG]Entering messagesAdded(:FolderEvent)");
final Message mailMessage = e.getMessage();
StaticDataHelper.log("\n[MSG]Properties of this message:");
MailDataStore.printMessageInfo(mailMessage);
Folder folder = mailMessage.getFolder();
int folderType = folder.getType();
MailDataStore.printFolderInfo(folder);
switch (mailMessage.getStatus()) {
// If it's composing, it's a draft
case Message.Status.TX_COMPOSING:
try {
mailMessage.setFlag(Message.Flag.SAVED_THEN_ORPHANED, true);
}
catch (Exception ex) {
StaticDataHelper.log("\n[ERROR]: Error saving message as draft: "+
ex.toString() );
}
StaticDataHelper.log("[INFO]Message has been saved as draft.");
break;
case Message.Status.TX_ERROR:
StaticDataHelper.log("[INFO]Message status: TX_ERROR");
if(folderType == Folder.SENT){
// If the message is in status TX_ERROR, it is because the
// message was sent using sendMessage and blocked for RIM
// standard processing
mailMessage.setStatus(Message.Status.TX_PENDING, 0);
//mailMessage.updateUi();
StaticDataHelper.log("\n[DEBUG]: Folder type SENT. Message status set to SENDING....");
}
break;
case Message.Status.TX_GENERAL_FAILURE: