From b673af2ba0b46e7444f536fbc7429f9ef74560fb Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 10 Feb 2014 22:45:59 +0100 Subject: reworked notification a bit --- src/de/gultsch/chat/services/XmppConnectionService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/de/gultsch/chat/services/XmppConnectionService.java') diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java index 1160754e..5a43f99f 100644 --- a/src/de/gultsch/chat/services/XmppConnectionService.java +++ b/src/de/gultsch/chat/services/XmppConnectionService.java @@ -86,6 +86,7 @@ public class XmppConnectionService extends Service { forwarded = packet.findChild("sent").findChild( "forwarded"); status = Message.STATUS_SEND; + notify = false; } else { return; // massage has no body and is not carbon. just // skip @@ -128,6 +129,9 @@ public class XmppConnectionService extends Service { } Message message = new Message(conversation, counterPart, body, Message.ENCRYPTION_NONE, status); + if(notify) { + message.markUnread(); + } conversation.getMessages().add(message); databaseBackend.createMessage(message); if (convChangedListener != null) { @@ -398,6 +402,7 @@ public class XmppConnectionService extends Service { Account account = accountLookupTable.get(conv.getAccountUuid()); conv.setAccount(account); conv.setContact(findContact(account, conv.getContactJid())); + conv.setMessages(databaseBackend.getMessages(conv, 50)); } } return this.conversations; @@ -406,11 +411,7 @@ public class XmppConnectionService extends Service { public List getAccounts() { return this.accounts; } - - public List getMessages(Conversation conversation) { - return databaseBackend.getMessages(conversation, 100); - } - + public Contact findContact(Account account, String jid) { return databaseBackend.findContact(account, jid); } -- cgit v1.2.3