diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-30 11:20:35 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-30 11:20:35 +0100 |
commit | f2c1a80059af89caeb299a5cc02c401da6b4b138 (patch) | |
tree | c868409a94abdee41313e4509c8625701bfdd4ff /src/eu/siacs/conversations/parser | |
parent | 15c05dc3c3dfe7eee82dac2f180e3505b503fe81 (diff) | |
parent | 7b4f3637db8c99d84fe3c825d583bfc0fa91fada (diff) |
Merge branch 'development'
Diffstat (limited to 'src/eu/siacs/conversations/parser')
-rw-r--r-- | src/eu/siacs/conversations/parser/MessageParser.java | 30 | ||||
-rw-r--r-- | src/eu/siacs/conversations/parser/PresenceParser.java | 5 |
2 files changed, 27 insertions, 8 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index f8329037..383ac89a 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -256,7 +256,6 @@ public class MessageParser extends AbstractParser implements return null; } } - return finishedMessage; } @@ -348,10 +347,18 @@ public class MessageParser extends AbstractParser implements mXmppConnectionService.databaseBackend .updateAccount(account); } + mXmppConnectionService.getAvatarService().clear( + account); + mXmppConnectionService.updateConversationUi(); + mXmppConnectionService.updateAccountUi(); } else { Contact contact = account.getRoster().getContact( from); contact.setAvatar(avatar.getFilename()); + mXmppConnectionService.getAvatarService().clear( + contact); + mXmppConnectionService.updateConversationUi(); + mXmppConnectionService.updateRosterUi(); } } else { mXmppConnectionService.fetchAvatar(account, avatar); @@ -417,8 +424,7 @@ public class MessageParser extends AbstractParser implements message = this.parseCarbonMessage(packet, account); if (message != null) { if (message.getStatus() == Message.STATUS_SEND) { - mXmppConnectionService.getNotificationService() - .activateGracePeriod(); + account.activateGracePeriod(); notify = false; mXmppConnectionService.markRead( message.getConversation(), false); @@ -440,8 +446,7 @@ public class MessageParser extends AbstractParser implements } else { mXmppConnectionService.markRead(message.getConversation(), false); - mXmppConnectionService.getNotificationService() - .activateGracePeriod(); + account.activateGracePeriod(); notify = false; } } @@ -471,13 +476,26 @@ public class MessageParser extends AbstractParser implements } } Conversation conversation = message.getConversation(); - conversation.getMessages().add(message); + conversation.add(message); + + if (message.getStatus() == Message.STATUS_RECEIVED + && conversation.getOtrSession() != null + && !conversation.getOtrSession().getSessionID().getUserID() + .equals(message.getPresence())) { + conversation.endOtrIfNeeded(); + } + if (packet.getType() != MessagePacket.TYPE_ERROR) { if (message.getEncryption() == Message.ENCRYPTION_NONE || mXmppConnectionService.saveEncryptedMessages()) { mXmppConnectionService.databaseBackend.createMessage(message); } } + if (message.trusted() && message.bodyContainsDownloadable()) { + this.mXmppConnectionService.getHttpConnectionManager() + .createNewConnection(message); + notify = false; + } notify = notify && !conversation.isMuted(); if (notify) { mXmppConnectionService.getNotificationService().push(message); diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index 2c3a7dbc..4e90cda8 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -29,6 +29,7 @@ public class PresenceParser extends AbstractParser implements if (before != muc.getMucOptions().online()) { mXmppConnectionService.updateConversationUi(); } + mXmppConnectionService.getAvatarService().clear(muc); } } else if (packet.hasChild("x", "http://jabber.org/protocol/muc")) { Conversation muc = mXmppConnectionService.find(account, packet @@ -39,6 +40,7 @@ public class PresenceParser extends AbstractParser implements if (before != muc.getMucOptions().online()) { mXmppConnectionService.updateConversationUi(); } + mXmppConnectionService.getAvatarService().clear(muc); } } } @@ -58,8 +60,7 @@ public class PresenceParser extends AbstractParser implements Presences.parseShow(packet.findChild("show"))); } else if (type.equals("unavailable")) { account.removePresence(fromParts[1]); - mXmppConnectionService.getNotificationService() - .deactivateGracePeriod(); + account.deactivateGracePeriod(); } } } else { |