notify on incomming received carbon messages

This commit is contained in:
Daniel Gultsch 2014-04-04 17:58:53 +02:00
parent b9243033df
commit 34bd79ac04
2 changed files with 12 additions and 4 deletions

View File

@ -136,10 +136,12 @@ public class XmppConnectionService extends Service {
|| (packet.hasChild("sent"))) { || (packet.hasChild("sent"))) {
message = MessageParser.parseCarbonMessage(packet, account, message = MessageParser.parseCarbonMessage(packet, account,
service); service);
if (message != null) { if ((message != null)&&(message.getStatus() == Message.STATUS_SEND)) {
message.getConversation().markRead(); message.getConversation().markRead();
}
notify = false; notify = false;
} else {
notify = true;
}
} }
} else if (packet.getType() == MessagePacket.TYPE_GROUPCHAT) { } else if (packet.getType() == MessagePacket.TYPE_GROUPCHAT) {

View File

@ -191,9 +191,15 @@ public class UIHelper {
List<Conversation> unread = new ArrayList<Conversation>(); List<Conversation> unread = new ArrayList<Conversation>();
for (Conversation conversation : conversations) { for (Conversation conversation : conversations) {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if ((!conversation.isRead())&&((wasHighlighted(conversation)||(alwaysNotify)))) { if ((!conversation.isRead())&&((wasHighlighted(conversation)||(alwaysNotify)))) {
unread.add(conversation); unread.add(conversation);
} }
} else {
if (!conversation.isRead()) {
unread.add(conversation);
}
}
} }
String ringtone = preferences.getString("notification_ringtone", null); String ringtone = preferences.getString("notification_ringtone", null);