aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-01-12 20:56:27 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-01-12 20:56:27 +0100
commitfd7216b6a06149f96fcc74732d93d871f704bc3e (patch)
tree6042df4d9b403642fb82bacbfa2c7112900b6e68 /src/main
parent585a53834041c502c4ab9162dd41801a30b2a627 (diff)
finish of backlog only for one particular account
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/services/MessageArchiveService.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java19
2 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
index a27e6c3e..39d4b44d 100644
--- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
+++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
@@ -224,7 +224,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
this.finalizeQuery(query, done);
Log.d(Config.LOGTAG,query.getAccount().getJid().toBareJid()+": finished mam after "+query.getTotalCount()+" messages. messages left="+Boolean.toString(!done));
if (query.getWith() == null && query.getMessageCount() > 0) {
- mXmppConnectionService.getNotificationService().finishBacklog(true);
+ mXmppConnectionService.getNotificationService().finishBacklog(true,query.getAccount());
}
} else {
final Query nextQuery;
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 47364b30..2b09fba1 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -100,13 +100,28 @@ public class NotificationService {
}
}
- public void finishBacklog(boolean notify) {
+ public void finishBacklog(boolean notify, Account account) {
synchronized (notifications) {
mXmppConnectionService.updateUnreadCountBadge();
- updateNotification(notify);
+ if (account == null || !notify) {
+ updateNotification(notify);
+ } else {
+ boolean hasPendingMessages = false;
+ for(ArrayList<Message> messages : notifications.values()) {
+ if (messages.size() > 0 && messages.get(0).getConversation().getAccount() == account) {
+ hasPendingMessages = true;
+ break;
+ }
+ }
+ updateNotification(hasPendingMessages);
+ }
}
}
+ public void finishBacklog(boolean notify) {
+ finishBacklog(notify,null);
+ }
+
private void pushToStack(final Message message) {
final String conversationUuid = message.getConversationUuid();
if (notifications.containsKey(conversationUuid)) {