finish of backlog only for one particular account
This commit is contained in:
		
							parent
							
								
									585a538340
								
							
						
					
					
						commit
						fd7216b6a0
					
				| @ -224,7 +224,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { | |||||||
| 			this.finalizeQuery(query, done); | 			this.finalizeQuery(query, done); | ||||||
| 			Log.d(Config.LOGTAG,query.getAccount().getJid().toBareJid()+": finished mam after "+query.getTotalCount()+" messages. messages left="+Boolean.toString(!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) { | 			if (query.getWith() == null && query.getMessageCount() > 0) { | ||||||
| 				mXmppConnectionService.getNotificationService().finishBacklog(true); | 				mXmppConnectionService.getNotificationService().finishBacklog(true,query.getAccount()); | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			final Query nextQuery; | 			final Query nextQuery; | ||||||
|  | |||||||
| @ -100,13 +100,28 @@ public class NotificationService { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public void finishBacklog(boolean notify) { | 	public void finishBacklog(boolean notify, Account account) { | ||||||
| 		synchronized (notifications) { | 		synchronized (notifications) { | ||||||
| 			mXmppConnectionService.updateUnreadCountBadge(); | 			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) { | 	private void pushToStack(final Message message) { | ||||||
| 		final String conversationUuid = message.getConversationUuid(); | 		final String conversationUuid = message.getConversationUuid(); | ||||||
| 		if (notifications.containsKey(conversationUuid)) { | 		if (notifications.containsKey(conversationUuid)) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch