mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
remove a bunch of listener notification duplication that crept into the
code. this caused all attachments to be double-opened, among other things
This commit is contained in:
parent
a60a2a4295
commit
c7e8969b01
@ -2742,31 +2742,21 @@ public class MessagingController implements Runnable {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (part.getBody() != null) {
|
if (part.getBody() != null) {
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
l.loadAttachmentStarted(account, message, part, tag, false);
|
l.loadAttachmentStarted(account, message, part, tag, false);
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
|
||||||
listener.loadAttachmentStarted(account, message, part, tag, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
l.loadAttachmentFinished(account, message, part, tag);
|
l.loadAttachmentFinished(account, message, part, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
|
||||||
listener.loadAttachmentFinished(account, message, part, tag);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
l.loadAttachmentStarted(account, message, part, tag, true);
|
l.loadAttachmentStarted(account, message, part, tag, true);
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
|
||||||
listener.loadAttachmentStarted(account, message, part, tag, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
put("loadAttachment", listener, new Runnable() {
|
put("loadAttachment", listener, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -2793,22 +2783,16 @@ public class MessagingController implements Runnable {
|
|||||||
remoteFolder.fetchPart(remoteMessage, part, null);
|
remoteFolder.fetchPart(remoteMessage, part, null);
|
||||||
|
|
||||||
localFolder.updateMessage((LocalMessage)message);
|
localFolder.updateMessage((LocalMessage)message);
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
l.loadAttachmentFinished(account, message, part, tag);
|
l.loadAttachmentFinished(account, message, part, tag);
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
|
||||||
listener.loadAttachmentFinished(account, message, part, tag);
|
|
||||||
}
|
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.v(K9.LOG_TAG, "Exception loading attachment", me);
|
Log.v(K9.LOG_TAG, "Exception loading attachment", me);
|
||||||
|
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
l.loadAttachmentFailed(account, message, part, tag, me.getMessage());
|
l.loadAttachmentFailed(account, message, part, tag, me.getMessage());
|
||||||
}
|
}
|
||||||
if (listener != null) {
|
|
||||||
listener.loadAttachmentFailed(account, message, part, tag, me.getMessage());
|
|
||||||
}
|
|
||||||
addErrorMessage(account, null, me);
|
addErrorMessage(account, null, me);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@ -3371,10 +3355,7 @@ public class MessagingController implements Runnable {
|
|||||||
//We need to make these callbacks before moving the messages to the trash
|
//We need to make these callbacks before moving the messages to the trash
|
||||||
//as messages get a new UID after being moved
|
//as messages get a new UID after being moved
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
if (listener != null) {
|
for (MessagingListener l : getListeners(listener)) {
|
||||||
listener.messageDeleted(account, folder, message);
|
|
||||||
}
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.messageDeleted(account, folder, message);
|
l.messageDeleted(account, folder, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3813,10 +3794,7 @@ public class MessagingController implements Runnable {
|
|||||||
long oldSize = localStore.getSize();
|
long oldSize = localStore.getSize();
|
||||||
localStore.compact();
|
localStore.compact();
|
||||||
long newSize = localStore.getSize();
|
long newSize = localStore.getSize();
|
||||||
if (ml != null) {
|
for (MessagingListener l : getListeners(ml)) {
|
||||||
ml.accountSizeChanged(account, oldSize, newSize);
|
|
||||||
}
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.accountSizeChanged(account, oldSize, newSize);
|
l.accountSizeChanged(account, oldSize, newSize);
|
||||||
}
|
}
|
||||||
} catch (UnavailableStorageException e) {
|
} catch (UnavailableStorageException e) {
|
||||||
@ -3843,11 +3821,7 @@ public class MessagingController implements Runnable {
|
|||||||
stats.size = newSize;
|
stats.size = newSize;
|
||||||
stats.unreadMessageCount = 0;
|
stats.unreadMessageCount = 0;
|
||||||
stats.flaggedMessageCount = 0;
|
stats.flaggedMessageCount = 0;
|
||||||
if (ml != null) {
|
for (MessagingListener l : getListeners(ml)) {
|
||||||
ml.accountSizeChanged(account, oldSize, newSize);
|
|
||||||
ml.accountStatusChanged(account, stats);
|
|
||||||
}
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.accountSizeChanged(account, oldSize, newSize);
|
l.accountSizeChanged(account, oldSize, newSize);
|
||||||
l.accountStatusChanged(account, stats);
|
l.accountStatusChanged(account, stats);
|
||||||
}
|
}
|
||||||
@ -3875,11 +3849,7 @@ public class MessagingController implements Runnable {
|
|||||||
stats.size = newSize;
|
stats.size = newSize;
|
||||||
stats.unreadMessageCount = 0;
|
stats.unreadMessageCount = 0;
|
||||||
stats.flaggedMessageCount = 0;
|
stats.flaggedMessageCount = 0;
|
||||||
if (ml != null) {
|
for (MessagingListener l : getListeners(ml)) {
|
||||||
ml.accountSizeChanged(account, oldSize, newSize);
|
|
||||||
ml.accountStatusChanged(account, stats);
|
|
||||||
}
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.accountSizeChanged(account, oldSize, newSize);
|
l.accountSizeChanged(account, oldSize, newSize);
|
||||||
l.accountStatusChanged(account, stats);
|
l.accountStatusChanged(account, stats);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user