From bff23c2e232e8f9a4e64553215130079b7fc5a4f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 28 Sep 2014 15:21:56 +0200 Subject: new notification service. first draft --- src/eu/siacs/conversations/parser/AbstractParser.java | 2 +- src/eu/siacs/conversations/parser/MessageParser.java | 11 ++++++++--- src/eu/siacs/conversations/parser/PresenceParser.java | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/eu/siacs/conversations/parser') diff --git a/src/eu/siacs/conversations/parser/AbstractParser.java b/src/eu/siacs/conversations/parser/AbstractParser.java index efbf5aef..5541c1c6 100644 --- a/src/eu/siacs/conversations/parser/AbstractParser.java +++ b/src/eu/siacs/conversations/parser/AbstractParser.java @@ -60,7 +60,7 @@ public abstract class AbstractParser { protected void updateLastseen(Element packet, Account account, boolean presenceOverwrite) { - String[] fromParts = packet.getAttribute("from").split("/",2); + String[] fromParts = packet.getAttribute("from").split("/", 2); String from = fromParts[0]; String presence = null; if (fromParts.length >= 2) { diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index 9e2ccd92..3891ebf7 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -298,7 +298,8 @@ public class MessageParser extends AbstractParser implements Element password = x.findChild("password"); conversation.getMucOptions().setPassword( password.getContent()); - mXmppConnectionService.databaseBackend.updateConversation(conversation); + mXmppConnectionService.databaseBackend + .updateConversation(conversation); } mXmppConnectionService.joinMuc(conversation); mXmppConnectionService.updateConversationUi(); @@ -314,7 +315,8 @@ public class MessageParser extends AbstractParser implements if (!conversation.getMucOptions().online()) { if (password != null) { conversation.getMucOptions().setPassword(password); - mXmppConnectionService.databaseBackend.updateConversation(conversation); + mXmppConnectionService.databaseBackend + .updateConversation(conversation); } mXmppConnectionService.joinMuc(conversation); mXmppConnectionService.updateConversationUi(); @@ -465,7 +467,10 @@ public class MessageParser extends AbstractParser implements } } notify = notify && !conversation.isMuted(); - mXmppConnectionService.notifyUi(conversation, notify); + if (notify) { + mXmppConnectionService.pushNotification(message); + } + mXmppConnectionService.updateConversationUi(); } private void parseHeadline(MessagePacket packet, Account account) { diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index e240a858..507ebbd2 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -22,7 +22,7 @@ public class PresenceParser extends AbstractParser implements PgpEngine mPgpEngine = mXmppConnectionService.getPgpEngine(); if (packet.hasChild("x", "http://jabber.org/protocol/muc#user")) { Conversation muc = mXmppConnectionService.find(account, packet - .getAttribute("from").split("/",2)[0]); + .getAttribute("from").split("/", 2)[0]); if (muc != null) { boolean before = muc.getMucOptions().online(); muc.getMucOptions().processPacket(packet, mPgpEngine); @@ -32,7 +32,7 @@ public class PresenceParser extends AbstractParser implements } } else if (packet.hasChild("x", "http://jabber.org/protocol/muc")) { Conversation muc = mXmppConnectionService.find(account, packet - .getAttribute("from").split("/",2)[0]); + .getAttribute("from").split("/", 2)[0]); if (muc != null) { boolean before = muc.getMucOptions().online(); muc.getMucOptions().processPacket(packet, mPgpEngine); -- cgit v1.2.3