Don't broadcast MessageAddedEvent if message wasn't added.

Fixed a bug in SimplexMessagingIntegrationTest that should've caught
this.
This commit is contained in:
akwizgran
2014-07-04 12:07:18 +01:00
parent 96a9178b0b
commit 458c0ca285
3 changed files with 16 additions and 11 deletions

View File

@@ -1133,9 +1133,11 @@ DatabaseCleaner.Callback {
} finally {
lock.writeLock().unlock();
}
// FIXME: MessageAddedEvent should only be broadcast if msg is visible
if(visible) callListeners(new MessageToAckEvent(c));
if(!duplicate) callListeners(new MessageAddedEvent(m.getGroup(), c));
if(visible) {
if(!duplicate)
callListeners(new MessageAddedEvent(m.getGroup(), c));
callListeners(new MessageToAckEvent(c));
}
}
public void receiveOffer(ContactId c, Offer o) throws DbException {

View File

@@ -1077,8 +1077,8 @@ abstract class JdbcDatabase implements Database<Connection> {
}
}
public boolean containsVisibleGroup(Connection txn, ContactId c,
GroupId g) throws DbException {
public boolean containsVisibleGroup(Connection txn, ContactId c, GroupId g)
throws DbException {
PreparedStatement ps = null;
ResultSet rs = null;
try {