synchronized(messageStore)
{
for(int i = 0; i < messages.length; i++)
{
CustomMessage message = (CustomMessage) messages[i];
switch(action)
{
case ApplicationMessageFolderListener.MESSAGE_DELETED:
messageStore.deleteInboxMessage(message);
// Invoke our callback
MessageListNamespace.getInstance().invokeItemDeleted(message);
break;
case ApplicationMessageFolderListener.MESSAGE_MARKED_OPENED:
// Update message
message.markRead();
// Update storage
messageStore.commitMessage(message);
// Notify GUI that message has changed
folder.fireElementUpdated(message, message);
// Invoke our callback
MessageListNamespace.getInstance().invokeItemMarkedRead(message);
break;
case ApplicationMessageFolderListener.MESSAGE_MARKED_UNOPENED:
// Update message
message.markAsNew();
// Update storage
messageStore.commitMessage(message);
// Notify GUI that message has changed